Skip to content

Instantly share code, notes, and snippets.

@geekman
geekman / scrape_mrt.py
Created June 5, 2012 14:45
scrapes MRT information from sgwiki.com for Farebot
#!/usr/bin/python
#
# scrapes MRT information from sgwiki.com for FareBot
# outputs Java statements to be copied & pasted into EZLinkTransitData.java
#
import urllib, urllib2
import re
WIKI_URL = 'http://sgwiki.com/index.php?'
@geekman
geekman / arm_asm
Created June 7, 2012 09:53
assembles short ARM instructions
#!/bin/sh
#
# assembles a short ARM assembly file/line and shows the opcode + disassembly
# useful for compiling one-liners into opcode
#
# usage:
# arm_asm src-file.S -> assembles src-file.S
# echo "mov r1, r4" | arm_asm -> assemble a single instruction
#
@geekman
geekman / af-test.tex
Last active December 10, 2015 18:08
Wall-of-text AF focus test
%
% random focus patterns in a text wall
% the pattern contains black bars for the AF system to pickup
% and the surrounding text helps you determine the area of focus
%
\documentclass[a4paper,12pt]{report}
\usepackage[margin=0.8in]{geometry}
\usepackage{hyperref}
\usepackage{color}
@geekman
geekman / hexdump.java
Created March 26, 2013 06:31
simple hex dump in Java
public static String hexdump(byte[] data) {
final int perRow = 16;
final String hexChars = "0123456789ABCDEF";
StringBuilder dump = new StringBuilder();
StringBuilder chars = null;
for (int i = 0; i < data.length; i++) {
int offset = i % perRow;
if (offset == 0) {
chars = new StringBuilder();
@geekman
geekman / README.md
Created September 27, 2013 16:13
decodes TPI opcodes

Given a stream of TPI opcodes, translates it into its human-readable form:

C:\> decode_tpi.py
 [ 72 ] [ 00 ]
 [ F3 00 ] [ ]
 [ 68 C0 ] [ ]
 [ 69 3F ] [ ]
 [ 24 ] [ 1E ]
 [ 24 ] [ 90 ]
@geekman
geekman / signapk.bat
Created October 2, 2013 10:18
signs an APK with the debug key
@echo off
:
: signapk.bat
: signs an APK with the debug key
:
setlocal
if [%1]==[] goto end
@geekman
geekman / gist:8098129
Created December 23, 2013 14:34
asusware script
#!/bin/sh
# ASUS app autorun script
# $1: device name, $2: mounted path.
# wait for everything to be up first
i=0
while [ $i -le 20 ]; do
success_start_service=`nvram get success_start_service`
if [ "$success_start_service" == "1" ]; then
@geekman
geekman / compile-idevice.sh
Last active August 22, 2016 03:52
compile libimobiledevice
sudo yum install -y \
autoconf automake libtool pkgconfig \
lib{xml2,usb1}-devel gnutls-devel libgcrypt-devel python-devel gcc-c++
# add user for usbmux daemon
sudo useradd --system usbmux
# installed in /usr/local/
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
@geekman
geekman / image_renamer.py
Created February 25, 2014 15:48
image files renamer
#!/usr/bin/python
#
# renames a directory of files with their image extension
# currently works with only JPEG and PNG files
#
# 2014.02.25 darell tan
#
import os
import sys
@geekman
geekman / urls.txt
Created May 19, 2014 11:04
stackoverflow error cat imgs
http://cdn.sstatic.net/img/error-cats/159762931.jpg
http://cdn.sstatic.net/img/error-cats/226603842.jpg
http://cdn.sstatic.net/img/error-cats/287477922.jpg
http://cdn.sstatic.net/img/error-cats/322899972.jpg
http://cdn.sstatic.net/img/error-cats/365705759.jpg
http://cdn.sstatic.net/img/error-cats/371419778.jpg
http://cdn.sstatic.net/img/error-cats/375440801.jpg
http://cdn.sstatic.net/img/error-cats/381472803.jpg
http://cdn.sstatic.net/img/error-cats/385604943.jpg
http://cdn.sstatic.net/img/error-cats/457516628.jpg