Skip to content

Instantly share code, notes, and snippets.

Fanglin Chen finleyChen

Block or report user

Report or block finleyChen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
private void cropImage() {
// Use existing crop activity.
Intent intent = new Intent("");
intent.setDataAndType(mImageCaptureUri, IMAGE_UNSPECIFIED);
// Specify image size
intent.putExtra("outputX", 100);
intent.putExtra("outputY", 100);
// Specify aspect ratio, 1:1
finleyChen /
Created Apr 2, 2013
save user input in sharedPreference
private void saveUserData() {
Log.d(TAG, "saveUserData()");
// Getting the shared preferences editor
String mKey = getString(R.string.preference_name);
SharedPreferences mPrefs = getSharedPreferences(mKey, MODE_PRIVATE);
finleyChen /
Created Apr 1, 2013
load the user data from shared preferences. If there is no data make sure that we set it to something reasonable.
private void loadUserData() {
// We can also use log.d to print to the LogCat
Log.d(TAG, "loadUserData()");
// Load and update all profile views
// Get the shared preferences - create or retrieve the activity
View gist:5068106
osw=new OutputStreamWriter(fOut);
BufferedWriter fbw = new BufferedWriter(osw);
try {
fbw.write(" "+String.valueOf(System.currentTimeMillis()));
} catch (IOException e) {
// TODO Auto-generated catch block
finleyChen /
Created Nov 24, 2012
python implementation to rename in batch
import glob, os
def rename(dir, pattern):
for pathAndFilename in glob.iglob(os.path.join(dir, pattern)):
title, ext = os.path.splitext(os.path.basename(pathAndFilename))
os.rename(pathAndFilename, os.path.join(dir, str(i) + '.png'))
rename(r'/svm/andrew/open', r'*.png')
You can’t perform that action at this time.