I hereby claim:
- I am wbbradley on github.
- I am wbbradley (https://keybase.io/wbbradley) on keybase.
- I have a public key whose fingerprint is 20EB AF79 C868 0EB9 8668 CD90 0293 5A06 877A 2379
To claim this, I am signing this object:
import uuid | |
from multiprocessing import Pool | |
def f(u): | |
print str(u) + ' is a uuid' | |
if __name__ == '__main__': | |
pool = Pool(processes=2) |
#! /usr/local/bin/python | |
import subprocess | |
def get_refs(): | |
refs = {} | |
proc = subprocess.Popen([ | |
'git', 'show-ref', '--heads', '--tags', '--dereference' | |
], stdout=subprocess.PIPE) | |
while True: |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env python | |
# | |
# Author: wbbradley | |
# Created: Originally written in Perl in 2010 | |
# Edited: Rewritten in Python in 2014 | |
# | |
# You'll need to have P4Merge installed. It's free, and | |
# you can find it here: | |
# http://lmgtfy.com/?q=P4Merge+Tool+Download | |
# |
import traceback | |
def log_stack(): | |
with open('/var/tmp/stacktraces.log', 'a') as f: | |
f.write("-" * 80 + "\n") | |
f.write("\n".join(repr(s) for s in traceback.extract_stack() | |
if s[0].find('virtualenv') == -1 | |
and s[0].find('System') == -1 | |
and s[2].find('wrapped') == -1 | |
and s[2].find('decorated_function') == -1 |
import time | |
class Timer(object): | |
def __init__(self, name): | |
self.name = name | |
def __enter__(self): | |
self.start = time.clock() | |
return self |
from flask import Flask | |
import subprocess | |
app = Flask(__name__) | |
def talkie(voice, text): | |
try: | |
output, error = subprocess.Popen( | |
["say", "-v", voice, text], stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE).communicate() |
#!/usr/bin/python | |
import os | |
import sys | |
import time | |
from datetime import datetime | |
from AppKit import NSWorkspace | |
# This will be a movie | |
process_filter = None | |
if len(sys.argv) >= 2: |
# 1) Add MasqueradeMiddleware to Django's middleware stack (see comment below for placement) | |
class MasqueradeMiddleware(object): | |
''' | |
Looks for a field in the active session specifying a user to masquerade as | |
and sets request.user to that user, storing the real user to the session. | |
This middleware is dependent on the existence of sessions, so it should be | |
deployed after ('inside') Django's session middleware. It should probably | |
be deployed after middleware like the TermsAndConditionsMiddleware which | |
implement one-time intercepts, so that masquerading superusers don't get |
Math.lerp = Math.lerp || function(a, p1, p2) { | |
return (p2 - p1) * a + p1; | |
}; | |
Math.alpha = Math.alpha || function(a, p1, p2) { | |
return (a - p1) / (p2 - p1); | |
}; | |
Math.clamp = Math.clamp || function(a, p1, p2) { | |
if (p2 > p1) { | |
if (a < p1) { | |
return p1; |