code
stringlengths
1
1.72M
language
stringclasses
1 value
# This file is Copyright 2002 Dean Hall. # This file is part of the Python-on-a-Chip libraries. # This software is licensed under the MIT License. # See the LICENSE file for details. ## @package sys # @brief Provides PyMite's system module, sys # # USAGE # ----- # # import sys # #### TODO # modules = None #set pt...
Python
# This file is Copyright 2009 Dean Hall. # This file is part of the Python-on-a-Chip libraries. # This software is licensed under the MIT License. # See the LICENSE file for details. ## @file # @copybrief func ## @package func # @brief Provides PyMite's func module. ## # Returns the names tuple of the function/mo...
Python
# This file is Copyright 2009 Dean Hall. # This file is part of the Python-on-a-Chip libraries. # This software is licensed under the MIT License. # See the LICENSE file for details. ## @file # @copybrief sizeof ## @package sizeof # @brief Provides PyMite's sizeof module. # # <b>USAGE</b> # # \code sizeof.sizeof(ob...
Python
# This file is Copyright 2009 Dean Hall. # This file is part of the Python-on-a-Chip libraries. # This software is licensed under the MIT License. # See the LICENSE file for details. ## @file ## @package string # @brief Provides PyMite's string module. # """__NATIVE__ #include <stdlib.h> #include <string.h> """ ...
Python
# This file is Copyright 2002 Dean Hall. # This file is part of the Python-on-a-Chip libraries. # This software is licensed under the MIT License. # See the LICENSE file for details. ## @file # @copybrief __bi ## @package __bi # @brief Provides PyMite's builtins module, __bi. # # <b>USAGE</b> # # The builtins are...
Python
# This file is Copyright 2009 Dean Hall. # This file is part of the Python-on-a-Chip libraries. # This software is licensed under the MIT License. # See the LICENSE file for details. ## @file # @copybrief list ## @package list # @brief Provides PyMite's list module. # # Notes: # - index(l, o) does not offer start a...
Python
# Django settings for hgWeb project. SERVICE_PATH = 'D:/praktyki/piotrbrzuska/hgWeb/src/hgWeb/' DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'p...
Python
from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin import os admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^hgWeb/', include('hgWeb.foo.urls')), # Uncomment the admin/doc line below and add 'django.cont...
Python
# localrepo.py - read/write repository class for mercurial # # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from node import bin, hex, nullid, nullrev, short from i18n import _...
Python
HG_REPOSITORIES_ROOT = "D:\praktyki\piotrbrzuska\HgRepositories"
Python
from django.db import models from django.contrib.auth.models import User from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse from django.conf import settings as global_settings from mercurial import hg, ui from datetime import da...
Python
""" This file demonstrates two different styles of tests (one doctest and one unittest). These will both pass when you run "manage.py test". Replace these with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): ...
Python
#-*- coding: utf-8 -*- from django.template import Context, loader from hgWeb.hg.models import Repository,RepositoryContext from hgWeb.hg.models import LanguageList from django.http import HttpResponse, HttpResponseRedirect from django.core.context_processors import csrf from mercurial import hg, ui import hgW...
Python
''' Created on 2010-08-02 @author: Administrator ''' ORDER_VAR = 'o' ORDER_TYPE_VAR = 'ot' class SortHeaders: """ Handles generation of an argument for the Django ORM's ``order_by`` method and generation of table headers which reflect the currently selected sort, based on defined table hea...
Python
from django.contrib import admin from hgWeb.hg.models import Repository from hgWeb.hg.models import LanguageList admin.site.register(Repository) admin.site.register(LanguageList)
Python
#!/usr/bin/env python 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 file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python # # Copyright 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your op...
Python
#!/usr/bin/env python import sys import os, os.path from optparse import OptionParser def quote_line (line): line = line.replace ('&', '&amp;') line = line.replace ('<', '&lt;') line = line.replace ('>', '&gt;') line = line.replace ("'", '&apos;') line = line.replace ('"', '&quot;') return lin...
Python
#!/usr/bin/env python from gnuradio import gr, gr_unittest import howto class qa_howto (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_square_ff (self): src_data = (-3, 4, -5.5, 2, 3) expected_result = ...
Python
#!/usr/bin/env python import sys import os, os.path from optparse import OptionParser def quote_line (line): line = line.replace ('&', '&amp;') line = line.replace ('<', '&lt;') line = line.replace ('>', '&gt;') line = line.replace ("'", '&apos;') line = line.replace ('"', '&quot;') return lin...
Python
#!/usr/bin/env python from gnuradio import gr, gr_unittest import howto class qa_howto (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () def tearDown (self): self.tb = None def test_001_square_ff (self): src_data = (-3, 4, -5.5, 2, 3) expected_result = ...
Python
#!/usr/bin/python import sys import math import networkx # Basically this file is just a wrapper around the graph generator # networkx.generators.random_graphs.powerlaw_cluster_graph. # Output is to standard out (so use pipe redirection) def main(): # usage: graph_gen.py n m p seed > outputfile if ( len(sys.argv...
Python
#!/usr/bin/python import sys import math import networkx as nx # Donald Knuth's Running mean and variance calculation # See Knuth TAOCP vol 2, 3rd edition, page 232 class RunningStat: def __init__(self): self.clear() def clear(self): self.m_n = 0 self.m_newM = 0 self.m_newM = 0.0 self.m_newS = 0.0 self...
Python
#!/usr/bin/python import sys import math import networkx # Basically this file is just a wrapper around the graph generator # networkx.generators.random_graphs.powerlaw_cluster_graph. # Output is to standard out (so use pipe redirection) def main(): # usage: graph_gen.py n m p seed > outputfile if ( len(sys.argv...
Python
#!/usr/bin/python import sys import math import networkx as nx # Donald Knuth's Running mean and variance calculation # See Knuth TAOCP vol 2, 3rd edition, page 232 class RunningStat: def __init__(self): self.clear() def clear(self): self.m_n = 0 self.m_newM = 0 self.m_newM = 0.0 self.m_newS = 0.0 self...
Python
#!/usr/bin/python ''' dlm2dot.py: Take an input graph file and convert to a dot file. This script interprets the cluster label and generates an appropriate dot graph. Input format is edge-list with some delimiter used between vertice labels (and optionally a weight). For now any weight values are ignored if...
Python
#!/usr/bin/python ''' metis2clusters.py input: output file from pmetis or kmetis output: clusters file to use with addClusterLabels.py Currently assumes node numbering starting at 1. Also, may need to add vertex label map like was done for community as gaps in the range of node values causes errors. usage: m...
Python
#!/usr/bin/python ''' convertGraph.py: Take an input graph file and convert it to a suitable format for the partitioning/cluster programs (Community in this case). Created on Apr 15, 2011 @author: cmhill ''' import getopt import networkx as nx import sys EDGE = "EDGE" ADJ_LIST = "ADJ_LIST" METIS = "METIS" COM...
Python
#!/usr/bin/python ''' metis2clusters.py input: output file from pmetis or kmetis output: clusters file to use with addClusterLabels.py Currently assumes node numbering starting at 1. Also, may need to add vertex label map like was done for community as gaps in the range of node values causes errors. usage: m...
Python
#!/usr/bin/python ''' dlm2dot.py: Take an input graph file and convert to a dot file. This script interprets the cluster label and generates an appropriate dot graph. Input format is edge-list with some delimiter used between vertice labels (and optionally a weight). For now any weight values are ignored if...
Python
#!/usr/bin/python ''' convertGraph.py: Take an input graph file and convert it to a suitable format for the partitioning/cluster programs (Community in this case). Created on Apr 15, 2011 @author: cmhill ''' import getopt import networkx as nx import sys EDGE = "EDGE" ADJ_LIST = "ADJ_LIST" METIS = "METIS" COM...
Python
#!/usr/bin/python ''' addClusterLabels.py: input: edge list and a set of clusters output: edge list with clusters prepended to vertex name usage: addClusterLabels.py edgelist clusters > output all arguments are filenames Created on May 1, 2011 @author: ncrowell ''' import getopt import sys # creates a dic...
Python
#!/usr/bin/python ''' community2clusters.py: input: tree output from community and map file generated if the graph need to be convereted for community output: clusters files to use with addClusterLabels.py As a side note, communities pushes all node numbers down such that the lowest is 0 and they are consecuti...
Python
#!/usr/bin/python ''' dlm2dot.py usage: randomClusters.py input_file k > output_file input: input file name and the number of clusters to use k. output: the cluster file Created on May 2, 2011 @author: ncrowell ''' import sys import random # Produces the set containings all of the nodes in the input def proce...
Python
#!/usr/bin/python ''' dlm2dot.py usage: randomClusters.py input_file k > output_file input: input file name and the number of clusters to use k. output: the cluster file Created on May 2, 2011 @author: ncrowell ''' import sys import random # Produces the set containings all of the nodes in the input def proce...
Python
#!/usr/bin/python ''' addClusterLabels.py: input: edge list and a set of clusters output: edge list with clusters prepended to vertex name usage: addClusterLabels.py edgelist clusters > output all arguments are filenames Created on May 1, 2011 @author: ncrowell ''' import getopt import sys # creates a dic...
Python
#!/usr/bin/python ''' community2clusters.py: input: tree output from community and map file generated if the graph need to be convereted for community output: clusters files to use with addClusterLabels.py As a side note, communities pushes all node numbers down such that the lowest is 0 and they are consecuti...
Python
''' Read in an edge list and prepend all node id's with their cluster info. Ex: 1 2 1 3 1 5 Result: cluster1/1 cluster1/2 cluster1/1 cluster2/3 ... ''' import os, sys def getClusterMapping(filename): file = open(filename, 'r') clusterMappings = {} for line in file: tuple = line.strip().split('\t'...
Python
''' Transform the metis output from: 4 5 4 ... to the following format: 1 cluster_4 2 cluster_5 3 cluster_4 ... ''' import sys if __name__ == '__main__': metisFile = open(sys.argv[1], 'r') outputFile = open(sys.argv[1] + ".map", 'w') counter = 1 for line in metisFile: outputFile.write(str(counter) + '\tc...
Python
''' convertGraph.py: Take an input graph file and convert it to a suitable format for the partitioning/cluster programs (METIS/etc). -i /Users/cmhill/Work/818K/818k-project/pl_20_2_90 -f METIS -o /Users/cmhill/Downloads/metis-4.0.3/Graphs/pl_20_2_90.metis $: kmetis /Users/cmhill/Downloads/metis-4.0.3/Graphs/pl_100...
Python
#!/usr/bin/env python from Baseclass import * #Hex #Code Bytes Mnemonic Operands #01 2 AJMP addr11 #02 3 LJMP addr16 #20 3 JB bit, offset #21 2 AJMP addr11 #30 3 JNB bit, offset #40 2 JC offset #41 2 AJMP addr11 #50 2 JNC offset #60 2 JZ offset #61 2 AJMP addr11 #70 2 JNZ offset #73 1 JMP @A+DPTR #80 2 SJMP offset ...
Python
#!/usr/bin/python from Read_Code import * from runner import * from Write_files import * from GUI import * import sys filename = sys.argv[1] Read_Code(filename) runner() Write_files() GUI(filename)
Python
#!/usr/bin/python from Baseclass import * from mov import * from arithmetics import * from jmp import * from decode_logical import * def runner(): pcntr_run = 0 while pcntr_run < UC.PC: if UC.ROM[pcntr_run] == '00': pcntr_run=OP_00(pcntr_run) elif UC.ROM[pcntr_run] == '01': pcntr_run=OP_01(pcntr_run)...
Python
#!/usr/bin/env python from Baseclass import * def setpsw(n): #--- set PSW nth bits ---# temp = UC.hex2dec(UC.bin2hex(UC.PSW[2:])) if n == 0 and UC.PSW[9] == '0': temp += 1 elif n == 1 and UC.PSW[8] == '0': temp += 2 elif n == 2 and UC.PSW[7] == '0': temp += 4 elif n == 3 and UC.PSW[6] == '0': temp += 8 ...
Python
from Tkinter import * import string import Tkinter import Pmw from Baseclass import * from decoder import * ######## GUI FILE ############# def GUI(filename): class MyApp: def __init__(self, parent): self.myParent = parent self.myContainer1 = Frame(parent) self.myContainer1.pack() # top frame ...
Python
#!/usr/bin/python class BaseClass8051: """The base class of 8051 which consists of all common data types and functions used for the simulator""" ROM=[hex(0)]*4096 RAM=[hex(0)]*256 A=hex(0) R0=hex(0) R1=hex(0) R2=hex(0) R3=hex(0) R4=hex(0) R5=hex(0) R6=hex(0) R7=hex(0) #B=RAM[240] i.e. F0 #SP = RAM[129] ...
Python
#!/usr/bin/python from decoder import * from Baseclass import * def Read_Code(filename): f=open(filename) asm_code=f.read().strip().upper() print asm_code asm_code_list=asm_code #print asm_code_list asm_code_list=asm_code_list.splitlines() print asm_code_list f.close() opcodes=[] # count=0 # for n in asm...
Python
#!/usr/bin/python from Baseclass import * ####################### AND OPerations ############################# ## ANL(AND Logical) # ANL data addr,A : 52 Not done # ANL data addr,#data : 53 Not done # ANL A,#data : 54 Not done # ANL A,data addr: 55 Not done # ANL A,@R0: 56 Not done # ANL A,@R1: 57 Not done # ANL ...
Python
#!/usr/bin/env python from Baseclass import * from psw import * def addacc(lsb,msb): if lsb[0] != '0': setpsw(6) msb = UC.dec2hex(int(UC.hex2dec(msb)+1)) if msb[0] != '0': setpsw(7) UC.A = msb[1]+lsb[1] else: UC.A = msb[1]+lsb[1] else: if msb[0] != '0': setpsw(7) UC.A = msb[1]+lsb[1] else:...
Python
from Baseclass import * from decoder import * ####--- This file is used to file writing operation for GUI purpose ---##### def Write_files(): f=open('register.txt','w') f.write('Accumulator A \t = \t') f.write(UC.A) f.write('\nRegisters') f.write('\nB \t = \t') f.write(UC.RAM[UC.hex2dec('F0')]) f.write('\nR0 \...
Python
#!/usr/bin/python from Baseclass import * def OP_74(pcntr): """ MOV A, #data""" pcntr=pcntr+1 UC.A=UC.ROM[pcntr] pcntr=pcntr+1 return(pcntr) def OP_75(pcntr): """ MOV dataaddr,#data""" pcntr=pcntr+1 temp=UC.hex2dec(UC.ROM[pcntr]) pcntr=pcntr+1 UC.RAM[temp]=UC.ROM[pcntr] pcntr=pcntr+1 return pcntr def OP_...
Python
import os, sys from setuptools import setup, Extension if sys.platform == 'darwin': include_dirs = ['/Library/Frameworks/OneRing.framework/Headers/'] library_dirs = [] libraries = [] extra_link_args = ['-framework', 'OneRing'] else: include_dirs = [os.path.join('..', '..', 'include')] library_d...
Python
#!/usr/bin/env python # encoding: UTF-8 import sys import logging try: import json except ImportError: import simplejson as json import onering logging.basicConfig(level=logging.DEBUG) def app(environ, start_response): start_response('200 OK', []) path = environ['PATH_INFO'] if path == '/init': ...
Python
import logging from cStringIO import StringIO try: import json except ImportError: import simplejson as json import _onering __all__ = ['register_wsgi_app', 'loop', 'publish'] logger = logging.getLogger('onering') def register_wsgi_app(appname, app): def callback(method, url, body=None): respons...
Python
from distutils.core import setup from glob import glob import sys, os from demo import __version__ as version def gen_data_files(topdir): for dirpath, dirnames, filenames in os.walk(topdir): filenames = [x for x in filenames if not x.startswith('.')] yield dirpath, [os.path.join(dirpath, fn) for fn...
Python
#!/usr/bin/env python # encoding: UTF-8 __author__ = "Qiangning Hong <hongqn@gmail.com>" __version__ = "$Revision$" __date__ = "$Date$" import sys, os import logging import commands import re import shutil from subprocess import check_call logger = logging.getLogger() def get_qt_dir(): onering = '/Library/Frame...
Python
#!/usr/bin/env python # encoding: UTF-8 __version__ = '0.1' import sys, os try: import json except ImportError: import simplejson as json import logging import web from web.contrib.template import render_mako import onering urls = ( '/init', 'init', '/', 'index', '/create_window', 'create_windo...
Python
#!/usr/bin/env python #coding: utf-8 # # scdd.py daemon process # # author: observer # email: jingchaohu@gmail.com # blog: http://obmem.com # last edit @ 2009.12.19 import os,sys,time import re from daemon import Daemon import sqlite3 import fetchvc from download import httpfetch from Queue import Queue from threading ...
Python
#!/usr/bin/env python import sys, os, time, atexit from signal import SIGTERM class Daemon: """ A generic daemon class. Usage: subclass the Daemon class and override the run() method """ def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/n...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # fetchvc.py fetch resources from verycd # # author: observer # email: jingchaohu@gmail.com # blog: http://obmem.com # last edit @ 2009.12.16 import urllib import re import sqlite3 import time import os,sys from threading import Thread from Queue import Queue from downl...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # download.py: download with report # # author: observer # email: jingchaohu@gmail.com # blog: http://obmem.com # last edit @ 2009.12.16 import os,sys import urllib2 from time import time,sleep path = os.path.dirname(os.path.realpath(sys.argv[0])) #proxies = {'http':'ht...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # code.py: based on web.py # # author: observer # email: jingchaohu@gmail.com # blog: http://obmem.com # last edit @ 2009.12.16 import web import sqlite3 web.config.debug = False db = web.database(dbn='sqlite', db='verycd.sqlite3.db') urls = ( '/', 'index', ) rende...
Python
#!/usr/bin/env python # coding=utf-8 # Based on GAppProxy by Du XiaoGang <dugang@188.com> # Based on WallProxy 0.4.0 by hexieshe <www.ehust@gmail.com> __version__ = 'beta' __author__ = 'phus.lu@gmail.com' __password__ = '' import zlib, logging, time, re, struct from google.appengine.ext import webapp from google.app...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') from UserDict import IterableUserDict __all__ = ['HTTPHeaders'] class HTTPHeaders(IterableUserDict): def __setitem__(self, key, item): self.data[key.title()] = item def add(self, key, item): k...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = '%s & %s' % ('d3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64'), 'YnJvbnplMW1hbkBnbWFpbC5jb20='.decode('base64')) import hashlib, itertools __all__ = ['Crypto'] class XOR: '''XOR with pure Python in case no PyCrypto''' def __init__(self, key): ...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') __version__ = '0.0.2' import gaeproxy class MainHandler(gaeproxy.MainHandler): _cachename = 'wp_cache2' def dump_data(self, dic): return '&'.join('%s=%s' % (k,str(v).encode('hex')) for k,v in dic.iteritems()) ...
Python
__author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __version__ = '1.0.2' from util import crypto, httpheaders import cPickle as pickle import zlib, logging, time, re, struct from google.appengine.ext import webapp, db from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.api import ...
Python
__author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __version__ = '0.4.2' import gaeproxy from gaeproxy import struct, zlib, logging, memcache class MainHandler(gaeproxy.MainHandler): _cfg = gaeproxy._init_config(gaeproxy.crypto.Crypto2) _unquote_map = {'0':'\x10', '1':'=', '2':'&'} def _quote(s...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __version__ = '0.0.1' import re from util import urlinfo, urlfetch def _sumRule(keyword, hash, share): k = map(len, keyword) hk = map(len, hash) hv = [sum([len(v) for v in t.itervalues()]) for t in hash] ...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') __version__ = '0.0.1' import forold class Handler(forold.Handler): crypto = forold._crypto.Crypto('XOR--0'); key = '' def dump_data(self, dic): return '&'.join('%s=%s' % (k, str(v).encode('hex')) for k, v in di...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __version__ = '0.0.3' import os, socket from wpconfig import main_dir as cert_dir cert_dir = os.path.join(cert_dir, 'cert') try: from OpenSSL import crypto except ImportError: crypto = None try: import ssl ex...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __patcher__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') __version__ = '0.0.4' from util import proxylib class Handler: def __call__(self, host): newhost = proxylib.map_hosts(host) return newhost!=host ...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') __version__ = '0.0.2' import gaeproxy class Handler(gaeproxy.Handler): def dump_data(self, dic): return '&'.join('%s=%s' % (k,str(v).encode('hex')) for k,v in dic.iteritems()) def load_data(self, qs): r...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __version__ = '0.0.1' import random import socket import struct from util import proxylib, urlfetch class Handler: def __init__(self, proxy): self.proxy = proxylib.Proxy(proxy) def handle(self, handler,...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __patcher__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') __version__ = '0.0.6' from util import crypto as _crypto, httpheaders, proxylib, urlfetch, urlinfo import zlib, time, re, struct, random import cPickle as pickle impo...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __version__ = '0.4.1' from util import crypto as _crypto, httpheaders import gaeproxy import zlib, struct class Handler(gaeproxy.Handler): crypto = _crypto.Crypto2('XOR--32') _unquote_map = {'0':'\x10', '1':'='...
Python
#!/usr/bin/env python # Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __patcher__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') __version__ = '1.0.5' import SocketServer import BaseHTTPServer import struct import socket import select import threading from util import urli...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __patcher__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') import os, traceback def main_dir(): import sys, imp if hasattr(sys, 'frozen') or imp.is_frozen('__main__'): return os.path.abspath(os.path.dirname(s...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') from UserDict import IterableUserDict __all__ = ['HTTPHeaders'] class HTTPHeaders(IterableUserDict): def __setitem__(self, key, item): self.data[key.title()] = item def add(self, key, item): k...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') import httplib import threading import httpheaders, proxylib, urlinfo from httplib import error def addheader(self, key, value): prev = self.dict.get(key) if prev is None: self.dict[key] = value else...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') __patcher__ = 'ZHRtYWppYUAxNjMuY29t'.decode('base64') ''' see http://en.wikipedia.org/wiki/SOCKS#Protocol and http://www.ietf.org/rfc/rfc1928.txt ''' import socket import struct import urlinfo __all__ = ['ProxyErro...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = '%s & %s' % ('d3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64'), 'YnJvbnplMW1hbkBnbWFpbC5jb20='.decode('base64')) import hashlib, itertools __all__ = ['Crypto'] class XOR: '''XOR with pure Python in case no PyCrypto''' def __init__(self, key): ...
Python
# Copyright (C) 2010-2011 | GNU GPLv3 __author__ = 'd3d3LmVodXN0QGdtYWlsLmNvbQ=='.decode('base64') import os import urlparse, urllib __all__ = ['url2path', 'path2url', 'parse_netloc', 'unparse_netloc', 'host2ip', 'URL'] default_ports = {'http':80, 'https':443, 'ftp':21} def url2path(path): """url2pat...
Python
#!/usr/bin/env python import sys, os dir = os.path.abspath(os.path.dirname(sys.argv[0])) sys.path.append(os.path.join(dir, 'src.zip')) del sys, os, dir import ProxyServer ProxyServer.main()
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
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 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
#!/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 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 import logging from xml.dom import minidom from xml.dom import pulldom BOOLEAN = "boolean" STRING = "String" GROUP = "Group" # Interfaces that all FoursquareTypes implement. DEFAULT_INTERFACES = ['FoursquareType'] # Interfaces that specific FoursqureTypes implement. INTERFACES = { } DEFAULT_CLA...
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 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
#!/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