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 dateutil import parser | |
from datetime import timedelta | |
date = "Mar 11th 2013" | |
def addweeks(date,week=0): | |
x = parser.parse(date) | |
new = x + timedelta(weeks=week) | |
return(new.strftime("%b %d %Y")) |
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
for i in *.svg; do inkscape -f "$i" -e "$i.png"; done |
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
X = [0.82, 7.19, 4.15, 7.14, 2.5, 0, 2.04, 0, 4.55, 1.98, 0, 0.5, 1.56, 2.55, 0.4, 0] | |
r = range(0,11) | |
ys, xs, pathes = plt.hist(X, bins=r) | |
plt.ylabel("count") | |
plt.xticks(r, r) | |
plt.show() |
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
# javascript | |
var element = document.getElementById("MI"); | |
element.setAttribute("class", "s5"); | |
# css | |
.s5 { | |
fill: #00FA19; | |
} |
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 subprocess import Popen | |
maxworkers = 10 | |
workers=[] | |
for i in range(0,maxworkers): | |
workers.append(Popen('python work.py', shell=True)) | |
# OR | |
def makeworker(): |
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
screen | |
C-a S | |
C-a TAB | |
C-a c |
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
# http://geospatialpython.com/ | |
import json, pymongo, shapefile | |
from json import dumps | |
database = 'geo' | |
connection = pymongo.MongoClient() | |
db = getattr(connection,database) | |
def renamesh2json(x): | |
d = x.split(".") |
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
diff -u file1 file2 | colordiff | less -R |
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
import json, pymongo, shapefile, sys, ijson | |
from ijson import common | |
from ijson.backends import yajl | |
def floaten(event): | |
if event[1] == 'number': | |
return (event[0], event[1], float(event[2])) | |
else: | |
return event |
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 types import StringTypes | |
if not isinstance(a,StringTypes): raise |