This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "eventmachine" | |
| # Load this script up with thin | |
| class DeferrableBody | |
| include EventMachine::Deferrable | |
| def call(body) | |
| body.each do |chunk| | |
| @body_callback.call(chunk) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################ | |
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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") | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # $ 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # $ 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]))), "!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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 |