Last active
December 22, 2015 00:49
-
-
Save ronshapiro/6392476 to your computer and use it in GitHub Desktop.
Some convenience aliases/functions for interfacing with adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# easily parse Logcat output | |
alog () { | |
parser=ack | |
if [[ -e `which ack` ]]; then | |
parser=grep | |
fi | |
if (( $# == 0 )); then | |
adb logcat -v time | |
elif [[ $1 == "runtime" ]]; then | |
pattern='E/AndroidRuntime' | |
adb logcat -v time | $parser --ignore-case $pattern | |
else | |
adb logcat -v time | $parser --ignore-case $@ | |
fi | |
} | |
# take an android screenshot, adapted off alias from http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html | |
ascreen(){ | |
_file="android_screenshot-`date +"%m_%d_%y-%H_%M_%S"`" | |
_dir="$HOME/Desktop" | |
target=$_dir/$_file.png | |
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > $target | |
opened_already="no" | |
uploaded_already="no" | |
for arg in "$@"; do | |
[[ $uploaded_already == "no" && ($arg == "upload" || $arg == "up") ]] && \ | |
uploaded_already="yes" && \ | |
cloudapp $target | |
[[ $opened_already == "no" && $arg == "open" ]] && \ | |
opened_already="yes" && \ | |
open $target | |
done | |
} | |
# alias to send broadcasted events to a device | |
alias broadcast="adb shell am broadcast" | |
alias genymotionshell="/Applications/Genymotion\ Shell.app/Contents/MacOS/genyshell ; exit;" | |
alias pidcat="~/code/open-source/pidcat/pidcat.py --color-gc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment