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
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 |
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
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 |
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
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) |
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
# usage: | |
# python page_graph.py https://graph.facebook.com/some/path?access_token=x | |
# ... where some/path is the thing you want to get from the graph api, and 'x' is a | |
# valid access token (such as can be obtained from http://developers.facebook.com/docs/reference/api/) | |
# redefine the 'tester' function to change what happens with each data item in the | |
# response | |
import json | |
import urllib | |
import time |
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 | |
import sys | |
def somewhere_around_n(lines, n, stddev): | |
idx = int(random.gauss(n, stddev)) | |
if idx < 0: idx = 0 | |
if idx > len(lines) - 1: idx = len(lines) - 1 | |
return lines[idx] | |
stddev = int(sys.argv[1]) |
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 | |
class Sketch(object): | |
def __init__(self): | |
self.words = [ | |
['then', 'later', 'and'], | |
['my', 'the', 'a', 'that'], | |
['minister', 'survey', 'drunk', 'lather', 'liver', 'doctor', 'grue', 'vice', 'devilry', 'shortcake'], | |
['confessed', 'drained', 'maintained', 'checked out', 'focused'], | |
['your', 'those', 'all', 'his', 'her', 'lifelessly.', 'as well.', 'here.', 'first.'], |
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
# usage: | |
# python replacer.py wordlist input_file output_file | |
import sys | |
import re | |
import random | |
words = dict() | |
allwords = set() | |
for line in open(sys.argv[1]): | |
line = line.strip() |
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
Para -> It all started when S . ManyContinueS . ConclusionS | |
ManyContinueS -> ContinueS . ManyContinueS | |
ManyContinueS -> ContinueS . ManyContinueS | |
ManyContinueS -> ContinueS . ManyContinueS | |
ManyContinueS -> ContinueS . ManyContinueS | |
ManyContinueS -> ContinueS . ManyContinueS | |
ManyContinueS -> ContinueS . ManyContinueS | |
ManyContinueS -> ContinueS . ManyContinueS | |
ManyContinueS -> ContinueS | |
S -> PersonPsg VPsg |
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 nltk | |
import sys | |
from nltk.corpus import brown | |
import random | |
import re | |
def only_tokens(paired_list): | |
return [x[0] for x in paired_list] | |
def clean(s): |
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 threading import Thread | |
import random | |
import time | |
def random_wait(max_seconds, callback): | |
seconds = random.randrange(max_seconds) | |
time.sleep(seconds) | |
callback(seconds) | |
class Sketch(object): |