This file contains hidden or 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
""" | |
Import hook extending pytz package with usable, generic timezones: | |
GMT-14 up to GMT+12. | |
Note that pytz already has Etc/GMT+X timezones, but | |
(quoting Wikipedia): | |
"In order to conform with the POSIX style, those zones beginning with "Etc/GMT" | |
have their sign reversed from what most people expect. In this style, | |
zones west of GMT have a positive sign and those east have a negative sign." |
This file contains hidden or 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
\def\reciperule{ | |
\vskip0.5em\hrule\vskip0.5em | |
} | |
\def\beginrecipe{ | |
\par | |
\begingroup | |
\leftskip=\baselineskip | |
\multiply\leftskip by 2 | |
\rightskip=\leftskip | |
\parindent=-\baselineskip |
This file contains hidden or 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
title Push Me / Pull Me | |
author Ian Millington | |
homepage idm.me.uk | |
key_repeat_interval 0.25 | |
======== | |
OBJECTS | |
======== |
This file contains hidden or 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
title Push Me / Pull Me | |
author Ian Millington | |
homepage agon.com | |
key_repeat_interval 0.25 | |
======== | |
OBJECTS | |
======== | |
Background1 |
This file contains hidden or 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
import collections | |
import re | |
import math | |
class NaiveBayesClassifier: | |
""" | |
A simple naive bayes classifier that can classify any items into | |
any number of categories based on training data. The core | |
algorithms in this class are generic, but `split_into_features` is | |
specific for analysing words in a message, and the data functions |
This file contains hidden or 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
def sep(text_list, mid_sep=', ', last_sep=' and '): | |
""" | |
Separates a list of strings or unicode with the given separator, | |
adding a different separator at the end. | |
This allows the simple generation of strings such as: | |
"A, B, C and D" | |
>>> sep([]) |
This file contains hidden or 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
/** | |
* Generates a new UUID and passes it to the given callback function. | |
* | |
* Uses the a command-line uuid generator. Caches UUIDs to avoid | |
* unneccessary spawning of new processes. | |
* | |
* You can easily adjust the script used to create the UUID. By | |
* default I am using the OSSP uuid program, which is available in | |
* most linux distro's package managers (e.g. `sudo apt-get install | |
* uuid` on ubuntu). |