Skip to content

Instantly share code, notes, and snippets.

Allison Parrish aparrish

Block or report user

Report or block aparrish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aparrish
aparrish / twitter_search.py
Created Apr 3, 2011
simple twitter search api client
View twitter_search.py
import json
import urllib
import time
def search_twitter(query, callback, maxpages=10):
resp = urllib.urlopen('http://search.twitter.com/search.json%s' % query)
data = json.loads(resp.read())
for item in data['results']:
callback(item)
if 'next_page' in data and maxpages > 1:
@aparrish
aparrish / poem.py
Created Apr 3, 2011
generate simple poem from twitter search results
View poem.py
from twitter_search import search_twitter
import random
import sys
import re
class Thingy(object):
def __init__(self, words):
self.words = words
self.begins = dict([(word, []) for word in words])
self.ends = dict([(word, []) for word in words])
@aparrish
aparrish / draw_average_word.py
Created Apr 7, 2011
drawing the average N-letter word using processing.py
View draw_average_word.py
import array
wordlen = 8
charwidth = 32
charheight = 64
def fillbuf(pg, font, word, buffer):
pg.beginDraw()
pg.background(0)
pg.fill(255)
@aparrish
aparrish / tip_poetics.py
Created Apr 11, 2011
simple poetry mashups with the foursquare venues api
View tip_poetics.py
import urllib
import sys
import time
import json
import random
import re
# to get your own client id/client secret, go here:
# https://foursquare.com/oauth/
foursq_client_id = sys.argv[1]
@aparrish
aparrish / simpleca.py
Created Apr 13, 2011
simple cellular automata + text in processing.py
View simpleca.py
# requires processing.py: https://github.com/jdf/processing.py
#
# you'll need pcsenior.ttf (from here: http://www.zone38.net/font/) in a data/ directory
# (though you can also use any font you'd like)
from random import randrange
class Cell(object):
def __init__(self, status):
self.current = status
View everything twitter
isobel:~ adam$ curl -s "https://search.twitter.com/search.json?q=everything&rpp=100" | python -mjson.tool | perl -nle 'print join " ", (split / /, $1)[0..5] if /"text":.*(everything [a-zA-Z ]+)",/i'
EVERYTHING RIGHT NOW OMG
EVERYTHING done by Hank G
everything new york
everything through crist who gives me
everything better
everything is
everything hard af he be looking
everything will happen in the last
everything in my power not to
View you get the everything idea
isobel:~ adam$ python -c 'import itertools, sys; [sys.stdout.write("e" + "".join(i) + "g\n") for i in itertools.permutations("everything"[1:-1])]' | head -50
everything
everythnig
everytihng
everytinhg
everytnhig
everytnihg
everyhting
everyhtnig
everyhitng
View sometimes yvyrythyng
isobel:~ adam$ perl -le 'for $c ('a'..'z') { $_ = "everything"; s/[aeiou]/$c/g; print }'
avarythang
bvbrythbng
cvcrythcng
dvdrythdng
everytheng
fvfrythfng
gvgrythgng
hvhrythhng
ivirything
@aparrish
aparrish / everything nick montfort can do
Created Apr 20, 2011
(I cheated: you need sowpods.txt for this.)
View everything nick montfort can do
isobel:~ adam$ perl -nle 'chomp;push@w,$_ if"everything"=~/$_/;END{{print join" ",map{$w[rand @w]}0..rand(4);print""if++$i%3==0;redo}}' <~/Documents/Code/sowpods.txt |head -40
thin hi thing thin
every eve
thin very eve hing
eve every
eve hi hin
everything thin hin
er everything
View everything data visualization
isobel:~ adam$ echo everything | perl -le 'print $_ x (ord($_) - ord('a')+1) for split //, <>'
eeeee
vvvvvvvvvvvvvvvvvvvvvv
eeeee
rrrrrrrrrrrrrrrrrr
yyyyyyyyyyyyyyyyyyyyyyyyy
tttttttttttttttttttt
hhhhhhhh
iiiiiiiii
nnnnnnnnnnnnnn
You can’t perform that action at this time.