Skip to content

Instantly share code, notes, and snippets.

View mwhooker's full-sized avatar

Matthew Hooker mwhooker

  • tbd
  • San Francisco
View GitHub Profile
import math
from collections import namedtuple
attack_vectors = ('melee', 'range', 'air')
target_type = ('ground', 'air')
dmg_type = ('single', 'area')
Unit = namedtuple('Unit', ('hp', 'length', 'count', 'impl'))
Defender = namedtuple('Defender', ('vector', 'target', 'range_', 'dps'))
package main
import (
"fmt"
"github.com/mwhooker/go.httpcontrol"
"net"
"net/http"
"time"
)
#!/bin/bash
ROOT_STAT=`stat -c %d:%i /proc/1/root/`
VERBOSE="verbose"
set -e
fatal()
{
echo "error: $1" 1>&2
exit 1
function breakvpn() {
gw=`netstat -arn | grep "^default" | awk '{print $2}'`
while [[ "$#" -gt "0" ]]; do
sudo route delete $1
sudo route add $1 $gw
shift
done
}
PREFIX="/home/ubuntu/service_platform/packer-amazon-chroot-volumes/"
for ROOT in /proc/*/root; do
LINK=$(readlink $ROOT)
if [ "$LINK" != "/" ]; then
PID=$(basename $(dirname "$ROOT"))
sudo kill -9 "$PID"
fi
done
require "wordnet"
@lex = WordNet::Lexicon.new
def inflections(candidate)
ss = @lex.lookup_synsets(candidate, WordNet::Noun)
ss.collect { |syn|
(syn.hypernyms + syn.hyponyms).collect { |hw| hw.words }
}.flatten.collect { |word|
word.lemma.gsub(/[\s-]/, '_')
@mwhooker
mwhooker / wtf.py
Created August 22, 2013 06:17 — forked from anonymous/wtf.py
class A(object):
def hook(self, f):
atime = 0
def intime(*args):
print atime
atime += 1
return f(*args)
return intime
>>> f = A().hook(lambda b: b + 1)
2013-08-08T18:02:53.860583+00:00 tx-api001.banksimple.com coinscope info ? Starting kafka producer.
2013-08-08T18:02:53.871676+00:00 tx-api001.banksimple.com coinscope info ? Starting kafka producer.
2013-08-08T18:02:53.873062+00:00 tx-api001.banksimple.com coinscope info ? Starting kafka producer.
2013-08-08T18:02:54.103637+00:00 tx-api001.banksimple.com coinscope info 2181,exhibitor2.banksimple.com:2181,exhibitor3.banksimple.com:2181,exhibitor4.banksimple.com:2181,exhibitor5.banksimple.com:2181/kafka] ? Starting ZkClient event thread.
2013-08-08T18:02:54.106182+00:00 tx-api001.banksimple.com coinscope info ? Client environment:zookeeper.version=3.3.3-1073969, built on 02/23/2011 22:27 GMT
2013-08-08T18:02:54.108284+00:00 tx-api001.banksimple.com coinscope info ? Client environment:host.name=tx-api001
2013-08-08T18:02:54.109632+00:00 tx-api001.banksimple.com coinscope info ? Client environment:java.version=1.6.0_38
2013-08-08T18:02:54.109646+00:00 tx-api001.banksimple.com coinscope info ? Client envi
@mwhooker
mwhooker / B
Created July 9, 2013 16:39
matt's interview guide
1. screen by looking for open source work
2. have the person implement fizzbuzz
3. talk to them. are they nice?
4. have them learn something they're not familiar with (library, language), and then use it.

SERVICE NAME

Purpose

what's this service used for?

Dependencies

What other services does this use? Where do we look when things go south?

Recipes

link to relevant cookbooks.