Skip to content

Instantly share code, notes, and snippets.

@jhalcrow
jhalcrow / keybase.md
Created September 10, 2019 08:54
keybase.md

Keybase proof

I hereby claim:

  • I am jhalcrow on github.
  • I am pejoculant (https://keybase.io/pejoculant) on keybase.
  • I have a public key ASBaWqVZolipnSF7U5fSeBrVj2RCOrhAldWWPJm14dANdQo

To claim this, I am signing this object:

@jhalcrow
jhalcrow / keybase.md
Created September 10, 2019 08:53
Keybase

Keybase proof

I hereby claim:

  • I am jhalcrow on github.
  • I am pejoculant (https://keybase.io/pejoculant) on keybase.
  • I have a public key ASBaWqVZolipnSF7U5fSeBrVj2RCOrhAldWWPJm14dANdQo

To claim this, I am signing this object:

@jhalcrow
jhalcrow / gist:2165629
Created March 22, 2012 23:58
Gevent server-client livelock
import gevent.monkey; gevent.monkey.patch_all()
import gevent.server
from BaseHTTPServer import BaseHTTPRequestHandler
import urllib2
class DummyHTTPServer(gevent.server.StreamServer):
def handle(self, sock, addr):
handler = DummyHTTPHandler(sock, addr, self)
try:
handler.setup()
@jhalcrow
jhalcrow / ipython_config.py
Created October 10, 2011 16:55
virtualenv & ipython
def virtualenv():
import site
from os import environ
from os.path import join
from sys import version_info
if 'VIRTUAL_ENV' in environ:
virtual_env = join(environ.get('VIRTUAL_ENV'),
'lib',
'python%d.%d' % version_info[:2],
@jhalcrow
jhalcrow / test_serial.py
Created April 2, 2011 14:23
Benchmark of different serialization methods in Python, adapted from a J2 Labs Tumblr post
# Adapted from http://j2labs.tumblr.com/post/4262756632/speed-tests-for-json-and-cpickle-in-python
import time
import cPickle as pickle
import simplejson
import json
import cjson
import jsonlib
import ujson