November 19, 2012

Hide Amazon's list price to prevent impulsive shopping

Would you prefer

to this?


Note the missing list price and savings. If you want the only factor in your buying decisions to be the actual price of the item, install this stylish extension.

Edit:

Use in conjunction with an extension like Priceblink to know the true value of an item, by comparing with multiple vendors.

November 18, 2012

Cheat at Letterpress

# sorry, letterpress
#
# if your puzzle has the letters "wrdgplcbnzfkmrtwwtoxusicx",
# and you want a word with the characters "rosting" in it,
# but not letters "cl", you do:
# python letterpress.py wrdgplcbnzfkmrtwwtoxusicx rosting cl
import os
import sys
words = open('/usr/share/dict/words').read().split()
words = [w.lower() for w in words if len(w) > 2]
puzzle = sys.argv[1]
if len(puzzle) != 25:
sys.exit('puzzle must contain 25 characters')
letters = ''.join(sorted(puzzle))
# all possible words
candidates = [word for word in words if all(word.count(c) <= letters.count(c) for c in word)]
# keep only those words that include mandatory characters
if len(sys.argv) > 2:
candidates = [word for word in candidates if all(sys.argv[2].count(c) <= word.count(c) for c in puzzle)]
# keep only those words that exclude blacklisted characters
if len(sys.argv) > 3:
candidates = [word for word in candidates if all(word.count(c) <= puzzle.count(c) - sys.argv[3].count(c) for c in sys.argv[3])]
# sort by length and print
print os.linesep.join(sorted(candidates, key = lambda x : len(x)))
view raw letterpress.py hosted with ❤ by GitHub