code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/env python # -*- coding: UTF-8 -*- from django.db import models from django.contrib.auth.models import User # Create your models here. class Music(models.Model): """音乐 """ title = models.CharField(max_length=50) artist = models.CharField(max_length=50) counting = models.IntegerField() ...
Python
#!/usr/bin/env python # -*- coding: UTF-8 -*- from django.db import models from django.contrib.auth.models import User # Create your models here. class Music(models.Model): """音乐 """ title = models.CharField(max_length=50) artist = models.CharField(max_length=50) counting = models.IntegerField() ...
Python
# Create your views here.
Python
# # 3DStudyMaze is a Panda3D application for building and # running an education course in virtual environment. # # It will feature: # - Simple maze definition language # - Connectivity between mazes # - Auto-adjusting room and tunnel sizes # - Support-ticket instructor locks # - LaTeX-editable walls # # It is based on...
Python
# Maze Root root = Entrance(Point3(0,-10,0), dim=Point2(0,0), direction='back') for directory in sorted([d for d in os.listdir('mazes') if os.path.isdir(os.path.join('mazes',d))]): guess = os.path.join(os.getcwd(),os.path.join(os.path.join('mazes',directory),'maze.py')) if os.path.exists(guess): # Tod...
Python
XXX101_r1 = MazeRoom(root, dim=Point3(50,50,50), offset=Point2(25,25), music='mazes/XXX101/basic.ogg') self.mazeAreas.append(XXX101_r1)
Python
""" FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.org/licenses/gpl.html...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the ...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gn...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gn...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the ...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gn...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gn...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python """ FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2009 Frederico Caldeira Knabben == BEGIN LICENSE == Licensed under the terms of any of the following licenses at your choice: - GNU General Public License Version 2 or later (the "GPL") http://www.gnu.or...
Python
#!/usr/bin/env python # encoding: utf-8 import random """ ' Author: Jonathan Potter ' ' Name: parameters ' ' Description: The simulation parameters, or knobs. These can be changed by the user to tailor the ' simulation to his needs. These are described more in depth in the User's Manual of the documentation. ' ' ...
Python
#!/usr/bin/env python # encoding: utf-8 import sys import os from parameters import * from driver import Driver """ ' ' Author: Jonathan Potter ' ' Name: Simulation ' ' Description: The main simulation entry point. This is the file you run, and it simply ' passes off control to the driver. ' ' Return: None. ' """ d...
Python
#!/usr/bin/env python # encoding: utf-8 import sys import os import random import networkx as nx """ ' ' Author: Jonathan Potter ' ' Name: Utilities ' ' Description: Defines methods used by all protocols ' ' Parameters: None ' """ class Utilities: """ ' ' Name: pairs ' ' Description: Pairs up items of a ...
Python
#!/usr/bin/env python # encoding: utf-8 import networkx as nx import matplotlib.pyplot as plt import sys import os import random import math from protocols import Simple from protocols import Crowds from protocols import OnionRouting from protocols import Utilities """ ' ' Author: Jonathan Potter ' ' Name: Driver ...
Python
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python import codecs import re import jinja2 import markdown def process_slides(): with codecs.open('../presentation.html', 'w', encoding='utf8') as outfile: md = codecs.open('slides.md', encoding='utf8').read() md_slides = md.split('\n---\n')...
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
#coding=utf-8 from django.db import models from django.contrib.auth.models import User #记录订单的表,请根据自己需求完成 class Transaction(models.Model): out_trade_no=models.CharField(max_length=32) user=models.ForeignKey(User)
Python
#encoding=utf-8 from django.conf.urls.defaults import patterns,include,url from views import * urlpatterns=patterns('alipay.views', url(r'checkout$',alipayTo), url(r'alipay_notify$',alipay_notify), url(r'alipay_return$',alipay_return), )
Python
#!/usr/bin/env python #coding=utf-8 ''' #============================================================================= # FileName: views.py # Desc: 支付宝接口调用类 # Author: GitFree # Email: pengzhao.lh@gmail.com # LastChange: 2011-11-21 13:52:52 #==========================================...
Python
#!/usr/bin/env python #coding=utf-8 ''' #============================================================================= # FileName: AlipayConfig.py # Desc: 基础配置类 # Author: GitFree # Email: pengzhao.lh@gmail.com # LastChange: 2011-11-21 13:53:39 #======================================...
Python
#!/usr/bin/env python #coding=utf-8 ''' #============================================================================= # FileName: AlipayNotify.py # Desc: 支付宝通知处理类 # Author: GitFree # Email: pengzhao.lh@gmail.com # LastChange: 2011-09-27 00:52:09 #===================================...
Python
#!/usr/bin/env python #coding=utf-8 ''' #============================================================================= # FileName: AlipaySubmit.py # Desc: 支付宝各接口请求提交类 # Author: GitFree # Email: pengzhao.lh@gmail.com # LastChange: 2011-09-24 14:20:35 #================================...
Python
#!/usr/bin/env python #coding=utf-8 ''' #============================================================================= # FileName: AlipayService.py # Desc: 支付宝接口构造类 # Author: GitFree # Email: pengzhao.lh@gmail.com # LastChange: 2011-09-24 01:47:10 #==================================...
Python
#!/usr/bin/env python #coding=utf-8 ''' #============================================================================= # FileName: AlipayCore.py # Desc: 支付宝接口共用函数类 # Author: GitFree # Email: pengzhao.lh@gmail.com # LastChange: 2011-09-24 03:32:13 #===================================...
Python
import os numInput = 0 numOutput = 0 folderName = raw_input("Enter the folder containing the data files to convert ... ") files = os.listdir(folderName) for each in files: if(os.path.isdir(each)): files.remove(each) fileStr = "" for eachFile in files: fileStr += eachFile + ", " print("Conver...
Python
#!/usr/bin/env python # encoding: utf-8 import sys import os import time from pyfann import libfann def main(): connection_rate = 1 learning_rate = 0.7 num_output = 1 max_iterations = 5000 iterations_between_reports = 100 parameters = [{"title": "Abalone", "train_file": "abalone_trai...
Python
#!/usr/bin/env python # encoding: utf-8 import sys import os import time from pyfann import libfann def main(): learning_rate = 0.7 num_output = 1 max_iterations = 5000 iterations_between_reports = 100 parameters = [{"title": "Abalone", "train_file": "abalone_train.data", "t...
Python
#!/usr/bin/env python # encoding: utf-8 import sys import os import time from pyfann import libfann def main(): learning_rate = 0.7 num_output = 1 max_iterations = 5000 iterations_between_reports = 100 parameters = [{"title": "Abalone", "train_file": "abalone_train.data", "t...
Python
#!/usr/bin/env python # encoding: utf-8 import sys import os import time from pyfann import libfann def main(): connection_rate = 1 learning_rate = 0.7 num_output = 1 max_iterations = 5000 iterations_between_reports = 100 parameters = [{"title": "Abalone", "train_file": "abalone_trai...
Python
#!/usr/bin/python import sys, hashlib def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + sys.argv[0] + " infile outfile label") def main(): if( len(sys.argv) != 4): usage() sys.exit() fp = open( sys.argv[1] , "rb") hash_str = has...
Python
#!/usr/bin/python import sys, re, os def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + os.path.split(__file__)[1] + " version outfile") def crete_version_str(ver): base = list("0.00") version = str(ver) ret = [] base[0] = version[0] base...
Python
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import sys, os, struct, gzip, hashlib, StringIO gzip.time = FakeTime() def binary_replace(data, newdata, offset): return data[0:offset] + newdata + data[offset+len(newdata):] def prx_compress(output, hdr, input, mod_name="", mod_a...
Python
#!/usr/bin/python import sys, hashlib def toNID(name): hashstr = hashlib.sha1(name.encode()).hexdigest().upper() return "0x" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2] if __name__ == "__main__": assert(toNID("sceKernelCpuSuspendIntr") == "0x092968F4") for name in sys.argv[1:]: print ("%s: %s"...
Python
#!/usr/bin/python from hashlib import * import sys, struct def sha512(psid): if len(psid) != 16: return "".encode() for i in range(512): psid = sha1(psid).digest() return psid def get_psid(str): if len(str) != 32: return "".encode() b = "".encode() for i in range(0, len(str), 2): b += struct.pack('B...
Python
#!/usr/bin/python """ pspbtcnf_editor: An script that add modules from pspbtcnf """ import sys, os, re from getopt import * from struct import * BTCNF_MAGIC=0x0F803001 verbose = False def print_usage(): print ("%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]" %(os.path...
Python
#!/usr/bin/python import os def main(): lists = [ "ISODrivers/Galaxy/galaxy.prx", "ISODrivers/March33/march33.prx", "ISODrivers/March33/march33_620.prx", "ISODrivers/Inferno/inferno.prx", "Popcorn/popcorn.prx", "Satelite/satelite.prx", "Stargate/stargate.prx", "SystemControl/systemctrl.prx", ...
Python
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import os, gzip, StringIO gzip.time = FakeTime() def create_gzip(input, output): f_in=open(input, 'rb') temp=StringIO.StringIO() f=gzip.GzipFile(fileobj=temp, mode='wb') f.writelines(f_in) f.close() f_in.close() fout=open(out...
Python
#!/usr/bin/python import os, sys, getopt def usage(): print ("Usage: %s [-l size ] basefile input output" % (sys.argv[0])) def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def main(): inputsize = 0 try: optlist, args = getopt.getopt(sys.argv[1:], 'l:h') except getopt.GetoptError: us...
Python
#!/usr/bin/env python from distutils.core import setup import os def get_build(): path = "./.build" if os.path.exists(path): fp = open(path, "r") build = eval(fp.read()) if os.path.exists("./.increase_build"): build += 1 fp.close() else: build = 1 fp = open(path, "w") fp.write(str(build)) fp.cl...
Python
# -*- coding: utf-8 -*- # # pylast - A Python interface to Last.fm (and other API compatible social networks) # # Copyright 2008-2010 Amr Hassan # # 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 a...
Python
# Copyright 2010 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
# Author: Hui ZHENG # Lisence: MIT import uno import unohelper from com.sun.star.task import XJobExecutor RegExp_3gpp_Ref = r'\[[:digit:]+\]' RegExp_3gpp_Ref_Definition = r'^[:space:]*\[[:digit:]+\]' RegExp_Numbering = r'[:digit:]+([. ][:digit:]+)+[:alpha:]?(-[:alnum:]+)?|[:digit:]+(-[:alnum:]+)' RegExp_...
Python
import os, sys import Tkinter as tk import tkFileDialog import bootloader class bootloadergui: def __init__(self): self.flash = [] self.importingfile=None for i in range(0x6000): self.flash.append(0xFF) self.eeprom = [] for i in range(0x100): ...
Python
import ctypes import sys if len(sys.argv) != 2: print "Usage: %s <duty>\n" % sys.argv[0] sys.exit(-1) duty = int(sys.argv[1]) if (duty < 0) or (duty > 255): print "Illegal duty cycle (%d) specified.\n" % duty sys.exit(-1) SET_RA1 = 1 CLR_RA1 = 2 GET_RA2 = 3 SET_DUTY = 4 usb = ctypes...
Python
#from Gui import * import ctypes import threading import math import time import os import pygame from pygame.locals import * import ctypes from Tkinter import * SET_SERVO = 1 KILL_CREEPA = 2 TOWERTIMEARRAY = 3 KILL_CREEPB = 4 GET_RA0 = 5 FIRING = 6 GET_TOWERTYPE = 7 GET_TOWERPOS = 8 GET_TICK = 9 UNK...
Python
import ctypes SET_RA1 = 1 CLR_RA1 = 2 GET_RA2 = 3 SET_DUTY = 4 usb = ctypes.cdll.LoadLibrary('usb.dll') usb.initialize() buffer = ctypes.c_buffer(8) dev = usb.open_device(0x6666, 0x0003, 0) if dev<0: print "No matching device found...\n" else: ret = usb.control_transfer(dev, 0x40, CLR_RA1,...
Python
"""Wrapper classes for use with tkinter. This module provides the following classes: Gui: a sublass of Tk that provides wrappers for most of the widget-creating methods from Tk. The advantages of these wrappers is that they use Python's optional argument capability to provide appropriate default values, and that the...
Python
from Tkinter import * import math import ctypes SET_SERVO = 1 KILL_CREEPA = 2 TOWERTIMEARRAY = 3 KILL_CREEPB = 4 GET_RA0 = 5 FIRING = 6 GET_TOWERTYPE = 7 GET_TOWERPOS = 8 GET_TICK = 9 #[(32, 16, math.pi/4),(29, 24, 13*math.pi/12),(29, 33, math.pi/24),(9, 34, 23*math.pi/24),(17, 21.5, 13*math.pi/12),(9...
Python
from Tkinter import * import ctypes SET_SERVO = 1 KILL_CREEPA = 2 KILL_CREEPB = 3 SET_DUTY = 4 global servospot servospot=0 print "set servospot" opponentpin = [] playerpin = [] usb = ctypes.cdll.LoadLibrary('usb.dll') usb.initialize() print "hey o" buffer = ctypes.c_buffer(8) player=True de...
Python
import ctypes SET_RA1 = 1 CLR_RA1 = 2 GET_RA2 = 3 SET_DUTY = 4 usb = ctypes.cdll.LoadLibrary('usb.dll') usb.initialize() buffer = ctypes.c_buffer(8) dev = usb.open_device(0x6666, 0x0003, 0) if dev<0: print "No matching device found...\n" else: ret = usb.control_transfer(dev, 0xC0, GET_RA2,...
Python
import ctypes SET_RA1 = 1 CLR_RA1 = 2 GET_RA2 = 3 SET_DUTY = 4 usb = ctypes.cdll.LoadLibrary('usb.dll') usb.initialize() buffer = ctypes.c_buffer(8) dev = usb.open_device(0x6666, 0x0003, 0) if dev<0: print "No matching device found...\n" else: ret = usb.control_transfer(dev, 0x00, 0x09, 1,...
Python
import ctypes SET_RA1 = 1 CLR_RA1 = 2 GET_RA2 = 3 SET_DUTY = 4 usb = ctypes.cdll.LoadLibrary('usb.dll') usb.initialize() buffer = ctypes.c_buffer(8) dev = usb.open_device(0x6666, 0x0003, 0) if dev<0: print "No matching device found...\n" else: ret = usb.control_transfer(dev, 0x40, SET_RA1,...
Python
#!/usr/bin/python from decimal import Decimal, getcontext getcontext.prec = 10 from copy import copy import os import random import time import tkFileDialog import tkMessageBox import tkSimpleDialog import pickle import math import generate import graphmath from copy import deepcopy from math import ...
Python
#!/usr/bin/python from decimal import Decimal, getcontext getcontext.prec = 10 from copy import copy import os import random import time import tkFileDialog import tkMessageBox import tkSimpleDialog import pickle import math import generate import graphmath from copy import deepcopy from math import ...
Python
"""Wrapper classes for use with tkinter. This module provides the following classes: Gui: a sublass of Tk that provides wrappers for most of the widget-creating methods from Tk. The advantages of these wrappers is that they use Python's optional argument capability to provide appropriate default values, and that the...
Python
class Creep: def __init__(self, alive = 1, HP = 10, instance): self.life = alive #1 is alive, 0 is dead self.health = HP self.instance = instance self.x = x.Path(instance) #has something to do with where self.y = y.Path(instance) #the...
Python
import math def delimeters(gear_pos): g1 = gear_pos[-1] g2 = gear_pos[0] dist = 0 d = [] for i in range(len(gear_pos)): gear = gear_pos[i-1] to_gear = gear_pos[i] from_gear = gear_pos[i-2] (t1,t2) = cctangent(from_gear, gear) (t3, t4)...
Python
from Gui import * import ctypes import threading import math ##usb = ctypes.cdll.LoadLibrary('usb.dll') ##usb.initialize() ##buffer = ctypes.c_buffer(8) ##def set_ra1_callback(): ## usb.control_transfer(dev, 0x40, SET_RA1, 0, 0, 0, buffer) ## ##def clr_ra1_callback(): ## usb.control_transfer(dev, 0x40,...
Python
from Tkinter import * import ctypes SET_SERVO = 1 ##CLR_RA1 = 2 ##GET_RA2 = 3 ##SET_DUTY = 4 global servospot servospot=0 print "set servospot" usb = ctypes.cdll.LoadLibrary('usb.dll') usb.initialize() print "hey o" buffer = ctypes.c_buffer(8) ##def set_ra1_callback(): ## usb.control_transf...
Python
# explore the mouse wheel with the Tkinter GUI toolkit # Windows and Linux generate different events # tested with Python25 import Tkinter as tk def mouse_wheel(event): global count # respond to Linux or Windows wheel event if event.num == 5 or event.delta == -120: count -= 1 if e...
Python
from visual import * from Blokus import * from PieceTest import * def draw_piece(piece,n): color_index = [color.red,color.blue,color.green,color.yellow] for (x,y) in piece.geometry: box (pos = (-100 + x+n,y,0),size = (2,2,1), color = color_index[piece.color]) selected = display(title = ...
Python
from Gui import * import ctypes import threading import math import time ##usb = ctypes.cdll.LoadLibrary('usb.dll') ##usb.initialize() ##buffer = ctypes.c_buffer(8) ##def set_ra1_callback(): ## usb.control_transfer(dev, 0x40, SET_RA1, 0, 0, 0, buffer) ## ##def clr_ra1_callback(): ## usb.control_transf...
Python
# -*- coding: utf-8 -*- # # jQuery File Upload Plugin GAE Python Example 2.1.0 # https://github.com/blueimp/jQuery-File-Upload # # Copyright 2011, Sebastian Tschan # https://blueimp.net # # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT # from __future__ import with_statement from google.appe...
Python
# -*- coding: utf-8 -*- # # jQuery File Upload Plugin GAE Python Example 2.1.0 # https://github.com/blueimp/jQuery-File-Upload # # Copyright 2011, Sebastian Tschan # https://blueimp.net # # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT # from __future__ import with_statement from google.appe...
Python
from sys import stdin a, b, c = map(int, stdin.readline().strip().split()) print "%.3lf" % ((a+b+c)/3.0)
Python
from sys import stdin from math import * r, h = map(float, stdin.readline().strip().split()) print "Area = %.3lf" % (pi*r*r*2 + 2*pi*r*h)
Python
from sys import stdin from math import * n, = map(int, stdin.readline().strip().split()) rad = radians(n) print "%.3lf %.3lf" % (sin(rad), cos(rad))
Python
from sys import stdin n, = map(int, stdin.readline().strip().split()) print n*(n+1)/2
Python
from sys import stdin a, b = map(int, stdin.readline().strip().split()) print b, a
Python
from sys import stdin n, m = map(int, stdin.readline().strip().split()) a = (4*n-m)/2 b = n-a if m % 2 == 1 or a < 0 or b < 0: print "No answer" else: print a, b
Python
from sys import stdin n, = map(int, stdin.readline().strip().split()) money = n * 95 if money >= 300: money *= 0.85 print "%.2lf" % money
Python
from sys import stdin n, = map(int, stdin.readline().strip().split()) print ["yes", "no"][n % 2]
Python
from sys import stdin from math import * x1, y1, x2, y2 = map(float, stdin.readline().strip().split()) print "%.3lf" % hypot((x1-x2), (y1-y2))
Python
from sys import stdin n = stdin.readline().strip().split()[0] print '%c%c%c' % (n[2], n[1], n[0])
Python
from sys import stdin x, = map(float, stdin.readline().strip().split()) print abs(x)
Python
from sys import stdin from calendar import isleap year, = map(int, stdin.readline().strip().split()) if isleap(year): print "yes" else: print "no"
Python
from sys import stdin f, = map(float, stdin.readline().strip().split()) print "%.3lf" % (5*(f-32)/9)
Python
from sys import stdin a, b, c = map(int, stdin.readline().strip().split()) if a*a + b*b == c*c or a*a + c*c == b*b or b*b + c*c == a*a: print "yes" elif a + b <= c or a + c <= b or b + c <= a: print "not a triangle" else: print "no"
Python
from sys import stdin a = map(int, stdin.readline().strip().split()) a.sort() print a[0], a[1], a[2]
Python
s = i = 0 while True: term = 1.0 / (i*2+1) s += term * ((-1)**i) if term < 1e-6: break i += 1 print "%.6lf" % s
Python
from sys import stdin from decimal import * a, b, c = map(int, stdin.readline().strip().split()) getcontext().prec = c print Decimal(a) / Decimal(b)
Python