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 -*- | |
__author__ = 'Zachary Voase <disturbyte@gmail.com>' | |
__version__ = '0.1' | |
""" | |
faceoff.py - A fun (non-serious) module for playing games. | |
Example: |
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
# -*- coding: utf-8 -*- | |
""" | |
Example Usage | |
============= | |
The following commands can be run from the root directory of the Mercurial | |
repo. To run ``paver``, however, you'll need to do ``easy_install Paver``. | |
Most of the following commands accept other arguments; see ``command --help`` | |
for more information, or ``paver help`` for a list of all the valid commands. |
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
# -*- coding: utf-8 -*- | |
# pipes.py - Command-piping syntax for generators/coroutines in Python. | |
""" | |
pipes.py - Command-piping syntax for generators/coroutines in Python. | |
Example: | |
>>> from pipes import * | |
>>> chain1 = counter(5) | adder(2) |
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
# -*- coding: utf-8 -*- | |
from decimal import Decimal | |
import random | |
def montecarlo(choices): | |
""" | |
It's easier for me to explain this with an example. |
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
# -*- coding: utf-8 -*- | |
# Copyright (c) 2009 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 | |
# copies of the Software, and to permit persons to whom 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
# -*- coding: utf-8 -*- | |
""" | |
Example Usage | |
============= | |
>>> import datetime | |
>>> start = datetime.date(2009, 6, 21) | |
>>> g1 = daterange(start) |
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
# -*- coding: utf-8 -*- | |
# pyprowl.py - Post to Prowl (https://prowl.weks.net) from Python. | |
# | |
# Copyright (c) 2009 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 |
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
# -*- coding: utf-8 -*- | |
# Copyleft 2058 Zachary Voase | |
# Licensed under the WTFPL. Google it. | |
from functools import wraps | |
class call(object): | |
__slots__ = ('function', 'args', 'kwargs') |
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
# -*- coding: utf-8 -*- | |
# First stab at implementing graphs in Python. | |
# Horrifically undocumented. | |
import operator | |
import textwrap | |
class SimpleStruct(type): | |
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
# -*- coding: utf-8 -*- | |
""" | |
Usage: | |
from django.contrib import admin | |
class MyModelAdmin(admin.ModelAdmin): | |
list_display = ('trunc_name', 'value') | |