Skip to content

Instantly share code, notes, and snippets.

View aparrish's full-sized avatar

Allison Parrish aparrish

View GitHub Profile
@aparrish
aparrish / draw_average_word.py
Created April 7, 2011 12:21
drawing the average N-letter word using processing.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 / simpleca.py
Created April 13, 2011 14:18
simple cellular automata + text in processing.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
isobel:~ adam$ perl -le 'for $c ('a'..'z') { $_ = "everything"; s/[aeiou]/$c/g; print }'
avarythang
bvbrythbng
cvcrythcng
dvdrythdng
everytheng
fvfrythfng
gvgrythgng
hvhrythhng
ivirything
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
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
@aparrish
aparrish / everything nick montfort can do
Created April 20, 2011 02:10
(I cheated: you need sowpods.txt for this.)
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
isobel:~ adam$ echo everything | perl -le 'print $_ x (ord($_) - ord('a')+1) for split //, <>'
eeeee
vvvvvvvvvvvvvvvvvvvvvv
eeeee
rrrrrrrrrrrrrrrrrr
yyyyyyyyyyyyyyyyyyyyyyyyy
tttttttttttttttttttt
hhhhhhhh
iiiiiiiii
nnnnnnnnnnnnnn
isobel:~ adam$ perl -le 'print join "", reverse sort split //, "everything"' | perl -le 'print $_ x (ord($_) - ord('a')+1) for split //, <>'
yyyyyyyyyyyyyyyyyyyyyyyyy
vvvvvvvvvvvvvvvvvvvvvv
tttttttttttttttttttt
rrrrrrrrrrrrrrrrrr
nnnnnnnnnnnnnn
iiiiiiiii
hhhhhhhh
ggggggg
eeeee
isobel:~ adam$ perl -le '$x=shift@ARGV;{print substr($x,$i%length $x).substr($x,0,$i%length $x);$i++;redo}' everything |head -25
everything
verythinge
erythingev
rythingeve
ythingever
thingevery
hingeveryt
ingeveryth
ngeverythi
isobel:~ adam$ perl -le 'for(split//,shift@ARGV){$r++;read(STDIN,$c,1);if($c=~/$_/i){print "$c (read $r bytes)";$r=0;next}redo}' everything </dev/urandom
E (read 70 bytes)
v (read 388 bytes)
E (read 15 bytes)
r (read 166 bytes)
y (read 186 bytes)
T (read 180 bytes)
H (read 130 bytes)
I (read 21 bytes)
n (read 56 bytes)