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
| class bcolors: | |
| HEADER = '\033[95m' | |
| OKBLUE = '\033[94m' | |
| OKGREEN = '\033[92m' | |
| WARNING = '\033[93m' | |
| FAIL = '\033[91m' | |
| ENDC = '\033[0m' | |
| def disable(self): | |
| self.HEADER = '' |
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
| $ export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" | |
| $ sudo easy_install setuptools | |
| $ wget http://pypi.python.org/packages/source/p/pip/pip-0.6.3.tar.gz | |
| $ tar xzf pip-0.6.3.tar.gz | |
| $ cd pip-0.6.3 | |
| $ sudo python setup.py install | |
| $ sudo pip install virtualenv virtualenvwrapper |
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
| <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> | |
| <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png"> | |
| <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png"> |
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
| RAM Disk Bandwidth | |
| cost per month (USD) $20.00 $2.00 $10.00 | |
| amount per month (MB) 360MB 2048MB 102,400MB | |
| $/GB $56.89 $1.00 $0.10 | |
| Ratio ~57x 10x |
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
| alias hglog="hg log --template '\033[31m{rev}\033[0m \033[32m{date|age}\033[0m \033[33m{author|person}\033[0m \033[30;1m{desc}\033[0m\n' | less -R" |
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
| hg diff | \ | |
| sed -e 's/^--- .*/'`echo -e "\033[0;46m"`'&'`echo -e "\033[0m"`'/' | \ | |
| sed -e 's/^+++ .*/'`echo -e "\033[0;46m"`'&'`echo -e "\033[0m"`'/' | \ | |
| sed -e 's/^-.*/'`echo -e "\033[0;41m"`'&'`echo -e "\033[0m"`'/' | \ | |
| sed -e 's/^+.*/'`echo -e "\033[0;42m"`'&'`echo -e "\033[0m"`'/' | \ | |
| less -R |
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 threading, Queue, time, random | |
| WORKERS = 4 | |
| JOB_COUNT = 100 | |
| class Worker(threading.Thread): | |
| def __init__(self, queue): | |
| self.__queue = queue | |
| threading.Thread.__init__(self) | |
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 zmq | |
| from multiprocessing import Process | |
| def worker(wrk_num): | |
| print "Getting ready to work", wrk_num | |
| context = zmq.Context() | |
| work_receiver = context.socket(zmq.PULL) # Channel to receive work | |
| work_receiver.connect("tcp://127.0.0.1:5557") |
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 zmq | |
| from multiprocessing import Process | |
| def ventilator(): | |
| context = zmq.Context() | |
| ventilator_send = context.socket(zmq.PUSH) # Set up a channel to send work | |
| ventilator_send.bind("tcp://127.0.0.1:5557") | |
| for num in range(10000): |
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 'twitter' | |
| Twitter::Search.new.geocode(39.037, -94.5874, '5mi').fetch().results | |
| #=> all tweets within 5 miles of lat/lon | |
| Twitter::Search.geocode(39.037, -94.5874, '5mi').fetch().results.first | |
| #=> most recent tweet within 5 miles of lat/lon | |
| Twitter::Search.new('dinner').geocode(39.037, -94.5874, '5mi').fetch().results | |
| #=> all tweets containing the word 'dinner' within 5 miles of lat/lon |
OlderNewer