Skip to content

Instantly share code, notes, and snippets.

@Tanapruk
Created November 5, 2016 08:10
Show Gist options
  • Save Tanapruk/23d28e4fcf8c5b647ed28fca3ca5eb89 to your computer and use it in GitHub Desktop.
Save Tanapruk/23d28e4fcf8c5b647ed28fca3ca5eb89 to your computer and use it in GitHub Desktop.
My Personal bash script as an Android Developer
#export path for android
export ANDROID_HOME=/Users/username/Documents/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tool
#to capture screen from android phone
function cap() {
LOCATIONPHONE=sdcard/screen_$(date "+%Y%m%d%H%M%S").png
LOCATIONPC=~/Downloads/
adb shell screencap -p $LOCATIONPHONE
adb pull -p $LOCATIONPHONE $LOCATIONPC
adb shell rm $LOCATIONPHONE
echo pulling data from $LOCATIONPHONE and save at $LOCATIONPC
}
#switch off/on WiFi
function wi() {
networksetup -setairportpower en0 off && networksetup -setairportpower en0 on
}
#Restart adb connection
function restartadb() {
adb start-server
echo "[$(date)] adb started"
echo "[$(date)] adb is broken, restarting"
adb kill-server
adb start-server || adb start-server
adb reverse tcp:8081 tcp:8081
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment