Skip to content

Instantly share code, notes, and snippets.

View monking's full-sized avatar

Christopher Lovejoy monking

View GitHub Profile
@monking
monking / gist:9460530
Last active August 29, 2015 13:57 — forked from esedor/gist:9459580
// Finding a "start" point
> use proximity
switched to db proximity
> doc
{
"loc" : {
"type" : "LineString",
"coordinates" : [
[
@monking
monking / .aliases
Last active August 29, 2015 14:02
Git aliases, and Bash aliases for Git
# go to git root
alias gu='cd $(git rev-parse --show-cdup)'
@monking
monking / first.sh
Created July 23, 2014 07:59
bash: 1st, 2nd, 3rd
o=(th st nd rd th th th th th th);
for i in {1..30}; do echo espeak -w ${i}-count.wav ${i}${o[$((i%10))]}; done
@monking
monking / .bash_aliases
Last active August 29, 2015 14:13
.subshell_aliases
alias ss='PARENT_SHELL=$PARENT_SHELL:$$ $SHELL'
alias ssi='PARENT_SHELL_ARRAY=(${PARENT_SHELL//:/ });echo ${PARENT_SHELL_ARRAY[@]}, ${#PARENT_SHELL_ARRAY[@]} deep'
alias ssk='[[ -n $PARENT_SHELL ]] && exit || echo "You'\''re not in a subshell"'
@monking
monking / codecept.sh
Created March 17, 2015 22:43
run `codecept` from anywhere in your git repo
# Runs codeception wherever you are in a git repo
# include this file in your shell with `. /path/to/codecept.sh`
function codecept() {
local cwd root
cwd="$(pwd)"
cd "./$(git rev-parse --show-cdup)"
root="$(pwd)"
"$root/vendor/codeception/codeception/codecept" $@ -c "$root"
cd "$cwd"
}
@monking
monking / gcg.git-checkout-grep.sh
Last active August 16, 2018 16:50
Some bash functions leveraging git to speed up workflows.
function gcg() { # git checkout grep
local branches flag git_options pattern OPTIND OPTARG
git_options=()
while getopts 'a' flag; do
case $flag in
a) git_options+=('-a');;
esac
done
shift $((OPTIND - 1))
branches=($(git branch ${git_options[@]} | perl -pe 's#^[\*\s]*(remotes/[^/]+/)?##' | grep "$*" | sort | uniq))
@monking
monking / aws-mfa
Last active February 7, 2019 21:13
AWS scripts: authenticate & edit on S3
#!/bin/bash
# https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/
storage=credentialsFile
while getopts et: flag; do
case $flag in
t) mfaToken="$OPTARG";;
e) storage=env;;
@monking
monking / algorithm-sort.md
Last active February 7, 2019 21:17
Hack For LA 2014-05-31 concept

Terms

A 3D+ point is a point with latitude, longitude, elevation, and time components.

A 3D+ vector describes the angle and magnitude of the difference between two 3D+ points.

A route is a series of 3D+ points which connect to form a continuous path.

Algorithm

@monking
monking / vpn.sh
Created July 8, 2019 18:56
NordVPN helper for GNU/Linux
#!/bin/bash
# depends on openvpn (https://openvpn.net/) and json (npm install -g json)
# WARNING: stores credentials in plain text. It would be much better not to do this...
E_FAILED_DOWNLOAD=3
E_USER_ABORT=4
E_UNZIP=5
E_NOTRUNNING=6
E_ALREADYRUNNING=7