Skip to content

Instantly share code, notes, and snippets.

@yenliangl
yenliangl / http_get.sh
Created February 12, 2014 16:48
Send HTTP GET request to a WEB server through wget
wget -S -O - http://this/is/a/url
@yenliangl
yenliangl / create_mavericks_install_falsh_drive.sh
Created February 15, 2014 17:15
Create install flash drive for MacOSX Mavericks
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
package your_package;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
@yenliangl
yenliangl / gist:4d42e4a18369ae5b71a4
Created January 10, 2015 08:22
How to use repo to smart switch different branch
Use repo to intitalize different branches
$ mkdir /repos/aosp-1.6_r1
$ cd /repos/aosp-1.6_r1
$ repo init -b android-1.6_r1 -u https://android.googlesource.com/platform/manifest --reference=/repos/aosp-main
$ repo sync
Switch to another branch
$ mkdir /repos/aosp-1.6_r2
@yenliangl
yenliangl / gist:2dca5efbaa3a065a88b8
Created March 12, 2015 03:45
Reverse page order of PDF using PDFTK
# Assume in.pdf has 100 pages
pdftk in.pdf cat 100-1 output out.pdf
@yenliangl
yenliangl / zigzag_encoding32.cc
Last active August 29, 2015 14:24
zigzag encoding (32bits)
#include <cstdio>
#include <iostream>
#include <bitset>
#include <cstring>
#include <limits>
int main(int argc, char** argv)
{
const int n = atoi(argv[1]);
@yenliangl
yenliangl / Font smoothing settings in Snow Leopard
Last active September 5, 2015 22:25
Tune font smoothing of Snow Leopard in command line
# Open Terminal and enter,
# Replace 2 with a number between 0 and 3.
# 0: Light
# 1: Standard
# 2: Medium
# 3: Bold
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
@yenliangl
yenliangl / See if an application is installed
Created August 31, 2010 15:54
How to check if an application is installed in Android system
// If no resource for the given package exists, this package is not installed in the phone
try {
mGenieResources = getPackageManager().getResourcesForApplication(GENIE_PACKAGE_ID);
} catch (PackageManager.NameNotFoundException e) {
// no weather info available
Log.w(LOG_TAG, "Can't find "+GENIE_PACKAGE_ID+". Weather forecast will not be available.");
}
@yenliangl
yenliangl / fsnod
Created August 31, 2010 15:57
Build specified package and transfer to connected emulator/device
# build specified package and transfer it to the connected emulator/device.
function fsnod {
mmm -j6 frameworks/base frameworks/base/core/res snod
adb shell stop
adb sync
adb shell start
}