Skip to content

Instantly share code, notes, and snippets.

View edwardgeorge's full-sized avatar
🇵🇸

Edward George edwardgeorge

🇵🇸
  • AP Møller — Mærsk
  • Manchester
  • 12:06 (UTC +01:00)
View GitHub Profile
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
module ReflectBark where
import Control.Applicative
import Data.Aeson
import Data.Proxy
import Data.Reflection
data Bark = Bark | Woof | Yelp | Yap deriving Show
@edwardgeorge
edwardgeorge / pipetest.py
Created April 5, 2013 22:34
demonstration of deadlock with eventlet.green.subprocess on python 2.7
import os
import sys
import tempfile
import eventlet
from eventlet.green import subprocess
sock = eventlet.listen(('127.0.0.1', 0))
port = sock.getsockname()[1]
@edwardgeorge
edwardgeorge / fuzzingclient.json
Last active December 15, 2015 19:19
wstest -m fuzzingclient -s fuzzingclient.json -d
{
"options": {"failByDrop": false},
"outdir": "./reports/servers",
"servers": [
{"agent": "MyAwesomeServer",
"url": "ws://localhost:7000",
"options": {"version": 18}}
],
@edwardgeorge
edwardgeorge / multiqueueconsumer.py
Created September 30, 2012 16:58
Consumer for blocking on multiple eventlet queues.
""" Consumer for blocking on multiple eventlet queues.
Ensures that you never take more items from the queues than just
the first item you receive, and only when explicitly waiting for
and item.
"""
import eventlet
from eventlet.event import Event
@edwardgeorge
edwardgeorge / eventlet_dead_runloop_bug2.py
Created August 11, 2012 12:07
similar bug found with dead eventlet runloop. a greenthread doesn't get its parent set to new hub greenlet unless switching back to the hub. If it dies before then it'll return execution to dead hub greenlet.
import eventlet
def dummyproc():
print 'dummyproc returning. but our parent is *old, dead* hub greenlet'
eventlet.sleep(0) # give hub a chance to run
g = eventlet.spawn(dummyproc)
print 'killing hub before spawned greenthread timer is run'
try:
@edwardgeorge
edwardgeorge / eventlet_dead_runloop_bug.py
Created August 11, 2012 09:46
demonstrates a subtle eventlet bug when killing greenthreads after the runloop dies but hasn't been restarted by a switch().
import eventlet
ev = eventlet.event.Event()
def dummyproc():
eventlet.hubs.get_hub().switch()
g = eventlet.spawn(dummyproc)
@edwardgeorge
edwardgeorge / setup.py
Created July 11, 2011 22:22
python libxml2 binding package for easy installation with pip/easy_install into a virtualenv
import os
import shutil
import subprocess
import sys
import tarfile
import urllib2
LIBXML2_PREFIX = "libxml2"
LIBXSLT_PREFIX = "libxslt"
LIBXML2_FTPURL = "ftp://xmlsoft.org/libxml2/"
@edwardgeorge
edwardgeorge / clonevirtualenv.py
Created March 8, 2011 19:17
A script for cloning a non-relocatable virtualenv.
"""virtualenv cloning script.
A script for cloning a non-relocatable virtualenv.
Virtualenv provides a way to make virtualenv's relocatable which could then be
copied as we wanted. However making a virtualenv relocatable this way breaks
the no-site-packages isolation of the virtualenv as well as other aspects that
come with relative paths and '/usr/bin/env' shebangs that may be undesirable.
Also, the .pth and .egg-link rewriting doesn't seem to work as intended. This
@edwardgeorge
edwardgeorge / jack.rb
Created November 8, 2010 12:59
Homebrew formula to install JackOSX binary package.
require 'formula'
class Jack <Formula
homepage 'http://jackaudio.org'
version '0.87'
if MACOS_VERSION < 10.6
url 'http://downloads.sourceforge.net/project/jackosx/JackOSX/0.87/JackOSX.0.87_32bits.zip'
md5 '431b35cab4b3928e66e8accb2a1dee80'
else
url 'http://downloads.sourceforge.net/project/jackosx/JackOSX/0.87/JackOSX.0.87_64-32bits.zip'
@edwardgeorge
edwardgeorge / gist:544112
Created August 22, 2010 18:34
fix for macfuse installation on snow leopard if you're encountering Input/Output errors.
--- /usr/local/lib/pkgconfig/fuse.pc
+++ /usr/local/lib/pkgconfig/fuse.pc
@@ -6,5 +6,5 @@
Name: fuse
Description: File System in User Space (MacFUSE)
Version: 2.7.3
-Libs: -L${libdir} -lfuse -pthread -liconv
+Libs: -L${libdir} -lfuse_ino64 -pthread -liconv
Cflags: -I${includedir}/fuse -D__FreeBSD__=10 -D_FILE_OFFSET_BITS=64