Skip to content

Instantly share code, notes, and snippets.

# tweet_correlation.py - Calculate the correlation of two users' tweet clouds,
# based on data from http://tweetstats.com. You need to have visited this site
# before using the app, as this app relies on the cached data made when you
# first use the service.
#
# This module also exports functionality for retrieving and manipulating a
# cached tweet cloud.
##############################################################################
# Copyright (c) 2008 Zachary Voase
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# phopass.py - Generate phonemic passwords.
#
##### LICENSE ################################################################
# Copyright (c) 2008 Zachary Voase
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
try:
import cPickle as pickle
except ImportError:
import pickle
from couchdb import client
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
class SessionStore(SessionBase):
import random
import re
import unicodedata
def slugify(string, randlen=10):
string_out = ''
for char in string:
if char.isspace():
string_out += '-'
@zvoase
zvoase / pyunlink.sh
Created November 2, 2008 04:21
pyunlink.sh - remove a pylinked file from your site-packages directory.
@zvoase
zvoase / pylink.sh
Created November 2, 2008 04:12
pylink - Link and unlink Python modules to your site packages directory.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2008 Zachary Voase
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
import copy
class Base(object):
def __init__(self, words, name=''):
self.__words = words
if not name:
name = 'base%d' % (self.length,)
self.name = name
def number_to_string(number, words):
list_out = []
if not number:
return words[0] # Because 0 is '0', not ''.
while number:
list_out = [number % len(words)] + list_out
number = number // len(words)
return ''.join(words[n] for n in list_out)
def number_to_zpadded_string(number, length=32):
@zvoase
zvoase / fproc.py
Created October 27, 2008 22:22
Do interesting things with files.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# fproc: Do interesting things with files.
# Copyright (c) 2008 Zachary Voase
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,