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 | |
from datetime import date, datetime | |
def log_battery_status(droid): | |
"""Log battery percentage""" | |
droid.batteryStartMonitoring() | |
battery = 0 | |
while not battery: | |
battery = droid.batteryGetLevel().result |
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 sample lets you record and share video with Appcelerator Titanium on Android. | |
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK | |
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html | |
*/ | |
/** | |
* First, create our UI. We'll have two buttons: record, and share. | |
*/ | |
var win = Titanium.UI.createWindow({ |
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
MediaRecorder mediaRecorder = new MediaRecorder(); | |
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH); | |
profile.videoFrameWidth = 1280; | |
profile.videoFrameHeight = 720; | |
mediaRecorder.setCamera(Camera.open()); | |
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); | |
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); | |
mediaRecorder.setProfile(profile); |
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 | |
import socket,time,string,random,thread | |
m_Vars = { | |
"bufLen" : 1024 * 10, | |
"defaultServerIp" : "192.168.1.100", | |
"defaultServerPort" : 554, | |
"defaultTestUrl" : "rtsp://192.168.1.100/test1.mp4", | |
"defaultUserAgent" : "LibVLC/2.0.3 (LIVE555 Streaming Media v2011.12.23)" |
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 | |
import nmap | |
# python-nmap url : http://xael.org/norman/python/python-nmap/python-nmap-0.1.4.tar.gz | |
nm = nmap.PortScanner() | |
nm.scan(hosts='192.168.1.0/24', arguments='-n -p 161 -sU ') | |
hosts_list = [(x, nm[x][u'udp'][161]['state']) for x in nm.all_hosts()] | |
#print nm.all_hosts() | |
#print nm[u'192.168.1.100'][u'udp'][161]['state'] |
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 | |
# a simple udp server | |
import socket, traceback | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
s.bind(("127.0.0.1",12345)) | |
while 1: | |
try: |
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 | |
# a simple tcp server | |
import socket,os | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.bind(('127.0.0.1', 12345)) | |
sock.listen(5) | |
while True: | |
connection,address = sock.accept() | |
buf = connection.recv(1024) | |
print buf |
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 | |
# a simple udp client | |
import socket,time,traceback | |
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
dstHost = ('192.168.1.100', 12345) | |
while True: | |
try: | |
client.sendto('3',dstHost) | |
print time.time(),' : send success' |
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 | |
# a simple tcp client | |
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(('127.0.0.1', 12345)) | |
#sock.send('Test\n') | |
sock.send(raw_input("Please input : ")) | |
print sock.recv(1024) | |
sock.close() |
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
/* | |
* Copyright (c) 2014 by Bart Kiers | |
* | |
* Permission is hereby granted, free of charge, to any person | |
* obtaining a copy of this software and associated documentation | |
* files (the "Software"), to deal in the Software without | |
* restriction, including without limitation the rights to use, | |
* copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the | |
* Software is furnished to do so, subject to the following |
OlderNewer