Skip to content

Instantly share code, notes, and snippets.

View config.json
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 46.7%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
View gist:9495505
import email
def get_decoded_email_body(message_body):
""" Decode email body.
Detect character set if the header is not set.
We try to get text/plain, but if there is not one then fallback to text/html.
:param message_body: Raw 7-bit message body input e.g. from imaplib. Double encoded in quoted-printable and latin-1
#!/usr/bin/env python
Recipe for creating and updating security groups programmatically.
import collections
import boto
devdave /
Created Aug 23, 2013
romper/storm-starter for jython. Change to Idea is to allow for arbitrary topologies to be executed BUT I don't know if this will work in the cluster submission process via storm command.
import argparse
import sys
from importlib import import_module
from backtype.storm import Config, LocalCluster, StormSubmitter
#from tsync.examples.exclamation import get_topology_builder
def main(run_local=False):
parser = argparse.ArgumentParser(description="Generate a single jar for Storm")
devdave / gist:5892749
Last active Dec 19, 2015
Python uuid1 colisions with Ubuntu 12.04 LTS Python 2.7.3
View gist:5892749
from uuid import uuid1
from time import time
def main():
test = dict()
limit = 10 ** 10
while limit:
limit -= 1
x = {n:uuid1().hex for n in range(15)}
if len(set(x.values())) != len(x.keys()):
set -e
sudo apt-get install openjdk-7-jdk git-core curl -y # Ubuntu 12.04 meets no problem
mkdir -p ~/bin
curl > ~/bin/lein
chmod 755 ~/bin/lein
# Add ~/bin to your $PATH, it has been done if in Ubuntu 12.04
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
devdave / gist:5514362
Created May 3, 2013
Script to generate the ec2-authorize calls necessary to add dotCloud access to your EC2 instances.
View gist:5514362
requires the AWS ec2 command line tools are setup
run this from the base directory of the ec2-tools install directory
security groups provided by DotCloud
groups = """admin-282171928639, gateway-282171928639, lxc-282171928639
admin-557344332487, gateway-557344332487, lxc-557344332487
devdave / hw1.cpp
Created Mar 8, 2013
Eh, it's going to take a while to relearn c++
View hw1.cpp
* File: main.cpp
* Author: dward
* Created on March 8, 2013, 8:13 AM
#include <cstdlib>
#include <iostream>
devdave / app.js
Created Mar 7, 2013
Experimental utility for working in Qt WebKit
View app.js
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
var aArgs =, 1),
fToBind = this,
fNOP = function () {},