Archive for August, 2008

IMDB checklist

Posted in Programming on August 19th, 2008 by Mat – Be the first to comment

I started this site so that all the things I’ve made are together in one place, separate from all the boring stuff and links to other sites on my other blag. Looking through some old posts, I’ve found several things I could repost here, but they’re not really worth the effort of copy & pasting.

However! I will instead mention my awesome facebook application IMDB checklist, which has been so successful it even has “fans”!

I made it because I plan on watching all the top 200 films at imdb. The app has a list of the top films (at the time I made it) and you tick a box for each one you’ve seen. It’s really simple and I want to improve it sometime as limiting it to one list of movies is kinda lame, but I haven’t gotten around to it yet. People seem to like it though – theres about 300 people who use it right now, all of whom are presumably in my “social network” since I haven’t added it to the directory thing (I’d have to make an icon for it first and I’m lazy)

I also made this one, which is much less appreciated (I’m the only one who uses it). It’s for the website 43 things, which is what inspired me to watch the movies in the first place.

Thing

Posted in Programming on August 19th, 2008 by Mat – Be the first to comment

I was bored so I made this little flash thing where you can make blobs that move around and then disappear! Hurray!

Flash drawing thing

Posted in Uncategorized on August 13th, 2008 by Mat – Be the first to comment

A while ago I made this in flash: drawing thing

I also attempted to make a version which could save, and used it to make an exquisite corpse thingy where you have to draw the next part of the story. However, it turned out to be insanely slow since it has to send the data for each pixel to a php script before it can save each image as a jpeg. I’m still quite proud of it though. You can see it here. I might experiment with it a bit more in the future and see if I can speed it up somehow.

Also of interest: Eat Poop U Cat is a fun game where you have to recreate the previous sentence in the chain as a picture, or vice versa, which produces some very strange pictures.

tie stick crown fox lumps over tie jazz fog

Posted in Programming on August 13th, 2008 by Mat – Be the first to comment

Someone on the xkcd fora invented the term “homonums” for words which are spelled differently but use the same buttons when you type them on a phone.

I’m learning python so I decided I’d write this overly long script to find all the homonums for a given sentence. To get it to work you may need to change the wordlist path on line 39 to a file containing a list of words.

from string import *
from sys import argv
import re

def printAll(l=[], s=""):
	'''printAll(l,s)
	Prints all combinations of a list of lists
	l = a list of lists of words
	s = words to put in front
	'''

	if l:

		newlist = l[1:] #chop off the first list

		for i in l[0]:  #printall the combinations for each value of the first list
			if s:
				printAll(newlist, s + " " + i)
			else:

				printAll(newlist, s + i)

	else:

		print(s)

def getMistxts(sentence):
	'''Find sentances that are typed with the same buttons on a phone.'''
	words = sentence.split()
	otherwords = [getHomonums(word) for word in words]
	printAll(otherwords)

def getHomonums(word):
	'''Find words that are typed with the same buttons on a phone. Returns a list of matches.'''
	matches = []
	if not word:
		return matches

	wordlist = open("/usr/share/dict/british-english")

	parts = {2:"[abc]", 3:"[def]", 4:"[ghi]", 5:"[jkl]", 6:"[mno]", 7:"[pqrs]", 8:"[tuv]", 9:"[wxyz]"} #the regex for each button
	buttons = {'a':2, 'b':2, 'c':2, \
	'd':3, 'e':3, 'f':3, \
	'g':4, 'h':4, 'i':4, \
	'j':5, 'k':5, 'l':5, \
	'm':6, 'n':6, 'o':6, \
	'p':7, 'q':7, 'r':7, 's':7, \
	't':8, 'u':8, 'v':8, \
	'w':9, 'x':9, 'y':9, 'z':9} #button each character is on

	word = [buttons[char] for char in lower(word)] #convert to a list of numbers

	#make the regular expression
	regex = ""
	for button in word:
		regex += parts[button]
	r = re.compile("^"+regex+"$")

	#find matches
	for line in wordlist:
		line = line.strip() #remove whitespace
		if r.match(line) != None:
			matches.append(line)
	return matches	

if len(argv) > 1:
	sentence = argv[1:]
	sentence = " ".join(sentence)
	print "sentence = "+sentence
	getMistxts(sentence)
else:
	print "Usage: predictive.py sentence"

Folder map

Posted in Programming on August 13th, 2008 by Mat – Be the first to comment

I made a little program for visualizing the sizes of folders, kinda like SpaceMonger, which is what I used to use. It’s helpful for figuring out what to delete when freeing up disk space.

You can choose the folder to show by entering it as the command line argument, otherwise it uses the current directory.

Here’s what it looks like when you run it on an external hard drive containing lots of legally obtained media:

Folder map screenshot

You can download the script here: foldermap (requires python and pygame)