code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # # Copyright 2012 Google Inc. All Rights Reserved. # # unittest requires method names starting in 'test' #pylint: disable-msg=C6409 """Unit tests for periodic_statistics.py.""" __author__ = 'jnewlin@google.com (John Newlin)' import datetime import mox import time import unittest import google3 im...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
Python
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # """Platform-specific information which the rest of Catawampus needs.""" __author__ = 'dgentry@google.com (Denton Gentry)' import abc class PlatformConfigMeta(object): """Class to provide platform-specific information like directory locations. ...
Python
from google.appengine.ext import db from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import sys import os from google.appengine.ext.webapp import template from models import * class MainPage(webapp.RequestHandler): def get(self)...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96') ...
Python
"""Models""" from google.appengine.ext import db class userDetails(db.Model): #To store individual student details username=db.StringProperty() #Student name email=db.EmailProperty() #Email of student mobilenumber=db.StringProperty() #Mobile phone number admissionnumber=db.StringProperty() #Admissio...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96') f...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96') f...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96') f...
Python
from google.appengine.ext import db from google.appengine.api import users from models import * cat=db.GqlQuery("SELECT * FROM projectCategory") for i in cat: i.delete() cat=db.GqlQuery("SELECT * FROM projectDetails") for i in cat: i.delete() u1=projectCategory(categoryid="CSHPC",maxmembers=100,categorytype="HPC ...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96')...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
from google.appengine.ext import db from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import sys import os from google.appengine.ext.webapp import template from models import * global pcategory class MainPage(webapp.RequestHandler)...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
from google.appengine.ext import db from google.appengine.api import users from models import * u1=userDetails(username="kev",email="kev@gmail.com",userid="221",mobilenumber="111",admissionnumber="1",branch="CSE",projecteamids="",privilege="stud",timestamp="") u1.put() u2=userDetails(username="jozf",email="jozf@gma...
Python
from google.appengine.ext import db from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import sys import os from google.appengine.ext.webapp import template from models import * class MainPage(webapp.RequestHandler): def verifyLo...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96')...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import cgi from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app import os from google.appengine.ext.webapp import template from models import * class MainPage(webapp.RequestHandler): def verifyLog...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96') f...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
import sys import os from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library use_library('django', '0.96')...
Python
import datetime,cgi import sys import os from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.dist import use_library from os imp...
Python
from sysIB.dbnew import setup_blank_tables from sysIB.dbconnect import get_db_filename, connection from sysIB.dbtablestatic import staticdata from sysIB.dbtablets import tsdata import os import pandas as pd dbname="mydb" dbfilename=get_db_filename(dbname) try: os.remove(dbfilename) except: pass setup_blank_t...
Python
import pandas as pd import numpy as np DEFAULT_VALUE=np.nan class autodf(object): ''' Object to make it easy to add data in rows and return pandas time series Initialise with autodf("name1", "name2", ...) Add rows with autodf.add_row(name1=..., name2=...., ) To data frame with autodf.to_panda...
Python
from sysIB.wrapper_v5 import IBWrapper, IBclient from swigibpy import Contract as IBcontract import time if __name__=="__main__": """ This simple example places an order, checks to see if it is active, and receives fill(s) Note: If you are running this on the 'edemo' account it will probably give y...
Python
from swigibpy import EWrapper import time import datetime from swigibpy import EPosixClientSocket from sysIB.IButils import autodf ### how many seconds before we give up MAX_WAIT=30 def return_IB_connection_info(): """ Returns the tuple host, port, clientID required by eConnect """ host="" ...
Python
from swigibpy import EWrapper import time from swigibpy import EPosixClientSocket, ExecutionFilter from swigibpy import Order as IBOrder from sysIB.IButils import bs_resolve, action_ib_fill MAX_WAIT_SECONDS=10 MEANINGLESS_NUMBER=1830 def return_IB_connection_info(): """ Returns the tuple host, port, clientID...
Python
from swigibpy import EWrapper import time from swigibpy import EPosixClientSocket ### how many seconds before we give up MAX_WAIT=30 def return_IB_connection_info(): """ Returns the tuple host, port, clientID required by eConnect """ host="" port=4001 clientid=999 return (h...
Python
from swigibpy import EWrapper import time import numpy as np import datetime from swigibpy import EPosixClientSocket MEANINGLESS_ID=502 def return_IB_connection_info(): """ Returns the tuple host, port, clientID required by eConnect """ host="" port=4001 clientid=999 return...
Python
from sysIB.wrapper_v3 import IBWrapper, IBclient from swigibpy import Contract as IBcontract if __name__=="__main__": """ This simple example returns streaming price data """ callback = IBWrapper() client=IBclient(callback) ibcontract = IBcontract() ibcontract.secType = "FUT" ib...
Python
from sysIB.wrapper import IBWrapper, IBclient if __name__=="__main__": """ This simple example returns the time """ callback = IBWrapper() client=IBclient(callback) print client.speaking_clock()
Python
from sysIB.wrapper import IBWrapper, IBclient if __name__=="__main__": """ This simple example returns the time """ callback = IBWrapper() client=IBclient(callback) print client.speaking_clock()
Python
""" Static example """ from sysIB.dbconnect import connection class staticdata(object): ''' Very basic table for static data Does not do checking eg for multiple records etc ''' def __init__(self, dbname): self.connection=connection(dbname) def add(self, code,...
Python
from sysIB.wrapper_v2 import IBWrapper, IBclient from swigibpy import Contract as IBcontract from matplotlib.pyplot import show if __name__=="__main__": """ This simple example returns the time """ callback = IBWrapper() client=IBclient(callback) ibcontract = IBcontract() ibcontrac...
Python
""" Time series database example """ from sysIB.dbconnect import connection import pandas as pd import datetime def date_as_string(dtobject=datetime.datetime.now()): return str(dtobject.strftime("%Y-%m-%d %H:%M:%S.%f")) class tsdata(object): ''' Very basic table for ts data Does not do check...
Python
""" This abstracts the database connection, i.e. exact file and way of accessing The init of the object returns a database connection object which can be used to do common things """ import sqlite3 DBDICT=dict(mydb="mydb.db") def get_db_filename(dbname): try: dbfilename=DBDICT[dbname] excep...
Python
from sysIB.wrapper_v4 import IBWrapper, IBclient from swigibpy import Contract as IBcontract import time if __name__=="__main__": """ This simple example places an order, checks to see if it is active, and receives fill(s) Note: If you are running this on the 'edemo' account it will probably give y...
Python
import sqlite3 import os import stat def setup_blank_tables(dbfilename, setupcodelist): """ setup a new sqllite database """ with sqlite3.connect(dbfilename) as conn: for setuptable in setupcodelist: conn.execute(setuptable) conn.commit() ...
Python
from swigibpy import EWrapper import time from swigibpy import EPosixClientSocket, ExecutionFilter from swigibpy import Order as IBOrder from sysIB.IButils import bs_resolve, action_ib_fill MAX_WAIT_SECONDS=10 MEANINGLESS_NUMBER=1729 def return_IB_connection_info(): """ Returns the tuple host, port, clientID...
Python
#!/usr/bin/python import sys from Foundation import * from ScriptingBridge import * ab = SBApplication.applicationWithBundleIdentifier_("com.apple.AddressBook") for person in ab.people(): fname = person.firstName() pfname = person.phoneticFirstName() lname = person.lastName() plname = person.phonetic...
Python
#!/usr/bin/env python import sys import re def ip2int(ip) : ret = 0 match = re.match("(\d*)\.(\d*)\.(\d*)\.(\d*)", ip) if not match : return 0 for i in xrange(4) : ret = (ret << 8) + int(match.groups()[i]) return ret def int2ip(ipnum) : ip1 = ipnum >> 24 ip2 = ipnum >> 16 & 0xFF ip3 = ipnum >> 8 & 0xFF ip4 ...
Python
#!/usr/bin/env python import sys import os from types import StringType # get bencode package from http://github.com/fishy/scripts/downloads from bencode.bencode import bencode, bdecode, BTFailure try : torrent = sys.argv[1] except IndexError : print "Usage: \"%s <torrent_file> [tracker_url]\" to show torrent info ...
Python
#!/usr/bin/env python import sys, getpass, getopt import hmac, hashlib, base64 lengths = [20] # default value optlist, args = getopt.getopt(sys.argv[1:], 'hl:', [ 'length=', 'help' ]) for opt in optlist : name, value = opt if (name == '-l') or (name == '--length') : lengths = value.split(',') for i in xrange(...
Python
#!/usr/bin/env python import sys import re line = sys.stdin.readline().strip() if not line : sys.exit() names = line.split(",") for i in range(len(names)) : names[i] = names[i].strip(' \t\r\n\x00') timere = re.compile(r'(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)') print r'<?xml version="1.0" encoding="UTF-8"?>' print r'...
Python
#!/usr/bin/env python import sys, os, re import zipfile import tempfile import shutil # if your case is not zh-CN, change it here LANG = "zh-CN" # and yes, it's "zh-CN", NOT "zh_CN" tag = "xml:lang" html_re = re.compile(r'(\<html[^\>]*)\>') replace = r'\1 %s="%s">' % (tag, LANG) def addZip(archive, base, curdir) : ...
Python
#!/usr/bin/python2.6 # # Simple http server to emulate api.playfoursquare.com import logging import shutil import sys import urlparse import SimpleHTTPServer import BaseHTTPServer class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Handle playfoursquare.com requests, for testing.""" def do_GET(self...
Python
#!/usr/bin/python import os import subprocess import sys BASEDIR = '../main/src/com/joelapenna/foursquare' TYPESDIR = '../captures/types/v1' captures = sys.argv[1:] if not captures: captures = os.listdir(TYPESDIR) for f in captures: basename = f.split('.')[0] javaname = ''.join([c.capitalize() for c in basena...
Python
#!/usr/bin/python """ Pull a oAuth protected page from foursquare. Expects ~/.oget to contain (one on each line): CONSUMER_KEY CONSUMER_KEY_SECRET USERNAME PASSWORD Don't forget to chmod 600 the file! """ import httplib import os import re import sys import urllib import urllib2 import urlparse import user from xml....
Python
#!/usr/bin/python import datetime import sys import textwrap import common from xml.dom import pulldom PARSER = """\ /** * Copyright 2009 Joe LaPenna */ package com.joelapenna.foursquare.parsers; import com.joelapenna.foursquare.Foursquare; import com.joelapenna.foursquare.error.FoursquareError; import com.joel...
Python