code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
Import('file_list')
my_list = Split("""
""")
for x in range(len(my_list)):
my_list[x] = 'palettes/' + my_list[x]
file_list = my_list + file_list
Export('file_list')
| Python |
my_list = Split("""
""")
for x in range(len(my_list)):
my_list[x] = 'fir/' + my_list[x]
Return('my_list')
| Python |
my_list = Split("""
01-222.cpp
103.cpp
106.cpp
108.cpp
112.cpp
117.cpp
120.cpp
121.cpp
15.cpp
164.cpp
175.cpp
176.cpp
177.cpp
178.cpp
179.cpp
183.cpp
185.cpp
186.cpp
187.cpp
189.cpp
199.cpp
208.cpp
222.cpp
23.cpp
235.cpp
253.cpp
3d-block.cpp
411120-c.cpp
43.cpp
57.cpp
603-5052.cpp
68.cpp
8157.cpp
8237.cpp
830118C.cpp
... | Python |
my_list = Split("""
151.cpp
16.cpp
17.cpp
18.cpp
193.cpp
201.cpp
202.cpp
203.cpp
204.cpp
212.cpp
213.cpp
214.cpp
215.cpp
217.cpp
21.cpp
225.cpp
227.cpp
228.cpp
229.cpp
22.cpp
230.cpp
231.cpp
232.cpp
234.cpp
241.cpp
242.cpp
244.cpp
246.cpp
24and26.cpp
255.cpp
25.cpp
27.cpp
32.cpp
33.cpp
40.cpp
41.cpp
42.cpp
46.cpp
50.... | Python |
my_list = Split("""
lapi.c
lauxlib.c
lbaselib.c
lcode.c
ldblib.c
ldebug.c
ldo.c
ldump.c
lfunc.c
lgc.c
linit.c
liolib.c
llex.c
lmathlib.c
lmem.c
loadlib.c
lobject.c
lopcodes.c
loslib.c
lparser.c
lstate.c
lstring.c
lstrlib.c
ltable.c
ltablib.c
ltm.c
lundump.c
lvm.c
lzio.c
print.c
""")
for ... | Python |
my_list = Split("""
nesvideos-piece.cpp
rgbtorgb.cpp
""")
Import('env')
if env['LOGO']:
env.Append(CCFLAGS = "-DHAVE_GD")
for x in range(len(my_list)):
my_list[x] = 'drivers/videolog/' + my_list[x]
Return('my_list')
| Python |
my_list = Split("""
args.cpp
cheat.cpp
config.cpp
hq2x.cpp
hq3x.cpp
scale2x.cpp
scale3x.cpp
scalebit.cpp
vidblit.cpp
configSys.cpp
nes_ntsc.c
""")
for x in range(len(my_list)):
my_list[x] = 'drivers/common/' + my_list[x]
Return('my_list')
| Python |
file_list = Split("""
asm.cpp
cart.cpp
cheat.cpp
conddebug.cpp
config.cpp
debug.cpp
drawing.cpp
emufile.cpp
fceu.cpp
fds.cpp
file.cpp
filter.cpp
ines.cpp
input.cpp
netplay.cpp
nsf.cpp
oldmovie.cpp
palette.cpp
ppu.cpp
sound.cpp
state.cpp
unif.cpp
video.cpp
vsuni.cpp
wave.cpp
x6502.cpp
movie.cpp
""")
subdirs = Split("... | Python |
my_list = Split("""
arkanoid.cpp
bworld.cpp
cursor.cpp
fkb.cpp
ftrainer.cpp
hypershot.cpp
mahjong.cpp
mouse.cpp
oekakids.cpp
powerpad.cpp
quiz.cpp
shadow.cpp
suborkb.cpp
toprider.cpp
zapper.cpp
""")
for x in range(len(my_list)):
my_list[x] = 'input/' + my_list[x]
Return('my_list')
| Python |
my_list = Split("""
crc32.cpp
endian.cpp
general.cpp
guid.cpp
md5.cpp
memory.cpp
unzip.cpp
xstring.cpp
""")
for x in range(len(my_list)):
my_list[x] = 'utils/' + my_list[x]
Return('my_list')
| Python |
import jsonrpclib
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
import threading
import sys
import random
class Bike:
def __init__(self,id=0,ip="0.0.0.0",port=6969,localisation=[0,0,0,0]):
self.id= id
self.ip = ip
self.port = port
self.localisation = localisation
... | Python |
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
import jsonrpclib
import RPIO as GPIO
import time
import threading
import random
id = 42
def set_id(arg_id):
id = arg_id
def unlock_bike(unlock_time):
print "Unlocking bike for %i seconds!" %unlock_time
GPIO.output(17, False)
time.sleep(unlock_time... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('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 custo... | Python |
from django.conf.urls.defaults import patterns, include, url
#Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
('^$' , home_page),
('^hello/$', hello),
(r'^time/plus/(\d{1,2})/$', hours_... | Python |
# Django settings for nut project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
... | Python |
import datetime
from django.template.loader import get_template
from django.shortcuts import render_to_response #shorttest solution for return
def home_page(request):
return render_to_response('link.html')
def hello(request):
return HttpResponse("Hello world")
def hours_ahead(request, offset):
... | Python |
#Skype contact waiting script. It flashes Lightpack when target buddy in contact list are changed his online status.
#You need Skype4Py module and lightpack.py class for using it.
import Skype4Py, lightpack, time, sys
skype = Skype4Py.Skype() # Create an instance of the Skype class
lpack = lightpack.lightpack('... | Python |
#inaccurate pyLightpack class animation examples for 10 LED Lightpack configuration (3+2+3+2 clockwise from the left edge).
import lightpack, time, re, random
lpack = lightpack.lightpack('127.0.0.1', 3636, [2,3,6,7,8,9,10,4,5,1] )
lpack.connect()
lpack.lock()
print ('***pyLightpack animation examples (read scr... | Python |
# Gmail checker script. It check you mail thru IMAP and run clockwise "snake" effect if you have unread messages in the box
import lightpack, time, imaplib, re, getpass
def gmail_checker(username,password):
import imaplib,re
i=imaplib.IMAP4_SSL('imap.gmail.com')
try:
i.... | Python |
import socket, time, imaplib, re, sys
class lightpack:
# host = '127.0.0.1' # The remote host
# port = 3636 # The same port as used by the server
# ledMap = [1,2,3,4,5,6,7,8,9,10] #mapped LEDs
def __init__(self, _host, _port, _ledMap):
self.host = _host
self.port = _port
self.ledM... | Python |
#!/usr/bin/env python
# This command is a simple remote-helper, that is used both as a
# testcase for the remote-helper functionality, and as an example to
# show remote-helper authors one possible implementation.
#
# This is a Git <-> Git importer/exporter, that simply uses git
# fast-import and git fast-export to co... | Python |
#!/usr/bin/env python
#
# git-p4.py -- A tool for bidirectional operation between a Perforce depot and git.
#
# Author: Simon Hausmann <simon@lst.de>
# Copyright: 2007 Simon Hausmann <simon@lst.de>
# 2007 Trolltech ASA
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
#
import optparse, sy... | Python |
#!/usr/bin/env python
#
# This tool is copyright (c) 2006, Sean Estabrooks.
# It is released under the Gnu Public License, version 2.
#
# Import Perforce branches into Git repositories.
# Checking out the files is done by calling the standard p4
# client which you must have properly configured yourself
#
import marsha... | Python |
#!/usr/bin/env python
""" hg-to-git.py - A Mercurial to GIT converter
Copyright (C)2007 Stelian Pop <stelian@popies.net>
This program 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 versi... | Python |
#!/usr/bin/env python
## zip archive frontend for git-fast-import
##
## For example:
##
## mkdir project; cd project; git init
## python import-zips.py *.zip
## git log --stat import-zips
from os import popen, path
from sys import argv, exit
from time import mktime
from zipfile import ZipFile
if len(argv) < 2:
p... | Python |
#! /usr/bin/env python
# This program 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 2 of the License, or
# (at your option) any later version.
""" gitview
GUI browser for git repository
This... | Python |
#!/usr/bin/env python
# Copyright (c) 2010 Eric S. Raymond <esr@thyrsus.com>
# Distributed under BSD terms.
#
# This script contains porcelain and porcelain byproducts.
# It's Python because the Python standard libraries avoid portability/security
# issues raised by callouts in the ancestral Perl and sh scripts. It sh... | Python |
#!/usr/bin/env python
"""Distutils build/install script for the git_remote_helpers package."""
from distutils.core import setup
setup(
name = 'git_remote_helpers',
version = '0.1.0',
description = 'Git remote helper program for non-git repositories',
license = 'GPLv2',
author = 'The Git Community... | Python |
import os
import subprocess
import sys
from git_remote_helpers.util import check_call
class GitExporter(object):
"""An exporter for testgit repositories.
The exporter simply delegates to git fast-export.
"""
def __init__(self, repo):
"""Creates a new exporter for the specified repo.
... | Python |
import os
import subprocess
from git_remote_helpers.util import check_call, die, warn
class NonLocalGit(object):
"""Handler to interact with non-local repos.
"""
def __init__(self, repo):
"""Creates a new non-local handler for the specified repo.
"""
self.repo = repo
def cl... | Python |
#!/usr/bin/env python
"""Functionality for interacting with Git repositories.
This module provides classes for interfacing with a Git repository.
"""
import os
import re
import time
from binascii import hexlify
from cStringIO import StringIO
import unittest
from git_remote_helpers.util import debug, error, die, sta... | Python |
import os
import subprocess
from git_remote_helpers.util import check_call
def sanitize(rev, sep='\t'):
"""Converts a for-each-ref line to a name/value pair.
"""
splitrev = rev.split(sep)
branchval = splitrev[0]
branchname = splitrev[1].strip()
if branchname.startswith("refs/heads/"):
... | Python |
import os
import subprocess
from git_remote_helpers.util import check_call, check_output
class GitImporter(object):
"""An importer for testgit repositories.
This importer simply delegates to git fast-import.
"""
def __init__(self, repo):
"""Creates a new importer for the specified repo.
... | Python |
#!/usr/bin/env python
"""Misc. useful functionality used by the rest of this package.
This module provides common functionality used by the other modules in
this package.
"""
import sys
import os
import subprocess
try:
from subprocess import CalledProcessError
except ImportError:
# from python2.7:subproces... | Python |
#!/usr/bin/env python
"""Support library package for git remote helpers.
Git remote helpers are helper commands that interfaces with a non-git
repository to provide automatic import of non-git history into a Git
repository.
This package provides the support library needed by these helpers..
The following modules are... | Python |
#!/usr/bin/python
# MIT 6.035 project 1 grading script
# by Jason Ansel <jansel@csail.mit.edu> on Feb 6, 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public_d... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project 1 grading script
# by Jason Ansel <jansel@csail.mit.edu> on Feb 6, 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public_d... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project 1 grading script
# by Jason Ansel <jansel@csail.mit.edu> on Feb 6, 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public_d... | Python |
#!/usr/bin/python
# MIT 6.035 project grading script
# by Jason Ansel <jansel@csail.mit.edu>, Spring 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil, time
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public... | Python |
#!/usr/bin/python
# MIT 6.035 project 1 grading script
# by Jason Ansel <jansel@csail.mit.edu> on Feb 6, 2010
# You may redistribute this file under the MIT license
import tarfile, sys, tempfile, subprocess, os, warnings, shutil
from os.path import isfile, isdir, join, dirname, abspath
class config:
scanner_public_d... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-24
@author: shell.xu
'''
import os, sys, time, getopt
import traceback, unicodedata
import chardet, segment
from os import path
segdbname = 'frq.db'
dbname = 'classify.db'
def walkdir(basepath, func, *params):
for base, dirs, files in os.walk(basepath):... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2010-10-02
@author: shell.xu
'''
from distutils.core import setup
setup(name = 'segment', version = '1.0', url = 'http://shell909090.com/',
author = 'Shell.E.Xu', author_email = 'shell909090@gmail.com',
description = 'segmentation library written by pyth... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-16
@author: shell.xu
'''
import os, sys, getopt
import segment
dbname = 'frq.db'
def create(filepath):
''' create filepath : create db form txt dict. '''
ddb = segment.dictdb()
ddb.importtxt(filepath)
ddb.savefile(dbname)
def importdb(filep... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2010-10-01
@author: shell.xu
'''
import unittest
import segment
db = segment.dictdb('frq.db')
class utCutter(unittest.TestCase):
def setUp(self):
self.c = segment.StringCutter(None)
def test_english_words(self):
self.assertEqual(list(self.... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-16
@author: shell.xu
'''
import math, marshal
from dbase import dbase
class dictdb(dbase):
def save(self, fo):
marshal.dump((self.db, self.sdb, self.dbs, self.sdbs), fo)
def load(self, fi):
self.db, self.sdb, self.dbs, self.sdbs = ma... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-24
@author: shell.xu
'''
import chardet
class dbase(object):
def __init__(self, filepath = None):
self.close()
self.filepath = filepath
if self.filepath: self.loadfile(filepath)
def sync(self):
if self.filepath: self.... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-16
@author: shell.xu
'''
from dbase import *
from dictdb import dictdb
class DynamicCutter(CutterBase):
DEBUG = False
def __init__(self, db):
self.db, self.cache = db, {}
@classmethod
def cmp_subtree(cls, r1, r2):
if r1 is N... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-16
@author: shell.xu
'''
from dbase import *
import unicodedata
chrcat = unicodedata.category
punct_set = set(['Ll', 'Lu', 'Lo', 'Nd'])
def split_punct(stc, s):
for e in xrange(s, len(stc)):
if chrcat(stc[e]) in punct_set: return e
return len... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-17
@author: shell.xu
'''
import os, sys
import dyn, dictdb
class StatCutter(dyn.DynamicCutter):
def __init__(self, db):
super(StatCutter, self).__init__(db)
self.wordfrq = {}
def parse(self, sentence):
frq, rslt = self.split... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-15
@author: shell.xu
'''
import os, sys, math, marshal
import unicodedata
from dbase import dbase, readfile_cd
def fixinit(mid):
def getfunc(func):
return lambda *p: (func(*p) + mid) / 2
return getfunc
class Fisher(dbase):
FORBIDDEN = se... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-16
@author: shell.xu
'''
from dbase import readfile_cd
from dictdb import dictdb
from cut import StringCutter
from dyn import DynamicCutter
from train import StatCutter, NewCutter
from fisher import Fisher
def get_cutter(filepath):
return StringCutter(Dy... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-22
@author: shell.xu
'''
import segment
cut = segment.get_cutter('frq.db')
def cuttest(word):
print word
print u'|'.join([i for i in cut.parse(word.decode('utf-8'))])
def test_dyn1():
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttes... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-16
@author: shell.xu
'''
import os, sys, time, getopt, traceback
import unicodedata, chardet, segment
from os import path
dbname = 'frq.db'
def walkdir(basepath, func, *params):
for base, dirs, files in os.walk(basepath):
for filename in files:
... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@date: 2011-11-18
@author: shell.xu
'''
import os, sys, urllib
import threading, urlparse, traceback
import html2text, chardet
from StringIO import StringIO
from lxml import etree, html
sys.path.insert(0, '../')
import segment
queue = []
class spider(threading.Thread):
... | Python |
#!/usr/bin/env python
import sys
from distutils.core import setup
required = []
setup(
name='google-docs-fs',
version='1.0rc2',
description='Treat Google Docs as a local file system',
author='Scott Walton',
author_email='d38dm8nw81k1ng@gmail.com',
license='GPLv2',
url='http://code.google.... | Python |
#!/usr/bin/env python
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from googledocsfs import gFile
gFile.main()
| Python |
#!/usr/bin/env python
#
# gNet.py
#
# Copyright 2009 Scott C. Walton <d38dm8nw81k1ng@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License (version 2), as
# published by the Free Software Foundation
#
# This program is dist... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# gFile.py
#
# Copyright 2008-2009 Scott C. Walton <d38dm8nw81k1ng@gmail.com>
# truncate() function written by miGlanz@gmail.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License (vers... | Python |
#!/usr/bin/env python
'''
Map Genearator Source Code
Ripped from MUDServ to avoid writing a dungeon generator in Erlang for 7DRL 2011
'''
import sys
import json
import mutex
import math
from random import *
from ConfigParser import *
from time import sleep
__version__ = '0.1'
__author__ = 'Ian Wagner and Mic... | Python |
'''
Module which prompts the user for translations and saves them.
TODO: implement
@author: Rodrigo Damazio
'''
class Translator(object):
'''
classdocs
'''
def __init__(self, language):
'''
Constructor
'''
self._language = language
def Translate(self, string_names):
print string_names | Python |
'''
Module which brings history information about files from Mercurial.
@author: Rodrigo Damazio
'''
import re
import subprocess
REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')
def _GetOutputLines(args):
'''
Runs an external process and returns its output as a list of lines.
@param args: the argume... | Python |
'''
Module which parses a string XML file.
@author: Rodrigo Damazio
'''
from xml.parsers.expat import ParserCreate
import re
#import xml.etree.ElementTree as ET
class StringsParser(object):
'''
Parser for string XML files.
This object is not thread-safe and should be used for parsing a single file at
a time... | Python |
#!/usr/bin/python
'''
Entry point for My Tracks i18n tool.
@author: Rodrigo Damazio
'''
import mytracks.files
import mytracks.translate
import mytracks.validate
import sys
def Usage():
print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0]
print 'Commands are:'
print ' cleanup'
print ' translate'
p... | Python |
'''
Module which compares languague files to the master file and detects
issues.
@author: Rodrigo Damazio
'''
import os
from mytracks.parser import StringsParser
import mytracks.history
class Validator(object):
def __init__(self, languages):
'''
Builds a strings file validator.
Params:
@para... | Python |
'''
Module for dealing with resource files (but not their contents).
@author: Rodrigo Damazio
'''
import os.path
from glob import glob
import re
MYTRACKS_RES_DIR = 'MyTracks/res'
ANDROID_MASTER_VALUES = 'values'
ANDROID_VALUES_MASK = 'values-*'
def GetMyTracksDir():
'''
Returns the directory in which the MyTrac... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
# Copyright 2014 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 applicable law or... | Python |
#!/usr/bin/python
# Filename:altman.py
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
import sys,os
ACTION_DOWN = 1
ACTION_UP = 0
ACTION_MOVE = 2
file_handle = None
#log_content = ""
download_log_command = "adb pull /sdcard/altman.log ."
#sets a variable with the package's internal
pac... | Python |
#!/usr/bin/python
# Filename:altman.py
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage
import sys,os
ACTION_DOWN = 1
ACTION_UP = 0
ACTION_MOVE = 2
file_handle = None
#log_content = ""
download_log_command = "adb pull /sdcard/altman.log ."
#sets a variable with the package's internal
pac... | Python |
# Pseudo-Python rendition of the code for ``get_next_access_unit()``.
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of ... | Python |
#! /usr/bin/env python
"""Build HTML from the reStructuredText files in this directory.
This is a script just so I don't have to remember the particular incantation
required. It's not in the Makefile because I'm not yet sure it belongs there...
Requires Python and docutils.
Uses rst2html.py on individual files becau... | Python |
#! /usr/bin/env python
"""Run the doctest on a text file
Usage: doctext.py [file]
[file] defaults to ``test.txt``
"""
import sys
import doctest
def main():
args = sys.argv[1:]
filename = None
verbose = False
for word in args:
if word in ("-v", "-verbose"):
verbose = True
... | Python |
"""Setup.py -- for building tstools Pyrex modules
"""
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#... | Python |
"""tstools -- a package of Pyrex bindings for the tstools
This is being developed on a Mac, running OS X, and also tested on my Ubuntu
system at work.
I do not expect it to build (as it stands) on Windows, as it is making
assumptions that may not follow thereon.
It is my intent to worry about Windows after it works ... | Python |
#! /usr/bin/env python
"""sockread.py -- a simple client to read from a socket
"""
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obta... | Python |
#! /usr/bin/env python
"""socktest.py -- a simple client to talk to tsserve
Command line - optionally:
-host <host> defaults to "localhost"
-port <port> defaults to 8889
-output <filename> defaults to None
-file <filename> the same
-nonblock the socket should ... | 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 |
import string
import random
alphabets = string.letters + string.digits
len1 = 30000
len2 = 30000
f1 = open("random1", "w")
f2 = open("random2", "w")
for i in range(len1):
f1.write(alphabets[random.randint(0, len(alphabets) - 1)])
for i in range(len2):
f2.write(alphabets[random.randint(0, len(alphabets) - 1... | Python |
def lcs(A, B):
m = len(A)
n = len(B)
assert(m <= n)
M = [-1] * (m+1) # M is (m+1) * (m+1)
for i in range(len(M)):
M[i] = [-1] * (m+1)
diagonal_pos = m - 1
length_MAX = 0
pos_A = 0
upper_B = 0
# Calculate M(i, j)
while length_MAX < diagonal_pos:... | Python |
import math
import wave
import array
def createSine( freq=440,length = 3 ,volume = .85, sampleRate =44100) :
sin = math.sin
pi = math.pi
twopi = 2*pi
data = array.array('h')
numSamples = int(length * sampleRate)
cyclesPerSample = float(freq)/sampleRate
volumeScale = volume*32767
for samp in xrange(numSamples... | Python |
""" adapted from javascript by http://no.nonsense.ee/qthmap/
"""
import android, time, os, math
def returnQth(lat, lng):
qth = ''
lat += 90
lng += 180
lat = lat / 10 + 0.0000001
lng = lng / 20 + 0.0000001
qth += chr(65 + lng) + chr(65 + lat)
lat = 10 * (lat - math.floor(lat))
lng = 10 * (... | Python |
import math
import wave
import array
def createSine( freq=440,length = 3 ,volume = .85, sampleRate =44100) :
sin = math.sin
pi = math.pi
twopi = 2*pi
data = array.array('h')
numSamples = int(length * sampleRate)
cyclesPerSample = float(freq)/sampleRate
volumeScale = (.85)*32767
for samp in xrang... | Python |
import math
import wave
import array
def createSine( freq=440,length = 3 ,volume = .85, sampleRate =44100) :
sin = math.sin
pi = math.pi
twopi = 2*pi
data = array.array('h')
numSamples = int(length * sampleRate)
cyclesPerSample = float(freq)/sampleRate
volumeScale = (.85)*32767
for samp in xrang... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.