Skip to content

Instantly share code, notes, and snippets.


Will Hutcheson whutch

View GitHub Profile
View .pythonrc
# vim: set ft=python :
from __future__ import print_function
import json
import sys
import datetime
from redis import StrictRedis as Redis
"""Create a map and render it as a pgm image.
import sys
import math
import json
from functools import lru_cache
from noise import snoise2
aleksandarristic /
Created Sep 6, 2013
A CachedProperty descriptor; It receives an expensive getter function (& optional arguments for it). The __get__ runs the getter function with the object instance as the first argument (& optional arguments provided in __init__) and caches the result. The __set__ just changes the cache to the 'value', __delete__ removes the cache.
class CachedProperty(object):
A cached property; A bit specific, as
it runs the getter as an instance method
& forwards the instance & init args to it.
Uses python descriptors protocol
def __init__(self, getter, *args):
self.getter = getter
self.args = args or None
chanux /
Created Mar 15, 2012
A simple python tool to fix time of srt files
#!/usr/bin/env python
from sys import argv, exit
from os import path
import datetime
if len(argv) == 5:
(script, inputf, outputf, sign, msec) = argv
print "fixsrt <> <> <+/-> <milli seconds>"
You can’t perform that action at this time.