Skip to content

Instantly share code, notes, and snippets.

View mattrobenolt's full-sized avatar
🀠
πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”

Matt Robenolt mattrobenolt

🀠
πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”
View GitHub Profile
class Logger(type):
def __new__(cls, name, bases, crap):
print cls, name, bases, crap
class foo(dict):
__metaclass__ = Logger
@mattrobenolt
mattrobenolt / server.js
Created August 5, 2012 16:32
DNS server backed by Redis, and resolves EC2 instance names
var dns = require('native-dns');
var server = dns.createServer();
var client = require('redis').createClient();
var aws = require('aws-lib');
server.on('request', function(req, res){
var parts = req.question[0].name.split('.');
var tag = parts[0];
var authority = parts.slice(1).join('.');
@mattrobenolt
mattrobenolt / gist:3239561
Created August 2, 2012 18:41
yield from all the things
all = lambda x: x
def doit(things):
yield from all(things)
list(doit([]))
import ec2
ec2.credentials.ACCESS_KEY_ID = 'xxx'
ec2.credentials.SECRET_ACCESS_KEY = 'xxx'
print ec2.instances.all()
for i in ec2.instances.filter(state='running', name__like='^production'):
print i.state, i.tags['Name']
@mattrobenolt
mattrobenolt / gist:3156887
Created July 21, 2012 19:19
Python unpacking with **
class foo(object):
a = 'b!'
b = 'b!'
def keys(self):
return ['a', 'b']
def __getitem__(self, item):
return getattr(self, item)
# Data set is a large SQL dump. Most lines are around 1MB.
# When the chunk size is at a smaller (default) chunk size, CPU jumps ridiculously high.
# If the chunk size is even smaller, there is obviously more CPU consumed as a high rate.
# When setting the chunk size of 0.5MB or even 1MB, it is smoothed out to a realistic usage.
# The obvious bottleneck is around testing each chunk with "splitlines()"
import requests
res = requests.get('https://s3.amazonaws.com/littlesis/public-data/littlesis-data.sql', prefetch=False)
bytes_total = int(res.headers['content-length'])
from __future__ import with_statement
import factory
from functools import wraps
class override_strategy(object):
def __init__(self, strategy):
self.strategy = strategy
foo = map(lambda s: {
# lol my lambda's body is indented
s = s.upper()
print s
return s
}, ['does', 'the', 'lambda', 'implicitly', 'end', 'after', 'toplevel', 'returns?'])
# Location of main build file for require.js
JS_BUILD_FILE = kovu.build.js
# List of all drund apps for determining migrations
MIGRATE_APPS = \
account \
app.connections \
app.filebrowser \
app.reader \
app.tv \
#!/bin/bash
BRANCHES=( master kovu )
PACKAGES=( src activity proxy )
for branch in ${BRANCHES[@]}; do
for package in ${PACKAGES[@]}; do
BUILDS=( $(repoman show drund | grep drund-$package-$branch-r | sort -r) )
for build in ${BUILDS[@]:10}; do
repoman rm drund $build
done