Skip to content

Instantly share code, notes, and snippets.

View lucky's full-sized avatar
🇺🇦

Jared Harper lucky

🇺🇦
View GitHub Profile
$ sudo easy_install -U eventlet
Searching for eventlet
Reading http://pypi.python.org/simple/eventlet/
Reading http://wiki.secondlife.com/wiki/Eventlet
Reading http://eventlet.net
Best match: eventlet 0.9.5
Downloading http://pypi.python.org/packages/source/e/eventlet/eventlet-0.9.5.tar.gz#md5=5f4363a8103aa5d6b26c069ae134077b
Processing eventlet-0.9.5.tar.gz
Running eventlet-0.9.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-HMpHql/eventlet-0.9.5/egg-dist-tmp-csbnD_
error: SandboxViolation: chmod('/Users/jared/.python-eggs/greenlet-0.2-py2.6-macosx-10.6-universal.egg-tmp/tmppHzqf0.$extract', 493) {}
"""
Automatically add Google MX records to a domain using Slicehost DNS.
Requires::
PyActiveResource: http://superjared.com/projects/pyactiveresource/
Edit the zone_id below, add your api password and run. To find your zone_id,
go to the DNS tab of the SliceManager, click the 'edit' next to your
domain. The URL will have the id::
% Contrary to the BIF, this splits on a character, not a position
% split_binary(<<1,2,3,4,5>>, 3) returns {<<1,2>>, <<4,5>>}
split_binary(Bin, C) when is_integer(C) -> split_binary(<<>>, Bin, C).
split_binary(Bin, <<>>, _) -> {Bin, <<>>};
split_binary(Head, <<T, Tail/binary>>, C) ->
case T of
C -> {Head, Tail};
_ -> split_binary(<<Head/binary, T>>, Tail, C)
end.

HURR

I'm a burr!

>>> urlparse("beanstalk://localhost/somequeue", scheme='beanstalk')
ParseResult(scheme='beanstalk', netloc='', path='//localhost/somequeue', params='', query='', fragment='')
>>> urlparse("http://localhost/somequeue")
ParseResult(scheme='http', netloc='localhost', path='/somequeue', params='', query='', fragment='')
[extensions]
pager =
[pager]
pager = LESS='FSRX' less
puts "HURR"
puts DATA.read
puts "wat"
__END__
Hi there!
$ ruby foo.rb
HURR
Hi there!
wat
# Why did I ever write this?
require 'rubygems'
require 'eventmachine'
module MyClient
def receive_data data
puts "Got back: #{data}"
end
def get_logger(name, level=logging.DEBUG):
logging.basicConfig(level=level)
return logging.getLogger(name)