Skip to content

Instantly share code, notes, and snippets.

@chrishenry
chrishenry / dockerfile-from-image.sh
Created January 18, 2018 21:17
Get dockerfile from image
#!/bin/bash
docker history --no-trunc "$1" | \
sed -n -e 's,.*/bin/sh -c #(nop) \(MAINTAINER .*[^ ]\) *0 B,\1,p' | \
head -1
docker inspect --format='{{range $e := .Config.Env}}
ENV {{$e}}
{{end}}{{range $e,$v := .Config.ExposedPorts}}
EXPOSE {{$e}}
{{end}}{{range $e,$v := .Config.Volumes}}
VOLUME {{$e}}
@chrishenry
chrishenry / keybase.md
Created March 19, 2016 14:24
Keybase proof

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@chrishenry
chrishenry / .gitchangelogrc
Created February 2, 2015 19:59
.gitchangelogrc
## This requires a global install of pystache
## pip install pystache
##
## Format
##
## ACTION: [AUDIENCE:] COMMIT_MSG [@TAG ...]
##
## Description
##
## ACTION is one of 'chg', 'fix', 'new'
@chrishenry
chrishenry / connection.py
Created August 10, 2014 22:28
Attempt to mock AWSQueryConnection
class SQSProfileName(AWSMockServiceTestCase):
connection_class = SQSConnection
profile_name = 'prod'
def setUp(self):
super(SQSProfileName, self).setUp()
def mock_init(self, aws_access_key_id=None, aws_secret_access_key=None,
is_secure=True, port=None, proxy=None, proxy_port=None,
proxy_user=None, proxy_pass=None, host=None, debug=0,
@chrishenry
chrishenry / progress.py
Created July 10, 2014 19:33
Estimate how much longer a MySQL ALTER will take
#!/usr/bin/env python
import os
import sys
import glob
import time
import argparse
"""
Track the progress of an ALTER.
@chrishenry
chrishenry / rake_autocomplete.rb
Last active December 24, 2015 20:59
A slightly improved version of a rake task autocomplete function. - Cache less data (we don't need the task descriptions) - Tasks with arguments would break the autocomplete
#!/usr/bin/env ruby
# Complete rake tasks script for bash
# Save it somewhere and then add
# complete -C path/to/script -o default rake
# to your ~/.bashrc
# Chris Henry, combining work from
# Xavier Shay (http://rhnh.net) - http://rhnh.net/2008/06/08/rake-tab-completion-with-caching-and-namespace-support,
# Francis Hwang ( http://fhwang.net/ ) - http://fhwang.net/rb/rake-complete.rb
# Nicholas Seckar <nseckar@gmail.com> - http://www.webtypes.com/2006/03/31/rake-completion-script-that-handles-namespaces