Skip to content

Instantly share code, notes, and snippets.

library(ggplot2)
library(dplyr)
library(reshape2)
df=structure(list(Year = c(2013L, 2012L, 2011L, 2010L, 2009L, 2008L,
2007L, 2006L, 2005L, 2004L, 2003L, 2002L, 2001L, 2000L, 1999L,
1998L, 1997L),
City = structure(c(14L, 8L, 12L, 13L, 1L, 2L,
6L, 4L, 14L, 8L, 15L, 5L, 10L, 9L, 7L, 3L, 11L),
.Label = c("Boston", "Chicago", "Dallas", "Houston", "Kansas City", "Long Beach",
mstr = '123456789' #Enter string to translate here
wordNum <- read.delim("~/bin/memory/wordNum.txt",
colClasses=c("character","character"),header=F)
dict<-new.env()
buildDict=function(word,num){
dict[[num]]<- paste(word,dict[[num]],sep=" ")
}
foo=mapply(buildDict,wordNum$V1,wordNum$V2)
rec <- function(x, y) {
if (is.null(x)) return;
@dggoldst
dggoldst / find.py
Created January 19, 2012 16:23
Given a long number, generate mnemonics using the digit-sound system, per http://www.decisionsciencenews.com/2012/01/17/some-code-to-help-you-remember-numbers/
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
from cStringIO import StringIO
from sys import argv
import random
mstr = str(argv[1])
adict = {}
wl = open('wordNum.txt')
@dggoldst
dggoldst / w2num.py
Created January 19, 2012 15:55
Generate a number for every English word via the digit sound method. See http://www.decisionsciencenews.com/2012/01/17/some-code-to-help-you-remember-numbers/
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
fh = open('cmudict-0.4.scm', 'r')
adict = {}
wl = open('wordlist.txt')
line = wl.readline()
while line:
line = line.strip()