Skip to content

Instantly share code, notes, and snippets.

View thewillhuang's full-sized avatar

William Huang thewillhuang

View GitHub Profile
@thewillhuang
thewillhuang / .cursorrules
Created May 31, 2025 23:34 — forked from boxabirds/.cursorrules
Rock solid: turn Cursor into a rock-solid software engineering companion
# Project Policy
This policy provides a single, authoritative, and machine-readable source of truth for AI coding agents and humans, ensuring that all work is governed by clear, unambiguous rules and workflows. It aims to eliminate ambiguity, reduce supervision needs, and facilitate automation while maintaining accountability and compliance with best practices.
# 1. Introduction
> Rationale: Sets the context, actors, and compliance requirements for the policy, ensuring all participants understand their roles and responsibilities.
## 1.1 Actors
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@thewillhuang
thewillhuang / postgres_queries_and_commands.sql
Created March 25, 2022 03:05 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
WITH RECURSIVE
c(requested, current) AS
( VALUES
('AccessShareLock'::text, 'AccessExclusiveLock'::text),
('RowShareLock'::text, 'ExclusiveLock'::text),
('RowShareLock'::text, 'AccessExclusiveLock'::text),
('RowExclusiveLock'::text, 'ShareLock'::text),
('RowExclusiveLock'::text, 'ShareRowExclusiveLock'::text),
('RowExclusiveLock'::text, 'ExclusiveLock'::text),
('RowExclusiveLock'::text, 'AccessExclusiveLock'::text),
04e7aa32258e0afe113bb18fd79f17e04b65dde8b472a2b4b08db7eb52fe4ee46b9a67bdc8d52cfb15230b3ff191fda64d512f526d65f7b3eda3125217bd2ce922
@thewillhuang
thewillhuang / readme.md
Last active December 21, 2016 19:56
setting up lambci with minimum permissions

Steps for setting up lambci on procore production

{
  "Version": "2012-10-17",
  "Statement": [
    {
 "Action": [
@thewillhuang
thewillhuang / permissions.md
Last active December 16, 2016 19:14
Apex and LambCI minimal permissions

Minimal AWS permission required for for APEX and LambCI for setting up Procore-Lambda

Why?

Some of our tasks require C bindings, such as imagemin, phantomjs, etc. These C bindings need to match AWS Lambda's linux. We need to build native modules in an environment that is the same as AWS Lambda so all the C++ bindings will work using AWS Lambda.

Alternatives

@thewillhuang
thewillhuang / webpack.config.js
Created November 23, 2016 03:40 — forked from oxpa/webpack.config.js
webpack configuration suitable for static content generator plugin and chunks
var ReactDom = require("react-dom");
var Redux = require("redux");
var ReactRouter = require("react-router");
var ReactRedux = require("react-redux");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var window={}
var getElementsByTagName = function (b) {
@thewillhuang
thewillhuang / introrx.md
Last active August 29, 2015 14:18 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.