Skip to content

Instantly share code, notes, and snippets.


Jeff Lindsay progrium

View GitHub Profile
View gist:93c6a98a8af9a548a099
def healthy_nodes():
nodes = requests.get("http://localhost:8500/v1/health/nodes").json()
passing = requests.get("http://localhost:8500/v1/health/state/passing").json()
passing = [c["Node"] for c in passing if c["CheckID"] == "serfHealth"]
return [n for n in nodes if n["Node"] in passing]
View gist:e6a5dd31811befd989a6
++ case "$cmd" in
++ fleetctl --debug=true --strict-host-key-checking=false list-units
I0918 03:22:13.988410 12217 client.go:353] etcd: sending HTTP request GET
I0918 03:22:14.271524 12217 client.go:360] etcd: recv response from GET 200 OK
I0918 03:22:14.271917 12217 client.go:353] etcd: sending HTTP request GET
I0918 03:22:14.331921 12217 client.go:360] etcd: recv response from GET 200 OK
I0918 03:22:14.332321 12217 client.go:353] etcd: sending HTTP request GET
View gist:8b23c938cac6cb74861b
#nl2spc() {
# sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g'
#set -x
fn-args() {
local argline=$(type $1 | grep declare | grep -v "declare desc" | head -1)
View gist:6a24ae8d7ab93bc65579
export PS1="\[\033[01;31m\]\$(status=\$?; [[ \$status -ne 0 ]] && echo \"[\$status] \")\[\033[01;32m\]\u@\h \[\033[01;34m\]\w\n\$ \[\033[00m\]"
alias reload="curl -s > ~/; source ~/.profile"
alias g="git"
alias gpr="git pull --rebase origin"
alias gprr="git pull --rebase"
alias gpu="git push origin"
alias gpuu="git push"
alias gs="git status"
View 0.noattributes
View gist:219576c6a33cc0757292
tail -n +6 $0 | tar -zx "$(uname -sm)"
mv "$(uname -sm)" $0
exec $0 $@
( gzip data with different binaries named after output of uname -sm )
progrium /
Created Feb 17, 2015
Comparing natural brevity and concise expressiveness between Go and shell/Bash for certain tasks using each tool's "standard" library.
curl -s "$url" | tar -zxC "$dest"
View gist:9e1d085d9e978d32e99a
package main
import (
// Field represents a two-dimensional field of cells.
View gist:8b20dd6314f3b164244a
render-template() {
declare filename="$1"; shift
local script k v
for var in "$@"; do
IFS='=' read k v <<< "$var"
cat "$filename" | sed "$script"
progrium / gist:a6d8f4b72fc16891bd15
Last active Aug 29, 2015
Found some notes sketching possible Docker commands before we (well, Solomon) settled on most of what exists today. Some made it, some didn't. Explicit layer management idea was dropped entirely.
View gist:a6d8f4b72fc16891bd15
docker run -L layer://buildlayer -L file:///tmp/appsrc.tgz
docker run --layer buildlayer --layer appsrc.tgz --export > output.tgz
docker run --layer buildlayer --layer appsrc.tgz --export-file myfile > myfile
docker start foobar " web"
docker stop foobar
docker restart foobar
docker info foobar
docker logs foobar
docker destroy foobar