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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Functional Geometry | |
Original idea by Peter Henderson, see | |
http://www.ecs.soton.ac.uk/~ph/funcgeo.pdf and | |
http://www.ecs.soton.ac.uk/~ph/papers/funcgeo2.pdf |
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
# Unescape HTML Entities | |
# | |
# October 28, 2006 | Fredrik Lundh | |
# | |
# This function converts HTML entities and character references to | |
# ordinary characters. | |
# | |
# From: http://effbot.org/zone/re-sub.htm#unescape-html | |
import re, htmlentitydefs |
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
"""Creates a poster of Esquire magazine covers for a given decade. | |
The covers for a given decade can be downloaded with something like | |
the following curl command: | |
curl -O http://www.esquire.com/cm/esquire/cover-images/196[0-9]_[1-12].jpg | |
""" | |
import os, sys | |
import Image |
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
[4/9/10 3:00:20 PM] Will McCutchen: Hollow | |
[4/9/10 3:00:43 PM] frend29: hallo | |
[4/9/10 3:00:55 PM] Will McCutchen: Halo! | |
[4/9/10 3:01:08 PM] frend29: hi | |
[4/9/10 3:01:33 PM] Will McCutchen: Hillo there! | |
[4/9/10 3:02:04 PM] frend29: who r u | |
[4/9/10 3:02:26 PM] Will McCutchen: Me am Will. You am who? | |
[4/9/10 3:03:06 PM] frend29: i am smeth | |
[4/9/10 3:03:36 PM] Will McCutchen: What kind of name is that? | |
[4/9/10 3:04:18 PM] frend29: somouni jalal |
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
from string import lowercase, uppercase | |
from pyparsing import (Word, Literal, ZeroOrMore, Regex, Or, CharsNotIn, | |
Optional, CaselessLiteral, Combine, Suppress, | |
srange, alphas, alphanums, nums) | |
def Literals(s, splitchar=None): | |
"""Splits the given string (defaults to splitting on spaces), turns each | |
item into a Literal, and combines them into an Or clause.""" | |
return Or(map(Literal, s.split(splitchar))) |
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
map:help.asciiArtToMap([ | |
// Hey, wait! This is an ascii art of the map? Yes! "asciiArtToMap" convers an array of string in an array of arrays, using... | |
"||T----------------------------------------------------TxxT----------------------------------------------------T||", | |
"|||| ||xx|| ||||", | |
"|||| . . . . . . . . . . . . ||xx|| . . . . . . . . . . . . ||||", | |
"|||| ||xx|| ||||", | |
"|||| . T------------T . T----------------T . ||xx|| . T----------------T . T------------T . ||||", | |
"|||| ||xxxxxxxxxx|| ||xxxxxxxxxxxxxx|| ||xx|| ||xxxxxxxxxxxxxx|| ||xxxxxxxxxx|| ||||", | |
"|||| o ||xxxxxxxxxx|| . ||xxxxxxxxxxxxxx|| . ||xx|| . ||xxxxxxxxxxxxxx|| . ||xxxxxxxxxx|| o ||||", | |
"|||| |
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
cd /home/webapps/kidjango/current | |
export PYTHONPATH=`pwd`:$PYTHONPATH | |
django-admin.py shell --settings=key.settings_ki |
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
# GAE_ENV=production ./manage.py remoteshell, then... | |
key-ingredient> from ki.webapp.gaetest import fixtures | |
key-ingredient> from help import models | |
key-ingredient> fixtures.load_fixtures('help/fixtures/faqs.json', [models]) |
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
from __future__ import with_statement | |
import functools | |
import os | |
import sys | |
from fabric.api import * | |
from google.appengine.api import appinfo |
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
# Answering this question: | |
# http://stackoverflow.com/questions/3679306/ | |
>>> import json | |
>>> class Foo(object): | |
... def __init__(self, a, b): | |
... self.a = a | |
... self.b = b | |
... | |
>>> foo = Foo('a string', ['a', 'list', 'of', 'strings']) |
OlderNewer