Skip to content

Instantly share code, notes, and snippets.

Before you begin

Make sure you have adb installed and that it works. Test this by connecting your phone and running adb devices. In order to proceed past the build stage, your device must be rooted. The device I used is running Cyanogenmod with root enabled for both apps and adb.

Build

Fetch the Android NDK

You'll need to get the Android NDK. I used r8e, which you can get from here: http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2. Make sure you get the x86 version, as the x86_64 version will not help you. Let's call the path where you unpack this NDK_PATH.

@psema4
psema4 / minidb
Created November 14, 2013 17:02
A simple utility to read all .sql files in the current directory, create an in-memory database from them and start a sqlite3 shell
#!/usr/bin/env bash
# A simple utility to read all .sql files in the current directory, create an
# in-memory database from them and start a sqlite3 shell
if [ -f mini.db ]; then
echo "found existing database, removing"
rm mini.db;
fi
@psema4
psema4 / gist:5365829
Created April 11, 2013 18:17
ES6 Classes Polyfill (via public-webapps, A Wirfs-Brock)
// ES6
class Sub extends Super {
constructor() {/*constructor body */ }
method1 () {}
static method2 {}
}
// ES3/5
function Sub() {/*constructor body */ }
Sub.__proto__ = Super;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>
MobileSafari Live Click Bug
</title>
<script src='http://code.jquery.com/jquery-git.js' type='text/javascript'></script>
<script src='http://media.lib.byu.edu/js/jquery/plugins/jquery.livequery-1.0.3.js' type='text/javascript'></script>
</head>
<body style='font-family: Helvetica;'>
@psema4
psema4 / JSONSimple.pm
Created July 5, 2011 18:55
Braindead JSON encoder/decoder for Perl
package JSONSimple;
use strict;
sub new {
my $class = shift;
my $self = {};
bless($self, $class);
return $self;
}
@psema4
psema4 / server.js
Created July 4, 2011 21:47
A Static Web Server in Node.js with simple Access Control
#!/usr/bin/env node
var http = require('http'),
url = require('url'),
fs = require('fs'),
util = require('util'),
host = '127.0.0.1',
port = 8080,
useBAC = true,
# wget --header='Accept-Encoding: gzip' -O root.bin.gz http://bellard.org/jslinux/root.bin
# gunzip root.bin.gz
# mkdir mnt
# mkdir files
# sudo mount -t ext2 -o loop root.bin mnt
# dd if=/dev/zero of=files/root.bin bs=1k count=4096
# sudo mke2fs -m 0 -i 2000 files/root.bin
# mkdir mnt2
# sudo mount -t ext2 -o loop files/root.bin mnt2
# sudo cp -dpR mnt/* mnt2/
@psema4
psema4 / bookmarklet.js
Created June 11, 2011 20:18 — forked from kn0ll/bookmarklet.js
advanced bookmarklet template
javascript:(function() {
if(!window.your_bookmarklet) {
var doc = document,
js = doc.createElement('script');
js.type = 'text/javascript';
js.src = 'loader.js';
js.async = true;
@psema4
psema4 / table-update-notifications.js
Created June 9, 2011 16:08
Notifications of dynamic changes to HTML tables
<script>
// Inspired by http://stackoverflow.com/questions/6293495/
myTable = document.getElementsByTagName('table')[0];
if (document.implementation.hasFeature('MutationEvents','2.0')
|| window.MutationEvent) {
myTable.addEventListener('DOMNodeInserted', function(e) {
@psema4
psema4 / altermeta.html
Created May 27, 2011 14:54
Altering Metatags With JS
<!doctype html>
<html lang="en">
<head>
<title>Altering Metatags At Runtime</title>
<meta id="meta-test" name="Copyright" content="(C)2011 Some User" />
</head>
<body>
<h1>Altering Metatags At Runtime</h1>
<p id="output">(Click "Check Metatag")</p>