Skip to content

Instantly share code, notes, and snippets.

@skyisle
skyisle / gist:4083319
Created November 16, 2012 02:14
getSecureRawKey
static byte[] getSecureRawKey(String seed) {
/*
* check http://www.motorola.com/sites/motodev/library/using_aes_in_android.html
* for detail information
*/
char[] humanPassphrase = seed.toCharArray();
byte[] salt = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF
}; // must save this!
final int HASH_ITERATIONS = 10000;
@skyisle
skyisle / gist:3870191
Created October 11, 2012 04:37
Force to use overflow menu
try {
// force to use overflow menu
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class
.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception ex) {
@skyisle
skyisle / icloud-ssh
Created February 18, 2012 01:44
Shell script to connect icloud host through ssh
#!/bin/bash
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` hostname"
exit $E_BADARGS
fi
HOSTNAME=$1
DOMAIN=$(echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p')
@skyisle
skyisle / gist:1787141
Created February 10, 2012 06:18
Copy font info
#!/usr/bin/python
import sys
import fontforge
if len(sys.argv) < 3:
print("Usage: %s <from> <to>" % sys.argv[0])
sys.exit(1)
fromfile = sys.argv[1]
#1 - restore working copy of /sd-ext partition from backup
~ # dd if=/sdcard/mmc-good.img of=/dev/block/mmcblk0p2 bs=4096
125000+0 records in
125000+0 records out
512000000 bytes (488.3MB) copied, 109.406085 seconds, 4.5MB/s
#2 - check tune2fs output
~ # tune2fs -l /dev/block/mmcblk0p2