This file contains 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
# FIXME This is a **terrible** hack. This logic should really be | |
# in the model. It's very difficult to put it there because we | |
# can only perform index updates here, in the API layer, because | |
# of the way we mix sync/async code. You should be shaking your | |
# head in disgust the entire time you read this code and be | |
# thinking, "What kind of fucking muppet would even think this is | |
# a good idea?! ZOMG!!" |
This file contains 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 User(object): | |
'''A class representing the User structure used by the twitter API. | |
The User structure exposes the following properties: | |
user.id | |
user.name | |
user.screen_name | |
user.location | |
user.description |
This file contains 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 collectURLs(tweets): | |
""" | |
Extract all mentioned URLs from a set of tweets. | |
@param tweets: A C{dict} of tweets, as returned by L{getHistoricalTweets}. | |
@return: A C{dict} with mentioned URL keys and values a time-sorted list | |
of tweet URLs. | |
""" | |
URLs = defaultdict(list) | |
for id, tweet in tweets.iteritems(): |
This file contains 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
from fom.session import Fluid | |
fdb = Fluid() | |
fdb.login('username', 'password') | |
fdb.values.put( | |
query='fluiddb/about = "unidentified monkey"', | |
values = { | |
'taxonomy/ncbi/Division': 'Primates', | |
'taxonomy/ncbi/Lineage': [ |
This file contains 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
#!/bin/sh | |
echo "IP address limit:" | |
curl -s http://twitter.com/account/rate_limit_status.json | python -c '\ | |
import sys, pprint, simplejson | |
d = simplejson.loads(sys.stdin.read()) | |
for k, v in d.items(): | |
print "\t%s: %s" % (k, v)' |
This file contains 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 random | |
>>> random.random() | |
0.029650172560125809 | |
>>> a = [] | |
>>> for _ in range(10): | |
... a.append(random.random()) | |
... | |
>>> a | |
[0.91210492275504895, 0.22509397965651112, 0.16240150096214034, 0.13481671367764725, 0.845419365903325, 0.28331432867986228, 0.37570713121626798, 0.75618618732045528, 0.16750228011314672, 0.19512649502603097] | |
>>> s = set(a) |
This file contains 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
;;; -*-Emacs-Lisp-*- | |
(defun ls-dir-to-list (dir dotfiles omit.&..) | |
"Return a list containing the file names found in directory DIR. | |
If DOTFILES is t, files that start with a period will be included | |
\(this implies \"ls -a\"\). If OMIT.&.. is also t, the special | |
directories \".\" and \"..\" will not be returned." | |
(interactive "P") | |
(save-excursion |
This file contains 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
#!/bin/sh | |
echo "IP address limit:" | |
curl -s http://twitter.com/account/rate_limit_status.json | python -c '\ | |
import sys, pprint, simplejson | |
d = simplejson.loads(sys.stdin.read()) | |
for k, v in d.items(): | |
print "\t%s: %s" % (k, v)' |
This file contains 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
Talk | |
A man develops a highly sohisticated way of communicating. | |
It's a language of arcane and inspired symbols, dedicated to the | |
art of being witty. It has exquisitely abstruse features. No one | |
can understand the man, but that doesn't perturb him. He goes | |
for long walks, and then sits in a scenic area of the park and tells | |
himself cunning, subtle, utterly brilliant little jokes at which he | |
chuckles and wipes his eyes and shakes his head, knocked out | |
by his own genius. |
This file contains 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
#nyc | |
#occupy |