Skip to content

Instantly share code, notes, and snippets.

👻
happy

FrannyZhao

👻
happy
Block or report user

Report or block FrannyZhao

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
@FrannyZhao
FrannyZhao / ubuntu set alternative
Last active Jul 5, 2019
ubuntu set alternative
View ubuntu set alternative
添加2个make版本:
$ sudo update-alternatives --install /usr/bin/make make /usr/bin/make3.81 1010
update-alternatives: using /usr/bin/make3.81 to provide /usr/bin/make (make) in auto mode
$ sudo update-alternatives --install /usr/bin/make make /usr/bin/make4.1 1011
update-alternatives: using /usr/bin/make4.1 to provide /usr/bin/make (make) in auto mode
查看一下是否添加成功:
$ sudo update-alternatives --display make
make - auto mode
View Singleton标准写法
private static volatile TCPMessageHandler instance = null;
public static TCPMessageHandler getInstance() {
if (instance == null) {
synchronized (TCPMessageHandler.class) {
if (instance == null) {
instance = new TCPMessageHandler();
}
}
}
View JNI Sample
$ cat src/com/franny/test/HelloWorld.java
package com.franny.test;
public class HelloWorld {
public native int doubleHelloWorld(int num); //申明一个native方法
static{
System.loadLibrary("HelloWorldImpl"); //装入动态链接库,"HelloWorldImpl"是装入动态链接库的名称
}
View android enable su in source code
zhaofengyi@moosgod-MS-7B10:~/mtkz300/system/core$ git diff
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index cc96ff8..8f44691 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -166,7 +166,7 @@ static const struct fs_path_config android_files[] = {
// the following two files are INTENTIONALLY set-uid, but they
// are NOT included on user builds.
{ 06755, AID_ROOT, AID_ROOT, 0, "system/xbin/procmem" },
- { 04750, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },
View Andoid打开系统自带应用
Intent intent1= new Intent("android.intent.action.MAIN", null);
intent1.addCategory("android.intent.category.APP_GALLERY");
Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/internal/images/media"));
// 两种办法都可以
mGallery.setOnClickListener(v -> startActivity(intent1));
View Android Handler
private final UIHandler uiHandler = new UIHandler(this);
static class UIHandler extends Handler {
private final WeakReference<DashboardFragment> mFragment;
private static final int MSG_SHOW_MASK = 1;
private static final int MSG_HIDE_MASK = 2;
private UIHandler(DashboardFragment fragment) {
mFragment = new WeakReference<>(fragment);
}
View android customize mouse cursor
/frameworks/base/core/res/res/drawable/pointer_arrow_icon.xml
./drawable-xxhdpi/pointer_arrow.png
./drawable-mdpi/pointer_arrow.png
./drawable-mdpi/pointer_arrow_large.png
./drawable-xhdpi/pointer_arrow.png
./drawable-xhdpi/pointer_arrow_large.png
./drawable/pointer_arrow_large_icon.xml
./drawable/pointer_arrow_icon.xml
./drawable-hdpi/pointer_arrow.png
View git alias
git config --global alias.co checkout
git config --global alias.st status
git config --global alias.br branch
git config --global alias.f fetch
git config --global alias.cp cherry-pick
git config --global alias.rh 'reset --hard'
git config --global alias.l1 'log -1'
git config --global alias.rbm 'rebase origin/master'
@FrannyZhao
FrannyZhao / 0_reuse_code.js
Created May 24, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.