Skip to content

Instantly share code, notes, and snippets.

View martinth's full-sized avatar

Martin Thurau martinth

View GitHub Profile
@martinth
martinth / simple_server.py
Created January 25, 2012 12:50
simple HTTP server that dumps header
import SimpleHTTPServer
import SocketServer
class H(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
print self.headers
httpd = SocketServer.TCPServer(("", 8090), H)
httpd.server_forever()
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.awt.AWTException;
public class KeyPresser {
public static void main(String[] args) {
int delay = 0;
try {
@martinth
martinth / sign-and-align.sh
Created April 10, 2014 07:30
A simple script to automate signing and aligning of APK files for upload to the Playstore
#!/bin/sh
FOLDER=android/bin
IN_APK_NAME=App-release-unsigned.apk
OUT_APK_NAME=App-release-signed-aligned.apk
KEYSTORE=release-key.keystore
KEYSTORE_ALIAS=app_release
echo ">>> Signing $OUT_APK_NAME..."
@martinth
martinth / argparse_fileinput_demo.py
Created August 6, 2015 11:04
Read from stdin or files in Python (combining argparse and fileinput)
import argpase
import fileinput
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('--dummy', help='dummy argument')
parser.add_argument('files', metavar='FILE', nargs='*', help='files to read, if empty, stdin is used')
args = parser.parse_args()
# If you would call fileinput.input() without files it would try to process all arguments.