Skip to content

Instantly share code, notes, and snippets.

View keeb-zz's full-sized avatar

Nick Stinemates keeb-zz

View GitHub Profile
@keeb-zz
keeb-zz / gist:867801
Created March 13, 2011 02:10
walking a tree
import os
folder = '/path/to/folder'
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
except Exception, e:
print e
@keeb-zz
keeb-zz / gist:867806
Created March 13, 2011 02:17
extending a tree
>>> a = ['a', 'b', 'c']
>>> a.extend(['d', 'e', 'f'])
>>> a
['a', 'b', 'c', 'd', 'e', 'f']
@keeb-zz
keeb-zz / add config to pull any github pull request branch
Created July 16, 2013 01:17
git pull request cloning and docker build+tests
git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
@keeb-zz
keeb-zz / README.md
Created July 23, 2013 19:35
The power of Docker+Hipache - Immediate Test Environments, even with Static Port Forwarding

I do most of my development on a remote server or on a local virtual instance. It just makes more sense, being able to work in a portable environment and pick up where I leave off lets me worry less about environment and more about the problem at hand.

One of the problems with using a technology like VirtualBox in combination with Docker is that Docker containers are truly portable and should expose a random port chosen by the host while VirtualBox port forwarding is static. You could, for every container, create a new port forwarding rule in your VirtualBox configuration, but that requires you change host configuration to be able to run your application. Not ideal and certainly not portable.

Enter hipache. Hipache is the best way to configure reverse proxies. In this example, hipache is the entrypoint for all web traffic on the host. Running hipache in a container just like any other service allows for ultimate flexibility.

Vagrantfile

Vagrant is a cool way of abstracting VM semantics and spin

@keeb-zz
keeb-zz / links.md
Last active December 24, 2015 00:49 — forked from crosbymichael/links.md
@keeb-zz
keeb-zz / gist:8869702
Created February 7, 2014 19:12
Read/Writing as a different user
» ~ docker run -u nobody -i -t ubuntu touch /tmp/test
» ~
» ~ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b360de514896 ubuntu:12.04 touch /tmp/test 5 seconds ago Exit 0 distracted_torvalds
» ~ docker commit b360de514896
73f2406aa2cd26d503992f9cfc8e28212bb0513f33094f74b34f4ed1e175c7bc
» ~ docker tag 73f2406aa2cd26d503992f9cfc8e28212bb0513f33094f74b34f4ed1e175c7bc nobody-test
» ~ docker run nobody-test ls -l /tmp
total 0
» meet-nick time docker build -t keeb/meet-nick .
Uploading context 5.632 kB
Uploading context
Step 0 : from ubuntu:12.04
---> 8dbd9e392a96
Step 1 : maintainer Nick Stinemates <[email protected]>
---> Using cache
---> 688c24f5ff75
Step 2 : run apt-get update
---> Using cache