Skip to content

Instantly share code, notes, and snippets.

View shifei010's full-sized avatar

shifei010 shifei010

View GitHub Profile
@shifei010
shifei010 / mybarcode.py
Created October 7, 2012 04:25
sl4a Read Barcode
import android
droid = android.Android()
(id, result, error) = droid.scanBarcode()
print result['extras']['SCAN_RESULT'], error
@shifei010
shifei010 / address.txt
Created October 7, 2012 03:56
HOWTO Create Python GUIs using HTML
http://www.aclevername.com/articles/python-webgui/
ipc.js
function send(msg) {
document.title = "null";
document.title = msg;
}
demo.xhtml
<script src="ipc.js" type="text/javascript"></script>
@shifei010
shifei010 / address.txt
Created October 7, 2012 03:21
使用 HTML & Javascript 来建立 Python 本地应用程序的图形用户界面
http://eishn.blog.163.com/blog/static/652318200693111385057/
<form action="HAHA://example.test" method="get">
<input type="hidden" value="hello">
<input type="hidden" value="world">
<input type="submit">
</form>
<a href="HAHA://example.test?a=hello&b=world">submit</a>
@shifei010
shifei010 / address.txt
Created October 7, 2012 03:13
Python SL4A WebView Template
http://www.robertocolistete.net/Python/Android/
@shifei010
shifei010 / androino.html
Created October 7, 2012 03:11
sl4a Androino
<html>
<head>
<title>Androino</title>
<style>
body {
background: #32323D;
}
div#content {
padding-top:100px;
@shifei010
shifei010 / address.txt
Created October 7, 2012 02:46
Using bottle.py and SL4A to build an Android Web Server for your phone / tablet
http://www.marginhound.com/using-bottle-py-and-sl4a-to-build-an-android-web-server-for-your-phone-tablet/
from bottle import route, run, template,validate, static_file
from multiprocessing import Process
droid = android.Android()
def showurl(url=”http://localhost:8080“):
time.sleep(5)
droid.webViewShow(url)
@shifei010
shifei010 / address.txt
Created October 7, 2012 02:40
Measure Biopotential / ECG using Python on the Android Smartphone
http://www.smartphonedaq.com/android-python-ecg.page
droid = android.Android()
droid.webViewShow('file:///sdcard/sl4a/scripts/graph.html')
loop=True
while loop:
e = droid.eventWaitFor('check').result
if (e['data']=='timer'):
...
@shifei010
shifei010 / standalone_python.sh
Created October 7, 2012 02:01
sl4a python standalone
PW=`pwd`
export EXTERNAL_STORAGE=/mnt/sdcard
export LANG=en
PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python
PYTHONPATH=${PYTHONPATH}:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload
export PYTHONPATH
export TEMP=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/python
export LD_LIBRARY_PATH=/data/data/com.googlecode.pythonforandroid/files/python/lib
@shifei010
shifei010 / pprint.apart.py
Created October 7, 2012 00:06
sympy pprint apart demo
from sympy import pprint, apart
from sympy.abc import *
pprint(apart(z/(z**2-z-1),z))