Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cameron's full-sized avatar

Cameron Boehmer cameron

  • Empty Vessel
  • Portland, OR
  • 05:31 (UTC -07:00)
View GitHub Profile
@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 / 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
### Keybase proof
I hereby claim:
* I am cameron on github.
* I am cameronboehmer (https://keybase.io/cameronboehmer) on keybase.
* I have a public key whose fingerprint is 23AE C637 0289 56C1 718C 7DEB 70B9 C37D ED15 C550
To claim this, I am signing this object:
@cameron
cameron / gist:0399e80ecf7f6a86a8d7
Created March 21, 2015 09:44
protecting the docker daemon with https
#! /bin/bash
# copy/pasta from https://docs.docker.com/articles/https/
set -e
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <hostname> <ip>"
exit
fi
@cameron
cameron / README.md
Last active August 29, 2015 14:16
angular.module().view()

ng.module.view

module.view() is a deliberately half-baked attempt at implementing a web components pattern in angular.

It began as a convenience wrapper on module.directive() to avoid specifying the templateUrl in a context where the templateUrl is derivable from the name of the view.

It also allows views to be included via expression (see example below), which is useful for routing, modals, and other dynamic view inclusion.

Defining a widget with a controller

@cameron
cameron / gist:039be433fa3504d738ba
Created October 14, 2014 18:52
python script to split the curriculum readme file into chunks by section
import re
import os
import shutil
sprints_dir = 'sprints'
section_prefix = '# '
day_prefix = '## '
half_day_prefix = '### '
@cameron
cameron / journalctl
Last active August 29, 2015 14:06
CoreOS bug: docker.service inactive/dead on boot in vagrant/vmware
-- Logs begin at Wed 2014-09-17 01:30:44 UTC, end at Wed 2014-09-17 01:40:14 UTC. --
Sep 17 01:30:44 localhost systemd-journal[87]: Runtime journal is using 6.2M (max allowed 49.9M, trying to leave 74.8M free of 492.8M available → current limit 49.9M).
Sep 17 01:30:44 localhost systemd-journal[87]: Runtime journal is using 6.2M (max allowed 49.9M, trying to leave 74.8M free of 492.8M available → current limit 49.9M).
Sep 17 01:30:44 localhost kernel: Initializing cgroup subsys cpuset
Sep 17 01:30:44 localhost kernel: Initializing cgroup subsys cpu
Sep 17 01:30:44 localhost kernel: Initializing cgroup subsys cpuacct
Sep 17 01:30:44 localhost kernel: Linux version 3.15.8+ (buildbot@ip-10-204-3-57) (gcc version 4.6.3 (Gentoo Hardened 4.6.3 p1.13, pie-0.5.2) ) #2 SMP Fri Aug 15 22:29:31 UTC 2014
Sep 17 01:30:44 localhost kernel: Command line: init=/usr/lib/systemd/systemd console=ttyS0,115200n8 console=tty0 ro noswap cros_legacy root=LABEL=ROOT rootflags=subvol=root usr=gptprio: usr=PARTUUID=7130c94a-213a-4e5a-8