Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/awk -f
{sub(/^[ \t]+/,"");idx=0}
/\{/{ctx++;idx=1}
/\}/{ctx--}
{id="";for(i=idx;i<ctx;i++)id=sprintf("%s%s", id, "\t");printf "%s%s\n", id, $0}
:deis (master)$ make pull
vagrant ssh -c 'for c in registry logger database cache controller builder router; do echo docker pull deis/$c; docker pull deis/$c; done'
docker pull deis/registry
2014/04/18 16:18:49 Error: client and server don't have same version (client : 1.11, server: 1.10)
docker pull deis/logger
2014/04/18 16:18:49 Error: client and server don't have same version (client : 1.11, server: 1.10)
docker pull deis/database
2014/04/18 16:18:49 Error: client and server don't have same version (client : 1.11, server: 1.10)
docker pull deis/cache
2014/04/18 16:18:49 Error: client and server don't have same version (client : 1.11, server: 1.10)
@bpo
bpo / gist:10070200
Created April 7, 2014 22:45
Add existing git repo as a subdirectory of this git repo.
# usage:
# gitaddsubdir foo https://mygit.repo
#
function gitaddsubdir () {
dirname=$1
repo=$2
git remote add -f $dirname $repo
git checkout $dirname/master -b $dirname
mkdir $dirname
@bpo
bpo / gist:5923478
Created July 3, 2013 22:40
launchctl is insane
:~ (master)$ launchctl limit
cpu unlimited unlimited
filesize unlimited unlimited
data unlimited unlimited
stack 8388608 67104768
core 0 unlimited
rss unlimited unlimited
memlock unlimited unlimited
maxproc 709 1064
maxfiles 500 500
@bpo
bpo / eval-hello.sh
Last active November 2, 2022 19:26
Redis Lua examples
redis-cli EVAL "$(cat hello.lua)" 0
/*
SIGINT wrapper for lighttpd graceful restart feature under runit.
by Zik
("inspired by" execwrap by Sune Foldager) */
/* Errors */
@bpo
bpo / gist:4552868
Last active December 11, 2015 05:29
the effect of bundler
$ time ruby -e "puts 'hi'"
hi
real 0m0.060s
user 0m0.033s
sys 0m0.025s
$ time bundle exec ruby -e "puts 'hi'"
hi
real 0m1.635s
# immediately kill cf-component if its config files change. The crontab will take
# care of re-launching it within a minute.
"$(sys.workdir)/inputs/site/$(component).cf"
changes => detect_content,
classes => if_repaired("kill_$(component)");
@bpo
bpo / github
Created May 30, 2012 19:47
stats
require 'github_api'
require 'statsd'
github = Github.new login: 'bpo', password: "xxxxx"
s = Statsd.new "stats.stovepipestudios.com"
# Send stvp stats
stvp = github.orgs.get "stvp"
s.gauge "bpo.git.stvp.public_repos", stvp.public_repos
s.gauge "bpo.git.stvp.private_repos", stvp.total_private_repos