Skip to content

Instantly share code, notes, and snippets.

View cameron's full-sized avatar

Cameron Boehmer cameron

  • Empty Vessel
  • Portland, OR
  • 20:44 (UTC -07:00)
View GitHub Profile
@cameron
cameron / docker-ssl-cert-generate
Last active February 2, 2023 10:09
Generate self-signed SSL certs for docker client <— HTTPS —> daemon
#! /bin/bash
# HEADS UP! Make sure to use '*' or a valid hostname for the FDQN prompt
echo 01 > ca.srl
openssl genrsa -des3 -out ca-key.pem
openssl req -new -x509 -days 365 -key ca-key.pem -out ca.pem
openssl genrsa -des3 -out server-key.pem
openssl req -new -key server-key.pem -out server.csr
@cameron
cameron / stash
Created May 2, 2019 13:18
If git stash worked anywhere, but only on one file per directory...
#! /usr/bin/env zsh
# aspires to be git stash, everywhere (temporarily hide and unhide files/dirs)
# achieves less: hides a single file or directory by prefixing it with ".stashed-"
# (i.e., will not stash multiple files in the same dir at once)
if [[ -z "$1" ]]; then
echo "Need either a path or 'pop' as an argument"
exit 1
fi
package tagalog
import "fmt"
func Tagalog(tags ...interface{}) func(...interface{}) {
return func (args ...interface{}) {
fmt.Println(append(args, tags...)...)
}
}
#! /bin/zsh
tmux \
new-session -d -s $sessionName -n emacs 'emacs .' \;\
new-window -n 'app' "bin/run" \;\
new-window -n 'build' "bin/build" \;\
new-window -n 'tests' "bin/test" \;\
new-window -n git \;\
selectw -t emacs
@cameron
cameron / init.sh
Last active August 1, 2017 12:57
initialize a CoreOS vm with the latest docker and DNS service discovery via skydock
This gist is old. Check out http://gijs.github.io/blog/2014/09/09/docker-and-service-discovery/
@cameron
cameron / models.py
Last active June 6, 2017 17:47
401k -> real estate investment paths: early withdrawal and self-directed (self-directed wins by 50%)
CAPITAL = 100000
REAL_ESTATE_RETURN_RATE = .1 / 12
INCOME_TAX = .28
EARLY_WITHDRAWAL_PENALTY = .1
LONG_TERM_CAPITAL_GAINS_TAX = .2
PERIODS = 30*12
# early withdrawal
investment = CAPITAL * (1 - (EARLY_WITHDRAWAL_PENALTY + INCOME_TAX))
@cameron
cameron / pre-commit
Created February 25, 2016 00:09
DONTCOMMIT pre-commit hook
MATCHES=$(grep -rn --exclude-dir=node_modules --exclude-dir=.git "DONTCOMMIT\|<<<<" .)
if [ $? == 0 ]; then
echo "remove DONTCOMMITs and conflicts before committing"
echo $MATCHES
exit 1
fi
@cameron
cameron / docker.sh
Created December 14, 2013 23:53
For those running docker inside a vagrant vm, a shell function that makes it feel native.
# the DOCKER_WRAPPER bit silences the warning that results from running the latest git version
vagrant ssh -c "echo 'DOCKER_WRAPPER'; sudo docker $@" 2>/dev/null | sed '1,/DOCKER_WRAPPER/d'
@cameron
cameron / sitecustomize.py
Created December 4, 2013 10:05
Launch pdb on runtime exceptions -- put this in site-packages/sitecustomize.py or somesuch.
# auto stop in pdb on noneexceptions
def info(exc_type, value, tb):
# dont do anything for keyboard interrupts or exit signals
if exc_type in (KeyboardInterrupt, SystemExit):
return
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(exc_type, value, tb)
else:
@cameron
cameron / gist:6514484
Created September 10, 2013 19:39
put your pub key on a remote machine
if [ $# -lt 2 ]; then
echo "Usage: $0 <key-file> <host> [<user>]"
return
fi
key="$1"
host="$2"
user="$USER"
if [ $# -eq 3 ]; then
user=$3