Skip to content

Instantly share code, notes, and snippets.

View abeluck's full-sized avatar

Abel Luck abeluck

View GitHub Profile
@abeluck
abeluck / gpgme-iterating-keys.py
Created July 19, 2012 19:56
Python + gpgme snippets
import gpgme
# Loop through all keys in the default keyring
# Print the key id, the first uid, and all subkeys
# open context, defaults to ~/.gnupg afaik
ctx = gpgme.Context()
for key in ctx.keylist():
# looks like subkeys[0] is the master key
@abeluck
abeluck / adb_kill.py
Created August 9, 2012 20:01 — forked from sschuberth/adb_kill.py
kill a running android process without eclipse
#!/usr/bin/python -O
# Kill a running Android JDWP (debuggable) process without Eclipse.
import sys
import socket
import struct
import uuid
import random
import subprocess
@abeluck
abeluck / eclipse-less android development.md
Created August 9, 2012 22:33
Eclipse-less Android Development

Eclipse-less Android Development

Because eclipse blows at everything except editing Java.

App Deployment

Create a script deploy.sh in your source directory like so:

adb uninstall info.guardianproject.gpg

adb install bin/GnuPrivacyGuard-debug.apk

@abeluck
abeluck / gist:3763841
Created September 21, 2012 20:56
IOCipher copying using file channels
...
FileOutputStream os = null;
java.io.FileInputStream is = null;
try {
os = new FileOutputStream("/test_file");
is = new java.io.FileInputStream(this.getContentResolver().openInputStream(uri));
FileChannel sourceFileChannel = is.getChannel();
@abeluck
abeluck / strace -fF -v
Created November 15, 2012 20:57
tlsdate cert problems
# tlsdate installed with --prefix=$HOME/bin/ins
$ tlsdate -V -v -n -C ~/bin/ins/etc/tlsdate/ca-roots/
V: tlsdate version 0.0.4
V: We were called with the following arguments:
V: validate SSL certificates host = www.ptb.de:443
V: time is currently 1353011888.627536628
V: time is greater than RECENT_COMPILE_DATE
V: using TLSv1_client_method()
V: opening socket to www.ptb.de:443
@abeluck
abeluck / pci-attach.sh
Created December 7, 2012 15:05
Qubes PCI Scripts
#/bin/sh
########
# Attach pci device to vm
#
# usage: pci-attach <domain> <pci-device>
#
# Will attempt to partially match device names, e.g., "1a" -> "0000:00:1a.0"
#
domain=$1
@abeluck
abeluck / gist:5047372
Created February 27, 2013 11:51
Don't lose UID when launching activity with 'am start' on Android 4.2+
/**
* As per https://code.google.com/p/android/issues/detail?id=39801
* on Android 4.2 (+ ?) we need to pass the serial number to "am start"
* in order for the uid not to get lost.
* in your 'am start' line pass --user SERIAL_NUM
*/
private static String getSerialNumber() {
/* We really want to use this code, but it requires bumping up the SDK to 17 so for now
we will use reflection. See https://bugzilla.mozilla.org/show_bug.cgi?id=811763#c11
@abeluck
abeluck / gist:5364967
Created April 11, 2013 16:36
warnings building tlsdate on android
make[2]: Entering directory `/home/user/src/tlsdate-android/external/tlsdate'
CC src/compat/src_compat_libtlsdate_compat_la-clock-linux.lo
CCLD src/compat/libtlsdate_compat.la
CC src/src_tlsdate_routeup-routeup.o
CC src/src_tlsdate_routeup-util.o
CCLD src/tlsdate-routeup
CC src/src_tlsdate-tlsdate.o
CCLD src/tlsdate
CC src/src_tlsdate_helper-tlsdate-helper.o
CC src/src_tlsdate_helper-util.o
@abeluck
abeluck / setup-ant.sh
Last active December 16, 2015 04:08
ant setup script for automated android project builds
#!/bin/sh
projectname=`sed -n 's,.*name="app_name">\(.*\)<.*,\1,p' app/res/values/strings.xml`
echo "Setting up build for $projectname"
echo ""
for f in `find external/ -name project.properties`; do
projectdir=`dirname $f`
echo "Updating ant setup in $projectdir:"
From 0e62582754cd6dcf95e16ff294d762fa88497469 Mon Sep 17 00:00:00 2001
From: Abel Luck <abel@guardianproject.info>
Date: Wed, 24 Apr 2013 20:25:34 +0200
Subject: [PATCH] detect NDK arch on Darwin
---
Makefile.android | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile.android b/Makefile.android