Skip to content

Instantly share code, notes, and snippets.

View ewindisch's full-sized avatar

Erica Windisch ewindisch

View GitHub Profile
@ewindisch
ewindisch / gist:4c1cc547a7858f115f72
Created November 21, 2014 17:51
cloud-init for docker fig pseudo-config
#include https://get.docker.io
#cloud-config
dims-container:
image: ubuntu
command: echo "hello world"
environment:
- SOMETHING: here
- SOMEVAR: value
net: "host"
@ewindisch
ewindisch / gist:3098fb7dea0f97a49134
Last active August 29, 2015 14:08
Psuedo-PoC hack for running Docker containers from block devices
$ mount /dev/sdz1 /mnt; mount -t proc none /mnt/proc; mount -t sys none /mnt/sys;
$ docker run -t -i --hostname=$HOSTNAME --cap-add SYS_CHROOT -v /mnt/:/tmp/ busybox chroot /tmp /sbin/init
@ewindisch
ewindisch / gist:8959919
Created February 12, 2014 17:09
Remove docker images that aren't visible in 'docker images' (the images that only appear with 'images -a')
docker rmi $(comm -3 <(docker images -q | sort) <(docker images -q -a | sort) | sed 's/\t//')
@ewindisch
ewindisch / VisualDeletionDockerContainers.md
Last active August 29, 2015 13:55
Visual deletion of docker containers using 'view'

Description

Semi-visually delete "dead" docker containers.

Overview (video)

Usage Video

Commands / Process

On Thu, Dec 26, 2013 at 7:27 PM, iTunes Store <iTunesStoreSupport@apple.com> wrote:
Dear XXXX,
Hello again!, Thank you for your response, it is much appreciated.
I feel that my emails have not been read.
Your responses do not relate to my problem.
Please read this email.
@ewindisch
ewindisch / git-sum-string-over-time.py
Created July 19, 2013 14:53
Get the total number of results for a string match over time from a git repository. The example here uses 'def test_' to fetch time series data for the addition of unit tests to a code base.
#!/usr/bin/env python2.7
import itertools
import subprocess
import time
def soi(s):
#if isinstance(s, int):
# return s
return int(s.split(':')[-1].rstrip())
@ewindisch
ewindisch / obs-python-sum-iterator.py
Last active December 16, 2015 02:39
Python iterator... without iterators
#!/usr/bin/env python
import operator as yx
from functools import partial as S5
mul=getattr
mul=S5(reduce, (lambda xy:(lambda x,y:x(yx,y))(eval(xy),xy))('mul'))
def S(*_):
"""
Cumulative sum
@ewindisch
ewindisch / life.py
Created March 22, 2013 11:21
Hashed Game of life in Python
#!/usr/bin/env python2.7
def mkboard(seed):
columns = {}
# Need not be efficient while seed is small.
for i in seed:
column = set()
while seed[i].count(1) > 0:
e = seed[i].index(1)
@ewindisch
ewindisch / log.py
Created January 8, 2013 21:43
openstack common (oslo) log.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
@ewindisch
ewindisch / gist:3955156
Created October 25, 2012 20:21
Obama Romney tax script
#!/usr/bin/env python
import sys
def calc_tax(agi, multiplier=1):
tax=0
table = {
0: [ 17400, 10 ],
17400: [ 70700, 15 ],
70700: [142700, 25 ],
142700: [ 217450, 28 ],