Skip to content

Instantly share code, notes, and snippets.

Avatar

Tristan Seligmann mithrandi

View GitHub Profile
View route53
#!/usr/bin/python
from os import environ
from socket import gethostname
from boto import connect_route53
from boto.route53.record import ResourceRecordSets
IF_NAME = 'ppp0'
AWS_ACCESS_KEY = '...'
AWS_SECRET_KEY = '...'
View gist:9659276
for thing in [thing1, thing2]:
yield blahblahblah(thing)
####
for thing in [
thing1, thing2, thing3, thing4, thing5]:
yield blahblahblah(thing)
####
View keybase.md

Keybase proof

I hereby claim:

  • I am mithrandi on github.
  • I am mithrandi (https://keybase.io/mithrandi) on keybase.
  • I have a public key whose fingerprint is DB24 E315 EDAA AC13 D646 7099 58C0 FB1C DE3B 7600

To claim this, I am signing this object:

@mithrandi
mithrandi / axiomatic
Created Mar 31, 2014
axiomatic smart launch script
View axiomatic
#!/bin/zsh
source /Users/mithrandi/Library/Python/2.7/bin/virtualenvwrapper_lazy.sh
workon Fusion
BRANCH=$(hg branch --repository $HOME/code/Fusion)
STORE="dev.axiom.$BRANCH"
if [[ ! -d $STORE ]] {
if [[ -e $STORE ]] {
echo "Found unexpected $STORE, exiting."
exit 1
}
@mithrandi
mithrandi / CVE-2014-0160.patch
Created Apr 10, 2014
Debian CVE-2014-0160 patch
View CVE-2014-0160.patch
From 96db9023b881d7cd9f379b0c154650d6c108e9a3 Mon Sep 17 00:00:00 2001
From: "Dr. Stephen Henson" <steve@openssl.org>
Date: Sun, 6 Apr 2014 00:51:06 +0100
Subject: [PATCH] Add heartbeat extension bounds check.
A missing bounds check in the handling of the TLS heartbeat extension
can be used to reveal up to 64k of memory to a connected client or
server.
Thanks for Neel Mehta of Google Security for discovering this bug and to
View gist:10970272
def _rangesOverlap(start1, end1, start2, end2):
"""
Check if [start1, end1) and [start2, end2) overlap.
@type start1: L{datetime.datetime}
@type end1: L{datetime.datetime}
@type start2: L{datetime.datetime}
View gist:11197809
mithrandi@elvandar:~> apt-file search -x '/usr/bin/python[0-9.]*$'
python-minimal: /usr/bin/python
python-minimal: /usr/bin/python2
python2.6-dbg: /usr/lib/debug/usr/bin/python2.6
python2.6-minimal: /usr/bin/python2.6
python2.7-dbg: /usr/lib/debug/usr/bin/python2.7
python2.7-minimal: /usr/bin/python2.7
python3-minimal: /usr/bin/python3
python3.2-minimal: /usr/bin/python3.2
python3.3-dbg: /usr/lib/debug/usr/bin/python3.3
View matchers.py
from testtools.matchers import Mismatch
class SuccessResultOf(object):
"""
Match if a Deferred has fired with a result.
"""
def __init__(self, resultMatcher=None):
self.resultMatcher = resultMatcher
View gist:11376644
suffixes = ('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB')
def saneDataSize(size):
index = int(floor(log(abs(size), 1024)))
index = min(index, len(suffixes) - 1)
index = max(index, 0)
factor = 1024 ** index
return '%0.3f %s' % (float(size) / factor, suffixes[index])
@mithrandi
mithrandi / lambdacircus.coffee
Created May 1, 2014
LambdaCircus CoffeeScript / JS comparison
View lambdacircus.coffee
class Quote extends Backbone.Model
voteUp: =>
d = $.post(@get('voteUp'), undefined, undefined, 'json')
d.done (data) =>
@voted = true
@set data
voteDown: =>
d = $.post(@get('voteDown'), undefined, undefined, 'json')
d.done (data) =>