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 / 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