This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyejdb | |
from datetime import datetime | |
#Open database | |
ejdb = pyejdb.EJDB("zoo", pyejdb.DEFAULT_OPEN_MODE | pyejdb.JBOTRUNC) | |
parrot1 = { | |
"name": "Grenny", | |
"type": "African Grey", | |
"male": True, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyPdf import PdfFileWriter, PdfFileReader | |
import os, sys | |
output = PdfFileWriter() | |
input1 = PdfFileReader(file("hello_pypdf.test.pdf", "rb")) | |
# print the title of document1.pdf | |
# May fail for non-English | |
# print "title = %s" % (input1.getDocumentInfo().title) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sudo pip install bottle | |
#sudo pip install requests | |
from multiprocessing import Process | |
from bottle import route, run # http://bottlepy.org/docs/dev/ | |
import requests # http://docs.python-requests.org/en/latest/index.html | |
@route('/hello/:name') | |
def hello(name='World'): | |
return "Hello, %s!" % name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://hi.baidu.com/ruclin/item/8f78b786be2f672a110ef369 | |
# | |
#************************************************************************** | |
#* * | |
#* General Purpose Hash Function Algorithms Library * | |
#* * | |
#* Author: Arash Partow - 2002 * | |
#* URL: http://www.partow.net * | |
#* URL: http://www.partow.net/programming/hashfunctions/index.html * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import execnet | |
gw = execnet.makegateway("popen//python=jython") | |
channel = gw.remote_exec(""" | |
from java.util import Vector | |
v = Vector() | |
v.add('aaa') | |
v.add('bbb') | |
for val in v: | |
channel.send(val) | |
""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import execnet | |
group = execnet.Group() | |
for i in range(4): # 4 CPUs | |
group.makegateway() | |
def process_item(channel): | |
# task processor, sits on each CPU | |
import time, random | |
channel.send("ready") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from java.io import * | |
import java.io.InputStream | |
import java.io.FileInputStream | |
import java.lang.String # blah....converting String types between Java/Python is tedious | |
sys.path.append("/usr/share/java/pdfbox.jar") # or wherever you stashed it | |
sys.path.append("/usr/share/java/commons-logging.jar") | |
import org.apache.pdfbox | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import execnet | |
# this function will be run in jython, calling from cpython | |
def do_merge(channel): | |
import sys | |
#from java.io import * | |
import java.io.InputStream | |
import java.io.FileInputStream | |
import java.lang.String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This XML file does not appear to have any style information associated with it. The document tree is shown below. | |
<!-- | |
This is an XML Schema description of the format | |
output by MediaWiki's Special:Export system. | |
Version 0.2 adds optional basic file upload info support, | |
which is used by our OAI export/import submodule. | |
Version 0.3 adds some site configuration information such |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# | |
# ============================================================================= | |
# Version: 2.4 (April 2, 2013) | |
# Author: Giuseppe Attardi (attardi@di.unipi.it), University of Pisa | |
# Antonio Fuschetto (fuschett@di.unipi.it), University of Pisa | |
# | |
# Contributors: | |
# Leonardo Souza (lsouza@amtera.com.br) |