Skip to content

Instantly share code, notes, and snippets.


Mike Clarke mikeclarke

View GitHub Profile
mikeclarke / 01-migrate-db.config
Created Nov 4, 2014
.ebextension file for migrating a database with docker
View 01-migrate-db.config
command: "docker run --env DATABASE_URL=`/opt/elasticbeanstalk/bin/get-config environment | jq -r .DATABASE_URL` aws_beanstalk/current-app:latest lein lobos migrate"
leader_only: true
mikeclarke / sentry.rb
Created Mar 31, 2014
sentry software config for omnibus-ruby. should be added to an omnibus project in `config/software/sentry.rb`
View sentry.rb
name "sentry"
default_version "6.4.4"
dependency "python"
dependency "pip"
build do
command "#{install_dir}/embedded/bin/pip install -I --install-option=\"--install-scripts=#{install_dir}/bin\" #{name}==#{version}"
command "rm -rf #{install_dir}/embedded/lib/python2.7/site-packages/sentry/static/CACHE/sentry/bootstrap/.git*"
command "rm -rf #{install_dir}/embedded/lib/python2.7/site-packages/sentry/static/sentry/bootstrap/.git*"
mikeclarke / gist:9844487
Created Mar 28, 2014
Stacktrace for git caching error
View gist:9844487
Something went wrong...the Omnibus just ran off the road!
Error raised was:
Expected process to exit with [0], but received '128'
---- Begin output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f ----
STDERR: fatal: Not a git repository: embedded/lib/python2.7/site-packages/sentry/static/CACHE/sentry/bootstrap/../../../../../.git/modules/src/sentry/static/sentry/bootstrap
---- End output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f ----
Ran git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f returned 128

Keybase proof

I hereby claim:

  • I am mikeclarke on github.
  • I am mikeclarke ( on keybase.
  • I have a public key whose fingerprint is 1F99 4D6A C1D3 771D 46AA E6C3 A597 17C3 18C9 FCDF

To claim this, I am signing this object:

mikeclarke /
Created Nov 25, 2013
Simple bash script that uses Docker to build a test container, run tests inside the container, tag successful builds, and clean up after itself.
sudo docker build -t $JOB_NAME/$BUILD_NUMBER .
DB_CONTAINER=$(sudo docker run -d -name $DB_NAME <private repository URL>/database-schema)
sudo docker run -link $DB_NAME:db -t $JOB_NAME/$BUILD_NUMBER nosetests
sudo docker tag $JOB_NAME/$BUILD_NUMBER <private repository URL>/${JOB_NAME}-master
sudo docker push <private repository URL>/${JOB_NAME}-master >/dev/null
sudo docker kill ...
sudo docker rm ...
sudo docker rmi ...
mikeclarke /
Created Nov 23, 2013
Wrapper script for dealing with environment variables set by the `-link container_name:db` argument. The Dockerfile `ENV` directive will set a static environment variable inside the container, but it's not possible to reference dynamic environment variables (at least not very easily) with ENV. This script should be set as the `ENTRYPOINT` in an …
# Docker doesn't have a great way to set runtime environment variables,
# so use this script to prepare the execution environnment for later processes.
export SQLALCHEMY_DATABASE_URI="postgresql://${DB_PORT_5432_TCP_ADDR}:5432/database_name"
# Execute the commands passed to this script
# e.g. "./ venv/bin/nosetests --with-xunit
exec "$@"
mikeclarke / Dockerfile
Last active Dec 29, 2015
Application-specific sample Dockerfile (inherits from a container generated via
View Dockerfile
FROM <your private Docker repository>/python-base
MAINTAINER Mike Clarke <>
ADD . /opt/app
RUN virtualenv --no-site-packages /opt/app/venv
RUN /opt/app/venv/bin/pip install -r /opt/app/requirements.txt
WORKDIR /opt/app
ENTRYPOINT ["/opt/app/"]
mikeclarke / Dockerfile
Last active Dec 29, 2015
Simple base python Dockerfile (includes some basic OS packages, setuptools, pip, virtualenv, and uwsgi)
View Dockerfile
FROM ubuntu
MAINTAINER Mike Clarke <>
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y language-pack-en
mikeclarke / Code.js
Created Sep 9, 2013
Create an Asana project task from the initial email sent to a mailing list. Emails from your company's domain are ignored. Configure this script to run based on an every minute trigger.
View Code.js
function forwardLabelToAsana() {
var asana_email = '';
var domain = '';
var inbound_label = GmailApp.getUserLabelByName('recruiting/recruiting-inbound');
var destination_label = GmailApp.getUserLabelByName('recruiting');
var threads = inbound_label.getThreads();
for (var i = 0; i < threads.length; i++) {
// We only care about the first message in a thread
var messages = threads[i].getMessages();
mikeclarke / gist:2932816
Created Jun 14, 2012
VirtualBox / sshuttle kernel panic
View gist:2932816
Interval Since Last Panic Report: 1037400 sec
Panics Since Last Report: 5
Anonymous UUID: C0E2044C-7010-42EB-8653-592AF0EE242D
Thu Jun 14 13:39:49 2012
panic(cpu 0 caller 0xffffff80002c266d): Kernel trap at 0xffffff80003b5781, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0x000000000000017c, CR3: 0x0000000000100000, CR4: 0x00000000000206e0
RAX: 0x0000000000000000, RBX: 0x0000000000000000, RCX: 0x0000000000000130, RDX: 0xffffff80003b52e1
RSP: 0xffffff80e962ba00, RBP: 0xffffff80e962bc10, RSI: 0xffffff80e962bb0c, RDI: 0xffffff8020fa2a88
R8: 0x0000000000000000, R9: 0x0000000000000000, R10: 0x8000000000100000, R11: 0xffffff80002d8200