Skip to content

Instantly share code, notes, and snippets.

require "eventmachine"
# Load this script up with thin
class DeferrableBody
include EventMachine::Deferrable
def call(body)
body.each do |chunk|
@body_callback.call(chunk)
=begin
host_ip_info.rb (http://gist.github.com/169374)
Copyright (c) 2009 Jason L Perry
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
############################################################
# Default Networking Configuration File
#
# This file may contain default values for the networking system properties.
# These values are only used when the system properties are not specified
# on the command line or set programatically.
# For now, only the various proxy settings can be configured here.
############################################################
# Whether or not the DefaultProxySelector will default to System Proxy
#!/usr/bin/env ruby
#
# A hook script to verify that only syntactically valid ruby code is commited.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# Put this code into a file called "pre-commit" inside your .git/hooks
# directory, and make sure it is executable ("chmod +x .git/hooks/pre-commit")
#
@pope
pope / .bashrc
Created July 8, 2009 19:17 — forked from defunkt/.bashrc
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital and @grundprinzip for curl-fu)
function tweet {
curl -n -d status="$*" https://twitter.com/statuses/update.xml --insecure &> /dev/null
echo "tweet'd"
@pope
pope / .bashrc
Created July 8, 2009 19:16 — forked from defunkt/.bashrc
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital and @grundprinzip for curl-fu)
function tweet {
curl -n -d status="$*" https://twitter.com/statuses/update.xml --insecure &> /dev/null
echo "tweet'd"
def reverse_bit_iterator(val):
while val > 0:
yield val & 0xff
val = val >> 0x8
print reduce(lambda x,y: y+x, map(chr, reverse_bit_iterator(long(__file__[:-3]))), "!")
require 'time'
class PeriodicExecutor
attr_reader :next_time_to_run
def initialize(secs, &block)
@secs = secs
@block = block
@next_time_to_run = Time.now.to_f
import time
import bisect
class PeriodicExecutor(object):#{{{
def __init__(self, secs, callable):
self.callable = callable
self.secs = secs
self.next_time_to_run = time.time()
(mp) C:\Documents and Settings\pope\My Documents\mp\src\mp>python bin\mp
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python26\Lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "C:\Python26\Lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named mpTraceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python26\Lib\multiprocessing\forking.py", line 341, in main