Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tquach on github.
  • I am tquach (https://keybase.io/tquach) on keybase.
  • I have a public key ASCdt-nLoyM3Bp6_6pI55cMKcrI_46ikeuyJ7xzTc8Zvgwo

To claim this, I am signing this object:

@tquach
tquach / AWS Cheat Sheet.md
Last active July 16, 2020 15:07
AWS Cheat Sheet
# Find unused VPCs in AWS. If no ENI is returned, likely the VPC is unused. 
aws ec2 describe-network-interfaces --filters 'Name=vpc-id,Values=vpc-abcd1234' --query 'NetworkInterfaces[*].NetworkInterfaceId'
@tquach
tquach / how-to-add-ssl-to-traefik.md
Last active February 28, 2020 14:03
Adding SSL to Traefik using Let's Encrypt and Route53 via Helm chart

How to Add Let's Encrypt ACME SSL to Traefik (via Helm)

  1. Update the helm chart values file with the ssl and acme block.
---
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
  name: traefik
 namespace: kube-system
@tquach
tquach / tmux.md
Created January 24, 2016 22:11
tmux cheat sheet
  ?                  # List all key bindings
  :                  # Enter the tmux command prompt
  r                  # Force redraw of the attached client
  c                  # Create a new window

  !                  # Break the current pane out of the window.
  %                  # Split the current pane into two, left and right
  "                  # Split the current pane into two, top and bottom
@tquach
tquach / Dockerfile
Last active April 9, 2023 17:37
Installing Vertica Management Console (MC) with Docker
FROM ubuntu:latest
# Download the deb from My Vertica portal and put in current directory.
ENV VERTICA_CONSOLE vertica-console_7.1.1-0_amd64.deb
RUN apt-get update -q -y && apt-get install -q -y \
curl \
gdb \
mcelog \
openssl \
@tquach
tquach / docker_cheatsheet.sh
Last active March 13, 2016 20:42
Docker cheat sheet
# Start all stopped Docker containers
docker ps -a -f "status=exited" -q | xargs docker start
docker rm -f $(docker ps -a -f "status=exited")
# Remove all dangling Docker images
docker images -f "dangling=true" -q | xargs docker rmi -f
# Pull all NSQ images
IMAGES=("nsqio/nsqadmin" "nsqio/nsqd" "nsqio/nsqlookupd"); for N in $IMAGES; do docker pull $N; done;
@tquach
tquach / inversions.go
Last active August 29, 2015 14:08
Counting the number of inversions in an array of integers in O(nlogn) time.
package inversions
// SortAndCountInversions uses a divide and conquer approach to determine the number of inversion pairs in an integer array
func SortAndCountInversions(a []int) (sorted []int, inversions int) {
n := len(a)
// Base case
if n == 1 {
return a, 0
}
@tquach
tquach / slices.go
Last active August 29, 2015 14:07
Compare two slices of strings for equality in O(n) time.
package slices
// Equal compares two slices of strings for equality in less than polynomial time worst case.
func Equal(s1, s2 []string) bool {
if len(s1) != len(s2) {
return false
}
o := make(map[string]int)
for _, x := range s1 {
@tquach
tquach / gist:9812242
Created March 27, 2014 16:51
JavaScript Beautify User Settings
{
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": true,
"brace_style": "collapse",
"keep_array_indentation": false,
@tquach
tquach / CreatePersonScenario.scala
Last active November 25, 2020 16:34
Custom feeder with random data for Gatling
class CreatePersonScenario extends Simulation {
val customFeeder = new Feeder[String] {
import faker._
import scala.util.Random
private val RNG = new Random
private def randInt(a: Int, b: Int) = RNG.nextInt(b - a) + a