code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
# Copyright 2008 Google Inc. # # 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 applicable law or agreed to in writing, ...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/python2.4 # # Copyright 2008 Google Inc. # # 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 applicable law or...
Python
#!/usr/bin/env python from appengine_django import InstallAppengineHelperForDjango InstallAppengineHelperForDjango() from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the...
Python
#!/usr/bin/env python import imageshack import sys if __name__ == "__main__": if len(sys.argv)!=3: print "Usage upload.py <devkey> <filename/url>" sys.exit(1) u = imageshack.Uploader(sys.argv[1]) try: if sys.argv[2].startswith("http://"): print u.uploadURL(sys.argv[2]...
Python
#!/usr/bin/env python import yfrog import sys if __name__ == "__main__": if len(sys.argv)<4: print "Usage upload.py <username> <password> <filename/url> [<text>] [<source>]" sys.exit(1) u = yfrog.Uploader() if len(sys.argv)>=5: msg = sys.argv[4] else: msg = None if...
Python
#!/usr/bin/env python import os import sys import getopt import imageshack def usage(): print "Usage apitest.py --file filename --key key [--id ID] [--cookie COOKIE] [--tags TAGS] [--visibility PUBLIC] [--username USERNAME] [--password PASSWORD] [--blocksize=BLOCKSIZE] [--numblocks=NUMBLOCKS]" def getopts(arg...
Python
#!/usr/bin/env python ''' Client API library to upload images and videos to yfrog.com Using Yfrog public API, as described here: http://yfrog.com/api.php ''' import urllib2_file import urllib2 import socket from mimetypes import guess_type from xml.dom.minidom import parseString from os.path import exists API_UR...
Python
''' yfrog api ''' from upload import *
Python
#!/usr/bin/env python #### # Version: 0.2.0 # - UTF-8 filenames are now allowed (Eli Golovinsky)<br/> # - File object is no more mandatory, Object only needs to have seek() read() attributes (Eli Golovinsky)<br/> # # Version: 0.1.0 # - upload is now done with chunks (Adam Ambrose) # # Version: older # THANKS TO: # b...
Python
#!/usr/bin/env python ''' Client API library to upload images and videos to imageshack.us Using "Unified upload API" as described here: http://reg.imageshack.us/content.php?page=developerpublic ''' import urllib2_file import urllib2 import socket import httplib from mimetypes import guess_type from xml.dom.minido...
Python
#!/usr/bin/env python ''' Client API library for chuncked video uploading to imageshack.us Using "Streaming upload API" as described here: http://code.google.com/p/imageshackapi/wiki/StreamingAPI ''' import os import urllib import httplib import urllib2 from urlparse import urlparse from os.path import exists fro...
Python
''' imageshack api ''' from upload import * from chuncked_upload import Uploader as ChunkedUploader
Python
#!/usr/bin/env python #### # Version: 0.2.0 # - UTF-8 filenames are now allowed (Eli Golovinsky)<br/> # - File object is no more mandatory, Object only needs to have seek() read() attributes (Eli Golovinsky)<br/> # # Version: 0.1.0 # - upload is now done with chunks (Adam Ambrose) # # Version: older # THANKS TO: # b...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
import SimpleGP reload(SimpleGP) from SimpleGP import GP import numpy as np class GP2(GP): """This class exemplifies the change of the distance function. In the example, the distance is MAE then the derivative of this function is computed in the method compute_error_pr""" def distance(self, y, yh): ...
Python
import numpy as np from SimpleGP import GPPDE from multiprocessing import Process, cpu_count import time x = np.arange(-1, 1.1, 0.1)[:, np.newaxis] l = np.array(map(lambda x: map(float, x.split()), open('data/rational-problems.txt').readlines())) def run(pr, seed): print 'Haciendo r-%s-%s.npy' %...
Python
from SimpleGP import Classification import numpy as np fpt = open('data/iris.npy') X = np.load(fpt) cl = np.load(fpt) fpt.close() gp = Classification(popsize=1000, generations=50, verbose=True, verbose_nind=1000, func=["+", "-", "*", "/", 'abs', 'exp', 'sqrt', ...
Python
import numpy as np from SimpleGP import TimeSeries, GPPDE class TPDE(TimeSeries, GPPDE): pass def rse(x, y): return ((x - y)**2).sum() / ((x - x.sum()/x.size)**2).sum() ts = np.array(map(float, open('data/A.txt').readlines())) nsteps = 100 gp = TPDE.run_cl(ts, nsteps=nsteps, verbose=True) d = np.loadtxt('...
Python
import SimpleGP reload(SimpleGP) from SimpleGP import GP import numpy as np x = np.linspace(-10, 10, 100) pol = np.array([0.2, -0.3, 0.2]) X = np.vstack((x**2, x, np.ones(x.shape[0]))) y = (X.T * pol).sum(axis=1) x = x[:, np.newaxis] gp = GP(verbose=True, max_length=1000).train(x, y) gp.run() print gp.fitness(gp.get_...
Python
from SimpleGP import GPPDE import numpy as np class Cl2(GPPDE): def random_func(self, first_call=False): if first_call: # this is the argmax return 16 return super(Cl2, self).random_func(first_call=first_call) fpt = open('data/iris.npy') X = np.load(fpt) cl = np.load(fpt) ...
Python
import numpy as np import SimpleGP reload(SimpleGP) from SimpleGP import RGP, If, Sigmoid class GP2(RGP): def create_random_constants(self): self._constants = np.random.uniform(-10, 10, self._nrandom).astype(self._dtyp...
Python
import numpy as np from SimpleGP import SubTreeXO from sklearn.metrics.pairwise import euclidean_distances class GPPG(SubTreeXO): def train(self, x, f): super(GPPG, self).train(x.T, f) return self def eval_ind_X(self, ind, **kwargs): trees = super(GPPG, self).eval_ind(ind, **kwargs) ...
Python
from SimpleGP import GP import numpy as np seed = 0 # if len(sys.argv) == 1 else int(sys.argv[1]) x = np.linspace(0, 1, 100) pol = np.array([0.2, -0.3, 0.2]) X = np.vstack((x**2, x, np.ones(x.shape[0]))) y = (X.T * pol).sum(axis=1) gp = GP(popsize=10, generations=100000, verbose=True, verbose...
Python
import SimpleGP reload(SimpleGP) from SimpleGP import GPPDE import numpy as np x = np.linspace(-10, 10, 100) pol = np.array([0.2, -0.3, 0.2]) X = np.vstack((x**2, x, np.ones(x.shape[0]))) y = (X.T * pol).sum(axis=1) x = x[:, np.newaxis] gp = GPPDE(generations=30, verbose=True, # max_mem=10, verbose_nind=10...
Python
import SimpleGP reload(SimpleGP) from SimpleGP import GPRPropU import numpy as np x = np.linspace(0, 10, 100) pol = np.array([0.2, -0.3, 0.2]) X = np.vstack((x**2, x, np.ones(x.shape[0]))) y = (X.T * pol).sum(axis=1) gp = GPRPropU(popsize=1000, generations=50*5, verbose=True, ...
Python
# Copyright 2013 Mario Graff Guerrero # 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 applicable law or agreed to in wri...
Python
import RDF from flyingfish.utils import modeldump, sparql, str_scalar_or_list from flyingfish.client import RDFconnection print "start" connection = RDFconnection(model="sample_storage", storage="postgresql", startnew=True, options = "host='127.0.0.1',database='ffish',user='root','password='...
Python
import RDF from flyingfish.utils import modeldump, sparql, str_scalar_or_list from flyingfish.client import RDFconnection print "start" connection = RDFconnection(model="sample_storage", storage="postgresql", startnew=True, options = "host='127.0.0.1',database='ffish',user='root','password='...
Python
import RDF from flyingfish.utils import modeldump, sparql, str_scalar_or_list from flyingfish.client import RDFconnection print "start" connection = RDFconnection(model="sample_storage", storage="postgresql", startnew=False, options = "host='127.0.0.1',database='ffish',user='root','password=...
Python
import RDF from flyingfish.utils import modeldump, sparql, str_scalar_or_list from flyingfish.client import RDFconnection connection = RDFconnection(model="sample_storage", storage="postgresql", startnew=False, options = "host='127.0.0.1',database='ffish',user='root','password=''") client = ...
Python
import RDF import string def modeldump(model): output = "" for s in model.as_stream(): output += "Statement: %s\n" % s return output def sparql(model, sparql): output = "" q = RDF.Query(sparql, query_language="sparql") for result in q.execute(model): output += "{\n" for...
Python
from constants import NAMESPACES, DICT_DELIMITER, ATTR_DELIMITER class ListString(list): """ Modified List You could do with this=ListString(): - refer this as usual List - call str(this), unicode(this) with better formating - this.as_string() same to str(this) ...
Python
import RDF from model import RDFmodel, shortcut_to_uri from constants import NAMESPACES from utilListString import ListString class RDFconnection: def __init__(self, model, storage, startnew, options): if startnew: start_new = ",new='yes'" else: start_new = ",new='no'" self.storage...
Python
#Model options NAMESPACES = { 'dc' : 'http://purl.org/dc/elements/1.1/', 'foaf': 'http://xmlns.com/foaf/0.1/', 'rdfs': 'http://www.w3.org/2000/01/rdf-schema#', 'rdf' : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rss' : 'http://purl.org/rss/1.0/'...
Python
import RDF from constants import NAMESPACES, DICT_DELIMITER, ATTR_DELIMITER from utilListString import ListString def uri_to_shortcut(uri): ''' convert URI to internal shortcuts-style like foaf:knows''' uri = str(uri) # hey, but convert RDF.Node to string by yourself! for prefix, ns_uri in NAMESPACES.iter...
Python
''' This module is home to the ScrapeEngine class. @author: Cory Banack ''' import clr import resources import log from utils import sstr from configuration import Configuration from comicform import ComicForm from seriesform import SeriesForm, SeriesFormResult from issueform import IssueForm, IssueForm...
Python
############################################################################### # # ComicVineScraper.py # # This is the 'entry point' into the Comic Vine Scraper add-on for # ComicRack. This script requires the latest version of ComicRack in order # to run. # # # Credits: - written and maintai...
Python
#corylow: comment and cleanup this file ############################################################################### # Created on Feb 7, 2010 # @author: Cory Banack ################################################################################ import clr; clr.AddReference('System.Drawing') from System.Dra...
Python
''' @author: Cory Banack ''' #corylow: comment and cleanup this file from utils import sstr class IssueRef(object): def __init__(self, issue_num_s, issue_key): # issue_num_s can be '' or any other string # issue key must be something ('not issue_key' == False) if not issue_key or is...
Python
''' This module contains is the gateway to whatever "database" this script uses to obtain information about comic books. The exact nature of this database is intentionally vague in order to remain modular and interchangable. In other words, the behaviour of this "comic book database" can be understood entirely...
Python
# encoding: utf-8 ''' This module is used to find imprint names for publishers in the ComicVine database. Since ComicVine doesn't directly store imprint information, we are forced to maintain a internal tables of known imprints and their publishers in order to do this. If you run this module, it will q...
Python
''' This module contains the Comic Vine implementations of the the functions described in the db.py module. That module can delegate its function calls to the functions in this module, but other than that, external modules should NOT call these functions directly. @author: Cory Banack ''' import clr im...
Python
##################################################################################### # # Copyright (c) Harry Pierson. All rights reserved. # # This source code is subject to terms and conditions of the Microsoft Public License. # A copy of the license can be found at http://opensource.org/licenses/ms-pl.html ...
Python
''' This module contains useful canned methods for accessing the Comic Vine database (API) over the Internet. The documentation for this API and the related queries can be found at: http://api.comicvine.com/documentation/ @author: Cory Banack ''' import clr import log import xml2py from utils import sst...
Python
##################################################################################### # # Copyright (c) Harry Pierson. All rights reserved. # # This source code is subject to terms and conditions of the Microsoft Public License. # A copy of the license can be found at http://opensource.org/licenses/ms-pl.html ...
Python
''' This module contains the ComicBook class, which represents a comic book from ComicRack that we are scraping data into. @author: Cory Banack ''' #import clr import re import log from time import strftime from utils import sstr import db import utils #================================================...
Python
""" This module installs a GLOBAL logging system into an application. Any information that is written out using the debug(), debug_exc(), or handle_error methods will get printed to stdout. All information that is written to stderr or stdout (by this class, or any other mechanism) is also saved in memory, so t...
Python
''' @author: Cory Banack ''' # corylow: comment and cleanup this file import clr import resources from utils import persist_map, load_map clr.AddReference('System') from System.IO import File class Configuration(object): __UPDATE_SERIES = 'updateSeries' __UPDATE_NUMBER = 'updateNumber' ...
Python
''' This module contains a variety of generally useful utility methods. @author: Cory Banack ''' import clr import log from time import strftime import re import sys clr.AddReference('System') from System.IO import File clr.AddReference('System.Drawing') from System.Drawing import Graphics, Bitmap ...
Python
''' This module contains utility methods for working with ComicRack ComicBook objects (i.e. 'book' objects). @author: Cory Banack ''' import re from dbmodels import IssueRef # ============================================================================= def extract_issue_ref(book): ''' This metho...
Python
''' This module is home to the Scheduler class. @author: Cory Banack ''' import clr import log clr.AddReference('System') from System.Threading import Monitor, Thread, ThreadStart # ============================================================================= class Scheduler(object): ''' ...
Python
''' @author: Cory Banack ''' #corylow: comment and cleanup this file import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import DataGridView # a specialized DataGridView that replaces it's "enter" keystroke with a # click event on the button given in its constructor class ...
Python
''' This module contains the DBPictureBox class, which can be used to display remotely loaded images using an asyncrhonous off-loading thread manner. @author: Cory Banack ''' import clr import resources import utils import db from scheduler import Scheduler clr.AddReference('System.Drawing') from System...
Python
#corylow: comment and cleanup this file ''' @author: Cory Banack ''' import clr from cvform import CVForm clr.AddReference('System.Windows.Forms') from System.Windows.Forms import ProgressBar clr.AddReference('IronPython') class ProgressBarForm(CVForm): def __init__(self, owner, scraper, m...
Python
''' This module is home to the SearchForm class. @author: Cory Banack ''' import clr from cvform import CVForm clr.AddReference('System.Windows.Forms') from System.Windows.Forms import AutoScaleMode, Button, \ DialogResult, Label, TextBox clr.AddReference('System.Drawing') from System.Drawing imp...
Python
''' This module is home to the WelcomeForm class. @author: Cory Banack ''' import clr import resources from cvform import CVForm from configform import ConfigForm clr.AddReference('System.Windows.Forms') from System.Windows.Forms import AutoScaleMode, Button, DialogResult, Label clr.AddReference('Sys...
Python
''' This module is home to the IssuesForm and IssuesFormResult classes. @author: Cory Banack ''' import clr clr.AddReference('Microsoft.VisualBasic') from System.ComponentModel import ListSortDirection clr.AddReference('System.Drawing') from System.Drawing import Point, Size clr.AddReference('System.W...
Python
''' @author: Cory Banack ''' # corylow: comment and cleanup this file import clr import log from cvform import CVForm from configuration import Configuration clr.AddReference('System.Windows.Forms') from System.Windows.Forms import AutoScaleMode, Button, CheckBox, \ CheckedListBox, DialogResult, Flat...
Python
''' @author: Cory Banack ''' #corylow: comment and cleanup this file from cvform import CVForm import clr import log import resources import utils from utils import sstr clr.AddReference('IronPython') clr.AddReference('System') from System import GC clr.AddReference('System.Drawing') from System.D...
Python
''' This module is home to the SeriesForm and SeriesFormResult classes. @author: Cory Banack ''' import re import clr from buttondgv import ButtonDataGridView from cvform import CVForm from dbpicturebox import DBPictureBox from utils import sstr import datetime clr.AddReference('System') from System....
Python
''' This module contains the PersistentForm class. @author: Cory Banack ''' #corylow: comment and cleanup this file import clr import log from utils import sstr, load_map, persist_map import resources clr.AddReference('System') from System.Threading import Thread, ThreadStart clr.AddReference('System...
Python
''' This module is home to the FinishForm class. @author: Cory Banack ''' import clr import resources from cvform import CVForm clr.AddReference('System.Windows.Forms') from System.Windows.Forms import AutoScaleMode, Button, DialogResult, Label clr.AddReference('System.Drawing') from System.Drawing i...
Python
''' This module contains the CVForm class. @author: Cory Banack ''' import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import FormBorderStyle, Keys from persistentform import PersistentForm #============================================================================== class ...
Python
''' This module is home to the IssueCoverPanel class. @author: Cory Banack ''' import clr from dbpicturebox import DBPictureBox from utils import sstr import db import utils from scheduler import Scheduler clr.AddReference('System.Drawing') from System.Drawing import ContentAlignment, Font, FontSty...
Python
# This Python file uses the following encoding: us-ascii # corylow: comment and cleanup this file import sys import os import cPickle import resources import clr clr.AddReferenceByPartialName("System.Windows.Forms") clr.AddReferenceByPartialName("System.Drawing") from System.Windows.Forms import Form ...
Python
from ged_handler import * # Regular Expression import re # This class parse a gedcom file to create an object tree # It use the handler to parse line by line class Parser: handler = None def __init__(self): self.handler = Handler() # parse a gedcom line and return a tuple # (<level>, <cod...
Python
# Models from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import * from sqlalchemy.orm import relationship, backref Base = declarative_base() class GedDate(Base): __tablename__ = 'geddate' geddate_id = Column(Integer, Sequence('geddate_sequence'), primary_key=True) year = Column(...
Python
from model import * MONTHS = {'JAN': 1, 'FEB': 2, 'MAR': 3, 'APR': 4, 'MAY': 5, 'JUN': 6, 'JUL': 7, 'AUG': 8, 'SEP': 9, 'OCT': 10, 'NOV': 11, 'DEC':12} class Handler: def __init__(self): self.currentlevel = -1 self.objectstack = [] self.familyTree = None self.objects = {'INDI': {}...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import decimal from datetime import datetime as dt from py4j.java_gateway import JavaGateway class Bridge(object): def __init__(self): gateway = JavaGateway() self.point = gateway.entry_point def format(self, obj...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import decimal from datetime import datetime as dt from py4j.java_gateway import JavaGateway class Bridge(object): def __init__(self): gateway = JavaGateway() self.point = gateway.entry_point def format(self, obj...
Python
#!/usr/bin/env python import sys import readline import rlcompleter readline.parse_and_bind("tab: complete") from rflib import * intro = """'RfCat, the greatest thing since Frequency Hopping!' Don't you wish this were a CLI!? Sorry. Maybe soon... For now, enjoy the raw power of rflib, or write your own device-s...
Python
#!/usr/bin/python import re import os import sys import cmd import socket import threading from rflib import * DATA_START_IDX = 4 # without the app/cmd/len bytes, the data starts at byte 4 def splitargs(cmdline): cmdline = cmdline.replace('\\\\"', '"').replace('\\"', '') patt = re.compile('\".+?\"|\S+'...
Python
import sys import os from distutils.core import setup, Extension packages = ['rflib', 'vstruct', 'vstruct.defs'] mods = [] pkgdata = {} scripts = ['rfcat', 'rfcat_server', ] setup (name = 'rfcat', version = '1.0', description = "the swiss army knife of subGHz", author = 'at...
Python
import struct from StringIO import StringIO import vstruct.primitives as vs_prims def isVstructType(x): return isinstance(x, vs_prims.v_base) class VStruct(vs_prims.v_base): def __init__(self, bigend=False): # A tiny bit of evil... object.__setattr__(self, "_vs_values", {}) vs_prims...
Python
import struct class v_enum: pass class v_base(object): def __init__(self): self._vs_meta = {} def vsGetMeta(self, name, defval=None): return self._vs_meta.get(name, defval) def vsSetMeta(self, name, value): self._vs_meta[name] = value # Sub-classes (primitive base, or VStru...
Python
''' VStruct builder! Used to serialize structure definitions etc... ''' import types import inspect import vstruct import vstruct.primitives as vs_prim prim_types = [ None, vs_prim.v_uint8, vs_prim.v_uint16, None, vs_prim.v_uint32, ...
Python
# FIXME this is named wrong! import vstruct from vstruct.primitives import * class CLIENT_ID(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.UniqueProcess = v_ptr() self.UniqueThread = v_ptr() class EXCEPTION_RECORD(vstruct.VStruct): def __init__(self): ...
Python
import vstruct from vstruct.primitives import * EI_NIDENT = 4 EI_PADLEN = 7 class Elf32(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.e_ident = v_bytes(EI_NIDENT) self.e_class = v_uint8() self.e_data = v_uint8() self.e_filevers...
Python