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
''' | |
redis_search.py | |
Written by Josiah Carlson July 3, 2010 | |
Released into the public domain. | |
This module implements a simple TF/IDF indexing and search algorithm using | |
Redis as a datastore server. The particular algorithm implemented uses the |
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
''' | |
Copyright 2010 Josiah Carlson | |
Released into the public domain | |
copy_redis.py | |
A convenient utility function for copying data from one redis server to | |
another. | |
Requires http://github.com/andymccurdy/redis-py . |
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
''' | |
Copyright 2010 Josiah Carlson | |
Released into the public domain | |
alternate_tile.py | |
This will generate the integer-grid tiles of a provided polygon, similar in | |
fashion to Polygon.Util.tile(), though this uses a BSP-like algorithm to | |
partition the space for faster overall execution on large polygons with many | |
tiles. |
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
''' | |
simple_svn2git.py | |
Written November 2010 by Josiah Carlson, released into the public domain. | |
This script was used to convert PyPE's svn repository on sourceforge to git. | |
Setup included checking out/cloning the two repos: | |
svn co https://pype.svn.sourceforge.net/svnroot/pype pype |
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
# Josiah Carlson - Programming Challange from Erann Gat: | |
# http://www.flownet.com/ron/papers/lisp-java/ | |
# Given a list of words and a list of phone numbers, find all the ways that | |
# each phone number can be expressed as a list of words. | |
from collections import defaultdict | |
import sys | |
MAPPING = {'e':0, 'j':1, 'n':1, 'q':1, 'r':2, 'w':2, 'x':2, 'd':3, 's':3, | |
'y':3, 'f':4, 't':4, 'a':5, 'm':5, 'c':6, 'i':6, 'v':6, 'b':7, 'k':7, |
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
''' | |
Implementation of Poly1305-AES as described by Daniel J. Bernstein in | |
documents linked from: http://cr.yp.to/mac.html | |
Implemented by Josiah Carlson <[email protected]> on 2011-01-23, | |
released into the public domain. | |
Note: this implementation of Poly1305-AES uses Python's built-in long integer | |
implementation, so is not terribly performant, and likely suffers from a | |
side-channel attack related to the timing of bigint modulo. It also uses |
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
''' | |
This is an implementation of the Recursive Division algorithm for maze | |
generation, primarily derived from the algorithm presented here: | |
http://weblog.jamisbuck.org/2011/1/12/maze-generation-recursive-division-algorithm | |
The input grid can be generated via: | |
grid = [width*[0] for i in xrange(height)] | |
The initial call should be of the form: | |
divide(grid, 0, 0, width, height) |
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
''' | |
streaming_api.py | |
Written May 17-20, 2011 by Josiah Carlson | |
Released under the GNU GPL v2 | |
available: http://www.gnu.org/licenses/gpl-2.0.html | |
Other licenses may be available upon request. | |
Given a Redis server and a task queue implementation, this code implements the |
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
''' | |
redis_simple_chat.py | |
Written June 24, 2011 by Josiah Carlson | |
Released under the GNU GPL v2 | |
available: http://www.gnu.org/licenses/gpl-2.0.html | |
Other licenses may be available upon request. |
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
PS1="\[\e[34;1m\]\[\033[01;34m\]\u@\h\[\033[00m\]\[\e[0m\] \w:\[\e[35;1m\]\`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\\\\\*\ \(.+\)$/\(\\\\\\\\\1\)\/\`\[\033[0m\]$\[\033[0m\] " |
OlderNewer