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 android | |
import time | |
droid = android.Android() | |
droid.toggleBluetoothState(True) | |
droid.dialogCreateAlert('Be a server?') | |
droid.dialogSetPositiveButtonText('Yes') | |
droid.dialogSetNegativeButtonText('No') | |
droid.dialogShow() | |
result = droid.dialogGetResponse() |
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 android import Android | |
import time,sys | |
# Prepare the python for android API | |
droid = Android() | |
# Instruct Py4A which HTML file to use for the webview (we’ll explore this later) | |
droid.webViewShow('file:///sdcard/sl4a/scripts/daveTest/index.html') | |
# SL4A uses the concept of events, like javascript does. |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<link rel="stylesheet" href="file:///sdcard/sl4a/scripts/daveTest/css/bootstrap.min.css" /> | |
<script src="file:///sdcard/sl4a/scripts/daveTest/js/bootstrap.min.js"></script> | |
<script> |
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 androidhelper | |
from kivy.app import App | |
from kivy.uix.button import Button | |
class TestApp(App): | |
def buttonPress(self,instance): | |
droid = androidhelper.Android() | |
line = droid.dialogGetInput() | |
s = 'Hello %s' % line.result | |
droid.makeToast(s) |
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 flask import Flask | |
from flask import render_template | |
from flask import redirect, url_for | |
import dhtreader | |
import cPickle as pickle | |
from subprocess import call | |
app = Flask(__name__) | |
@app.route('/toggle') | |
def toggle(): |
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 subprocess import call | |
import time, datetime | |
import smtplib, ftplib | |
import RPi.GPIO as io | |
import multiprocessing | |
io.setmode(io.BCM) | |
pir_pin = 24 | |
GMAIL_USERNAME = "YOUR_EMAIL_ADDRESS_HERE" |
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
#!/bin/bash | |
mkdir /tmp/mjpg | |
raspistill -tl 500 -t 0 -vf -w 640 -h 480 -o /tmp/mjpg/test.jpg -n -q 50 & > /dev/null 2>&1 | |
LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/mjpg -n test.jpg" -o "output_http.so -w /usr/local/www" -b |
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
uploadButton.setOnClickListener(new Button.OnClickListener() { | |
public void onClick(View v) | |
{ | |
final ProgressDialog progressDialog = new ProgressDialog(getActivity()); | |
//perform upload action | |
Thread thread = new Thread() | |
{ | |
@Override | |
public void run() { | |
getActivity().runOnUiThread(new Runnable() { |
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
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
</head> | |
<body> | |
<div class="container well"> | |
<h2>Alerts</h2> | |
<hr> | |
{{range $element := .Alerts}} |
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
/* | |
Start Webserver Section | |
*/ | |
type Page struct { | |
Title string | |
Body string | |
Alerts []string | |
} | |
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) { |
OlderNewer