Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kjkuan on github.
  • I am jkuan (https://keybase.io/jkuan) on keybase.
  • I have a public key ASB9kWkq9lYO06DyqAD9cRY11t2ioD0Qu4h5tja7wlrQEAo

To claim this, I am signing this object:

@kjkuan
kjkuan / with-stunnel
Created June 25, 2020 17:56
An alternative implementation of heroku's start-stunnel script that works for rails console
#!/usr/bin/env bash
#
# This script builds on top of Heroku's stunnel wrapper script [1]
# and provides a simplified implementation with fewer moving parts,
# fewer processes, and most importantly, one that works well with
# any commands being wrapped.
#
# To use this wrapper, make sure you've installed the stunnel redis buildpack,
# then simply prefix the command you wish to run with it.
#
@kjkuan
kjkuan / gist:f551c152a865519b397645170e57ee39
Last active May 28, 2024 17:23
Detailed work experience @ theScore Inc.
  • Helped migrated the company's cloud infrastructure from RightScale to AWS, and automated code/service deployments to AWS using a combination of Ansible and Bash. The migration modernized the company's cloud infrastructure and made it more manageable and future proof.
  • Implemented a custom Ansible inventory script in Python using Boto that queries AWS/EC2 to provide host meta info(e.g., tags, host names, IPs, ..., and also note that this was done before Ansible had inventory plugins and before the contrib/ec2.py inventory script was available in Ansible). The custom inventory script allowed us to target our EC2 servers by project, environment, and roles, EC2 tags, with our playbooks, making it easy query our server inventory, as well as organizing and applying our playbooks to selected environments.
  • Written playbooks and Ansible roles for deploying application services(usually a combination of Nginx + Unicorn + Rails app). This automated the deployment of the application's backend services so that develop
@kjkuan
kjkuan / bashflow.sh
Created February 26, 2017 20:40
For-All Each-Do Success Fail
#!/usr/bin/env bash
#
# This is a hack that allows you to express loop and conditional processing
# of an array of items in terms of function definitions.
#
# My initial motivation came from the need to process an array of items, and
# then for those successfully processed items, do another different processing
# step, and similarly for the failed items; perform further processing/filtering
# steps for each failed/successful items.
#
set -g prefix C-s; unbind C-b
bind s send-prefix
bind C-s last-window
set-option -g allow-rename off
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -sg escape-time 0