Skip to content

Instantly share code, notes, and snippets.

View sergray's full-sized avatar

Sergey Panfilov sergray

View GitHub Profile
@sergray
sergray / remem.py
Created January 17, 2011 17:59
Extend arbitrary interactive unix command with readline features
import sys
import subprocess
import readline
import select
import os
class Popen(subprocess.Popen):
def _communicate(self, input):
read_set = []
@sergray
sergray / gist:649833
Created October 27, 2010 20:00
proposed antigravity
__doc__ = "Add fly function to namespace where module is imported"
class RealWorldLevitation(Exception):
pass
def expose(obj):
import inspect
frame = inspect.currentframe()
frame.f_back.f_back.f_globals[obj.__name__] = obj
return obj
@sergray
sergray / gist:649788
Created October 27, 2010 19:39
legacy antigravity
>>> import antigravity
>>> antigravity.start()
'http://xkcd.com/353/'
# the source of http://pypi.python.org/pypi/antigravity/0.1
# is plain and there is no any magic of Python
#!/usr/bin/env python
STRIP_URL = "http://xkcd.com/353/"