Skip to content

Instantly share code, notes, and snippets.

meejah meejah

Block or report user

Report or block meejah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:d6f9fba8c080c35cba6f
from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
d0 = Deferred()
d1 = Deferred()
d2 = Deferred()
def check_value(arg, gold):
print "check_value", arg, gold
assert gold == arg
meejah / gist:d27e9059e9cb54f1d00a
Created Oct 20, 2015
twisted: mixed @inlineCallbacks + Deferred
View gist:d27e9059e9cb54f1d00a
from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
d0 = Deferred()
d1 = Deferred()
d2 = Deferred()
def foo(arg):
print 'foo', arg
meejah / README
Created Mar 25, 2015
sub (sub) process coverage
nothing, trying to make bare repo.
meejah /
Last active Aug 29, 2015
Isn't there a nice way to write tests for asyncio-based code?
from __future__ import print_function
import asyncio
import asyncio.test_utils
import unittest
class Other(object):
def __init__(self):
self.future = asyncio.Future()
meejah /
Created Oct 22, 2014
Attempt at a Twitter-sized RC4 implementation
# attempt to make a tweet-sized RC4
# this is 241 characters... :/
# return value comes in "z" which must be an empty array to start
def R(k,C,z):
def s(A,x,y):A[x],A[y]=A[y],A[x]
for i in r(x):j=(j+S[i]+o(k[i%l(k)]))%x;s(S,i,j)

Keybase proof

I hereby claim:

  • I am meejah on github.
  • I am meejah ( on keybase.
  • I have a public key whose fingerprint is 9D5A 2BD5 688E CB88 9DEB CD3F C260 2803 1280 69A7

To claim this, I am signing this object:

meejah /
Created Apr 3, 2014
"tail -f" style file-reading in Twisted
#!/usr/bin/env python
import sys
from twisted.internet.interfaces import IReadDescriptor
from twisted.internet.fdesc import setNonBlocking
from twisted.internet import reactor
from zope.interface import implementer
class Blam(object):
meejah /
Created Sep 3, 2013
a temporary directory like tempfile.NamedTemporaryFile
class TempDir(object):
def __enter__(self, *args):
self.dir_name = tempfile.mkdtemp()
return self
def __exit__(self, *args):
def __str__(self):
return self.dir_name
meejah /
Created Jun 3, 2013
Create a SVN repository that has @nnn branches when using "git svn clone"
## create @nnn branches by simulating a re-organization on the server
mkdir /tmp/svnplay
pushd /tmp/svnplay
svnadmin create svnrepo
mkdir svninit
mkdir svninit/foo
#!/usr/bin/env python
## this will set up a VDE switch which has a tap interface (tap_tor)
## which is also set up by this script. This tap interface has all its
## data pushed out through tor (or dropped, if it's UDP and not port
## 53) via some iptables rules. probably you need to run this as
## root. when the VM shuts down, the processes started here are killed
## as well.
You can’t perform that action at this time.