Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
from Tkinter import *
from random import shuffle
things = [
'Make some tea',
'Do some pushups',
'Do some situps',
'Go to the bathroom',
@quandyfactory
quandyfactory / Red Fedora
Created November 2, 2012 15:30
A very cheesy parody of Red Barchetta.
My uncle has a country place
That no one knows about
It used to be a server farm
Before the Data Law
And on Sundays I elude the Eyes
And hop the Turbine Freight
To Far outside the Lockdown Web
Where my white-haired uncle waits
data = """-0.0118|ct5370001_01|Ward: 6, CT: 5370001.01, Area: 5.5, Density: 385, 2006: 2143, 2011: 2118, Change: -1.18%|-79.829957 43.206309,-79.829124 43.206103,-79.828842 43.206028,-79.827789 43.205756,-79.827715 43.205737,-79.826527 43.205437,-79.826062 43.205315,-79.825339 43.205133,-79.825204 43.205099,-79.824347 43.204883,-79.824168 43.204836,-79.824028 43.204799,-79.823036 43.204546,-79.822693 43.204461,-79.822129 43.204320,-79.821639 43.204198,-79.821162 43.204076,-79.820934 43.204016,-79.820890 43.204005,-79.820857 43.203997,-79.820787 43.203970,-79.820714 43.203947,-79.820638 43.203927,-79.820562 43.203912,-79.820484 43.203901,-79.820404 43.203893,-79.820325 43.203889,-79.820245 43.203891,-79.820166 43.203895,-79.820087 43.203904,-79.819918 43.203935,-79.819737 43.203935,-79.819616 43.203772,-79.819557 43.203663,-79.819462 43.203473,-79.819428 43.203347,-79.819394 43.203184,-79.819360 43.203031,-79.819388 43.202860,-79.819415 43.202716,-79.819455 43.202573,-79.819507 43.202429,-79.819586 43.202151,-
@quandyfactory
quandyfactory / calc.py
Created February 1, 2012 12:16
A silly little script that evaluates command line mathematical expressions.
#!/usr/bin/env python
"""A silly little script that evaluates command line mathematical expressions."""
from __future__ import division
import sys
if __name__ == '__main__':
expression = ' '.join(sys.argv[1:])
@quandyfactory
quandyfactory / pyloc.py
Created January 24, 2012 19:02
Returns total, nonblank and net lines of code for a Python script or a folder of python scripts.
#!/usr/bin/env python
# coding: utf-8
"""
Calculates total, nonblank and net lines of code for Python scripts.
"""
import os
import re
def get_line_count(blob):
@quandyfactory
quandyfactory / dict2xml.py
Created January 24, 2012 16:16
Converts a native Python dictionary into an XML string. Supports int, float, boolean, string, list and dict data types and arbitrary nesting.
# Note: this library has been moved to its own github page:
# https://github.com/quandyfactory/dict2xml
@quandyfactory
quandyfactory / .vimrc
Created December 20, 2011 19:40
my nascent .vimrc file
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
@quandyfactory
quandyfactory / fix_you_up.md
Created December 12, 2011 14:48
Parody of "Never Gonna Give You Up" by Rick Astley.

Never Gonna Fix You Up

A parody of "Never Gonna Give You Up" by Rick Astley, dedicated to the City of Hamilton.

We're no strangers to red tape  
I don't know the rules and neither do you  
A big investment's what I'd like to make  
You'd rather let it go down the tube

I just wanna tell you how frustrating

@quandyfactory
quandyfactory / increments.py
Created November 25, 2011 19:27
A list comprehension of times in 15 minute increments
# produces ['00:00', '00:15', '00:30', '00:45', '01:00', '01:15', '01:30'...
increments = ['%02d:%02d' % (h, m) for h in range(24) for m in range(0, 60, 15)]
@quandyfactory
quandyfactory / spark.py
Created November 16, 2011 01:06
My Python port of Zack Holman's spark shell script: https://github.com/holman/spark
# -*- coding: utf-8 -*-
"""My Python port of Zack Holman's spark shell script: https://github.com/holman/spark
This:
you@computer:~$ python spark.py 100 20 80 40 60
Should return this: