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 | |
from selenium import webdriver | |
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile | |
profile = FirefoxProfile( | |
profile_directory='/path/to/profile/directory/default/' | |
) | |
driver = webdriver.Firefox(firefox_profile=profile) |
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 time, math | |
def dt_handler(obj): | |
if isinstance(obj, datetime) or isinstance(obj, date): | |
v = math.floor(time.mktime(obj.timetuple())) | |
return "DATE(%d)" % v | |
else: return repr(obj) |
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
hardstatus on | |
hardstatus alwayslastline | |
hardstatus string "%{.bW}%w%{.rW}%n %t^{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a " | |
startup_message off | |
defscrollback 5000 | |
altscreen on | |
autodetach on | |
sessionname mendel | |
bind ' ' windowlist -b | |
vbell off |
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/python | |
from urllib2 import urlopen, Request | |
from urllib import quote | |
from simplejson import loads | |
def shorten(url): | |
u = urlopen(Request('http://goo.gl/api/url', 'url=%s' % quote(url), {'User-Agent':'toolbar'})) | |
a = loads(u.read()) | |
return a['short_url'] |
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
cumsum = []; | |
j = [0,1,2,3,4]; | |
for(var a=0;a<j.length;a++) { | |
if(a==0) cumsum[a] = j[0]; | |
else cumsum[a] = cumsum[a-1] + j[a]; | |
} |
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 | |
import csv | |
try: import simplejson as json | |
except: import json | |
from optparse import OptionParser | |
def main(): | |
usage = "usage: csv2json: %prog [options] arg" | |
parser = OptionParser() | |
parser.add_option("-i","--input",dest="input",help="input csv file") |
NewerOlder