Skip to content

Instantly share code, notes, and snippets.

Christopher Lovejoy monking

Block or report user

Report or block monking

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@monking
monking / vpn.sh
Created Jul 8, 2019
NordVPN helper for GNU/Linux
View vpn.sh
#!/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
@monking
monking / aws-mfa
Last active Feb 7, 2019
AWS scripts: authenticate & edit on S3
View aws-mfa
#!/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 / gcg.git-checkout-grep.sh
Last active Aug 16, 2018
Some bash functions leveraging git to speed up workflows.
View gcg.git-checkout-grep.sh
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 / codecept.sh
Created Mar 17, 2015
run `codecept` from anywhere in your git repo
View codecept.sh
# 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 / .bash_aliases
Last active Aug 29, 2015
.subshell_aliases
View .bash_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 / first.sh
Created Jul 23, 2014
bash: 1st, 2nd, 3rd
View first.sh
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 / .aliases
Last active Aug 29, 2015
Git aliases, and Bash aliases for Git
View .aliases
# go to git root
alias gu='cd $(git rev-parse --show-cdup)'
@monking
monking / algorithm-sort.md
Last active Feb 7, 2019
Hack For LA 2014-05-31 concept
View algorithm-sort.md

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

View gist:9460530
// Finding a "start" point
> use proximity
switched to db proximity
> doc
{
"loc" : {
"type" : "LineString",
"coordinates" : [
[
You can’t perform that action at this time.