Skip to content

Instantly share code, notes, and snippets.

View leoxlin's full-sized avatar
:shipit:
Probably Shipping Code Furiously

Leo X. Lin leoxlin

:shipit:
Probably Shipping Code Furiously
View GitHub Profile

Is your feature request related to a problem?

The current reconcile system does not go through subnet auto-discovery after ALB creation. Due to an internal issue we had some subnets run out of IP addresses. According to the docs we saw that the controller only considers subnets with at least eight available IP addresses. This caused ALBs that were created during our internal issue to be missing AZs.

We tried to restart the aws-load-balancer-controller pod to trigger a reconcile but we found that the controller only ran auto-discovery when the the ALB is created.

We couldn't find a way to trigger a reconcile to fix this. Fortunately all of the ALBs created were in our staging environment so we were able to delete the ALB and have the controller recreate them. However we are conc

# Show schema & indexes on table
\d+ table_name


# Explain query
EXPLAIN (FORMAT YAML) SELECT * ... 
@leoxlin
leoxlin / phrase_gen.py
Created July 27, 2022 13:05
Generate some-random-words-and-names style word phrases for external ids, hostnames etc.
#!/usr/bin/env python3
# Usage: ./phrase_gen.py [number of words, default=5] [seperator, default='-']
import random
import sys
def generate_phrase(num_choices, seperator):
return seperator.join(random.choices(WORDS, k=num_choices))
# WORD LIST FROM http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt
WORDS=[

Install 1Pass-CLI V1 and V2

1password CLI changed their schema significantly between v1 and v2.

This can cause a lot of scripts to break.

The official upgrade guide actually recommend running them in parallel.

https://developer.1password.com/docs/cli/upgrade

Git Diff + Patch

Using a diff patch is often times overlooked as a merge strategy because not many people know it exists. This is really useful when you have two branches that have diverged commit wise or if you only want to merge/revert diff from specific files but not cherry-pick the entire commit.

How it works

You want can use git diff of the exact things you want to merge/revert.

# eg. `AWS_PROFILE=production wait_stack create api-servers`
wait_stack () {
STEP_NAME=$1
STACK_NAME=$2
aws cloudformation wait stack-${STEP_NAME}-complete --stack-name ${STACK_NAME} && \
osascript -e "display notification \"stack-${STEP_NAME}-complete ${STACK_NAME}\""
}

Git + JIRA Tools

  1. Install the JIRA CLI

    brew install go-jira
    

    If you cannot install this via brew or is on another OS than MacOS. Look at the install instructions on https://github.com/go-jira/jira

@leoxlin
leoxlin / csv
Created August 13, 2020 19:19
Utility to selectively output CSV files
#!/usr/bin/env python
import csv
import sys
if len(sys.argv) < 2:
print("usage: csv <filename> <opt: col1,col2,...>")
sys.exit(1)
filename = sys.argv[1]
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
public class JavaLambdaCompilerExample {
interface ImplicitLambda1 {
String whatever();
}
interface ImplicitLambda2 {