Skip to content

Instantly share code, notes, and snippets.

View xianminx's full-sized avatar
🏠
Working from home

xianminx

🏠
Working from home
View GitHub Profile
@xianminx
xianminx / gist:4042969
Created November 9, 2012 00:45
com.intotherain.face.smali.string
$ grep 'const-string' -r ./
.//smali/com/a/a/a.smali: const-string v0, ""
.//smali/com/a/a/a.smali: const-string v0, ""
.//smali/com/a/a/a.smali: const-string v1, "MobclickAgent"
.//smali/com/a/a/a.smali: const-string v0, "version"
@xianminx
xianminx / gist:4192339
Created December 3, 2012 03:03
getInstallerPackageName returns null
We couldn’t find that file to show.
@xianminx
xianminx / wandoujia_error_log
Created December 3, 2012 03:15
wandoujia error Log
12-03 11:11:35.644: D/dalvikvm(2549): GC_CONCURRENT freed 141K, 3% free 8264K/8455K, paused 18ms+0ms, total 20ms
12-03 11:11:35.644: I/ActivityThread(2549): Pub com.wandoujia.thumbnail;com.wandoujia.imagecache: com.wandoujia.phoenix2.providers.ThumbProvider
12-03 11:11:35.644: I/ActivityThread(2549): Pub com.wandoujia.suggestion: com.wandoujia.phoenix2.providers.SearchSuggestionProvider
12-03 11:11:35.644: I/ActivityThread(2549): Pub com.wandoujia.app;com.wandoujia.image;com.wandoujia.photosync;com.wandoujia.share;com.wandoujia.sync: com.wandoujia.phoenix2.providers.PhoenixProvider
12-03 11:11:35.654: I/ActivityThread(2549): Pub com.wandoujia.download: com.wandoujia.download.DownloadProvider
12-03 11:11:35.654: W/System.err(2549): java.lang.UnsatisfiedLinkError: Couldn't load udid: findLibrary returned null
12-03 11:11:35.654: W/System.err(2549): at java.lang.Runtime.loadLibrary(Runtime.java:365)
12-03 11:11:35.654: W/System.err(2549): at java.lang.System.loadLibrary(System.java:535)

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@xianminx
xianminx / android_dependency_confict
Created April 8, 2013 03:15
Android project dependency conflict
[2013-04-08 11:13:01 - umeng-sdk-example] Found 2 versions of android-support-v4.jar in the dependency list,
[2013-04-08 11:13:01 - umeng-sdk-example] but not all the versions are identical (check is based on SHA-1 only at this time).
[2013-04-08 11:13:01 - umeng-sdk-example] All versions of the libraries must be the same at this time.
[2013-04-08 11:13:01 - umeng-sdk-example] Versions found are:
[2013-04-08 11:13:01 - umeng-sdk-example] Path: /Users/lucas/dev/umeng/umeng-sdk/libs/android-support-v4.jar
[2013-04-08 11:13:01 - umeng-sdk-example] Length: 393154
[2013-04-08 11:13:01 - umeng-sdk-example] SHA-1: 307c1cc532eabbf1d135b43e5c983c9da700449d
[2013-04-08 11:13:01 - umeng-sdk-example] Path: /Users/lucas/dev/umeng/umeng-sdk/example/libs/android-support-v4.jar
[2013-04-08 11:13:01 - umeng-sdk-example] Length: 247894
[2013-04-08 11:13:01 - umeng-sdk-example] SHA-1: 7329492e76650ee661f6af7704b0c79151d8e1ef
public class WorkOut{
public static void main(String[] args){
workHard();
System.out.println("It's nap time.");
}
private static void workHard(){
try{
workHard();
}finally{
@xianminx
xianminx / MainActivity.java
Created July 30, 2013 06:37
update app shortcut icon on android desktop
package com.example.dynamicappicon;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
String base_string = "This is a test string";
String key = "testKey";
try {
Mac mac = Mac.getInstance("HmacSHA1");
SecretKeySpec secret = new SecretKeySpec(key.getBytes("UTF-8"), mac.getAlgorithm());
mac.init(secret);
byte[] digest = mac.doFinal(base_string.getBytes());
String enc = new String(digest);