Skip to content

Instantly share code, notes, and snippets.

<?php
$devices = explode("\n", shell_exec("adb devices"));
$pattern = "/([a-zA-Z0-9]+)\s+device/";
$zip = new ZipArchive;
if ($zip->open($argv[1]) === TRUE) {
$zip->extractTo('.', 'AndroidManifest.xml');
$zip->close();
}
@j796160836
j796160836 / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@j796160836
j796160836 / ListInstalledPackeges.sh
Last active June 16, 2019 17:27 — forked from davidnunez/gist:1404789
Get installed packages and convert into command format (Just copy & paste to uninstall whatever packages.)
#!/bin/bash
DEVICE=$1
if [ -z $DEVICE ]; then
DEVICE=`adb devices | sed '/List of devices/d' | head -n 1 | awk '{print $1}'`
fi
if [ -z "$DEVICE" -o "$str" == " " ]; then
echo "Please connect a device."
exit 1
fi
adb -s $DEVICE shell 'pm list packages -f -3' | sed -e 's/.*=//' | sed -e "s/^/adb -s $DEVICE uninstall /" | sort | less
@j796160836
j796160836 / ConnectDebugWear.sh
Last active August 29, 2015 14:12
Use to connect android wear from android phone via bluetooth. Ref: http://developer.android.com/training/wearables/apps/bt-debugging.html
#!/bin/bash
DEVICE=`adb devices | sed '/List of devices/d' | sed '/:4444/d' | sed '/emulator/d' | sed '/vbox86p/d' | head -n 1 | awk '{print $1}'`
if [ "$DEVICE" == "" ]; then
echo "Please conntect devices!"
exit 0
else
echo "Devices: "$DEVICE
fi
adb -s $DEVICE forward tcp:4444 localabstract:/adb-hub; adb connect localhost:4444
@j796160836
j796160836 / ConnectWearEmulator.sh
Created December 31, 2014 07:36
Use to connect android wear with android phone or genymotion
#!/bin/bash
DEVICE=`adb devices -l | sed '/List of devices/d' | sed '/clockwork/d' | head -n 1 | awk '{print $1}'`
adb -s $DEVICE -d forward tcp:5601 tcp:5601
@j796160836
j796160836 / ShowDebugKeyFingerprints.sh
Created January 5, 2015 08:30
Show android debug key's fingerprints. (MD5 / SHA1 / SHA256)
#!/bin/bash
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
@j796160836
j796160836 / GitTweak
Created January 28, 2015 02:24
Copy to your .bash_profile
### Git tweak
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "["${ref#refs/heads/}"] ";
}
function git_since_last_commit {
now=`date +%s`;
last_commit=$(git log --pretty=format:%at -1 2> /dev/null) || return;
@j796160836
j796160836 / KeyboardKeymap.md
Last active August 29, 2015 14:16
Keyboard keymap for presenter software

Keyboard Keymap

Windows

Windows PowerPoint

  • Shift + F5 (Current slide)
  • F5 (From beginning slide)
  • B (Black board)
  • W (White board)
  • Esc (Exit Slideshow)
@j796160836
j796160836 / [筆記] Git 使用教學.md
Last active April 21, 2017 12:26
Git 使用教學
  • 顯示隱藏檔案:
    defaults write com.apple.finder AppleShowAllFiles TRUE;\killall Finder

  • 不顯示隱藏檔案:
    defaults write com.apple.finder AppleShowAllFiles FALSE;\killall Finder