Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias ls='ls -a -G'
- alias ll='ls -l'
- # adb commands targeted at specific devices without having to remember the device string
- alias adbm='adb -s TA989069LK'
- alias adbn='adb -s HT4CTJT01433'
- alias adbs='adb -s 1a138b5e'
- # copy prefs from an xml file to the device, save some of the settings setup work
- function cpPrefs {
- $(
- adb push shared_prefs.xml /sdcard/temp_prefs.xml
- cat <<EOF | adb shell
- run-as com.myapp.packagename
- cat /sdcard/temp_prefs.xml > /data/data/com.myapp.packagename/shared_prefs/com.myapp.packagename_preferences.xml
- exit
- exit
- EOF
- )
- }
- # navigate up in directory structure, with less work
- function up {
- if [ $# -eq 0 ]
- then
- cd ..
- return
- fi
- ret=$PWD
- (( numTimes = $1 ))
- while [ $numTimes -gt 0 ]
- do
- ret=$ret'/..'
- (( numTimes-- ))
- done
- cd $ret
- }
- # fb login, call it with a username, the password needs to be "test" though
- function fbl {
- sendString $1; tab; sendString test; tab; enter
- }
- # don't type stuff on the phone keyboard
- function sendString {
- #aadb shell input text $1
- for i in $* ; do
- adb shell input text $i
- adb shell input keyevent 62
- done
- # delete the trailing space you entered!
- adb shell input keyevent 4
- }
- # miss with that "up" command? just use `no <new_up_distance>` and your cd - will be correct still
- alias no='cd - && up $1'
- # setup prompt, simple here
- export PS1='\w [\#] $ '
- alias gs='git status'
- alias gw='git whatchanged'
- alias logme='adb logcat -v time *:S TRAVIS:V'
- alias logr='adb logcat -v time *:S Retrofit:V'
- alias user='aadb shell input text myRealUsername'
- alias pass='aadb shell input text myRealPassword'
- alias qauser='aadb shell input text realQaUsername'
- alias qapass='aadb shell input text realQaPassword'
- alias tab='aadb shell input keyevent 61'
- alias enter='aadb shell input keyevent 66'
- # login commands, must have username focused and not blocked by an autocomplete suggestion for email addresses..
- alias login='user;tab;pass;tab;tab;enter'
- alias loginm='adbm shell input text myRealUsername; adbm shell input keyevent 61; adbm shell input text myRealPassword; adbm shell input keyevent 61; adbm shell input keyevent 66'
- alias loginn='adbn shell input text myRealUsername; adbn shell input keyevent 61; adbn shell input text myRealPassword; adbn shell input keyevent 61; adbn shell input keyevent 66'
- # adb uninstall for my app
- alias adbu='aadb uninstall com.myapp.packagename'
- alias get='git'
- alias gvim='mvim'
- # Samsung devices need to calm their logging already, wow
- alias quietLogs='adb logcat -v time STATUSBAR-NetworkController:S STATUSBAR-SignalClusterView:S LockPatternUtils:S STATUSBAR-BatteryController:S STATUSBAR-Clock:S STATUSBAR-StatusBarManagerService:S KeybuardViewMediator:S BatteryService:S'
- # same as going to settings and hitting 'clear data' for the different apps
- alias clearMyAppData='echo "adb shell pm clear com.myapp.packagename"; adb shell pm clear com.myapp.packagename'
- # shortcuts for the clear data commands for the different apps
- alias clma='clearMyAppData'
- # toggle airplane mode - 2lazy4dat
- alias airplane='adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS ; adb shell input keyevent 19 ; adb shell input keyevent 23 ; adb shell input keyevent 4'
- function notes() {
- #echo "===============================================" >> ~/notes/notes.txt
- #date +"%b %d %Y - %A" >> ~/notes/notes.txt
- #echo "===============================================" >> ~/notes/notes.txt
- gvim +9999999 ~/notes/notes.txt
- }
- function push() {
- git push origin HEAD:refs/publish/$1
- }
- function insL() {
- adbu && adb install `ls -1t *.apk | sed -n '1 p'`
- }
- function updL() {
- adb install -r `ls -1t *.apk | sed -n '1 p'`
- }
- function rmOrig() {
- rm `find . -name '*.orig'`
- }
- function cpRes() {
- if [ $# -eq 1 ]; then
- for filename in `find . -name '*.png'`; do
- destFilename=$1$(echo $filename | sed -e 's/^.\///g')
- echo "cp $filename $destFilename"
- cp -f $filename $destFilename
- echo $?
- done
- else
- echo "USAGE: cpRes <to there>"
- fi
- }
- function renameResources() {
- if [ $# -eq 2 ]; then
- for filename in `echo 'm'; echo 'h'; echo 'xh'; echo 'xxh'; echo 'xxxh'`; do
- mv drawable-"$filename"dpi/ drawable-"$filename"dpi/
- done
- else
- echo "USAGE: renameResources old_filename.png new_filename.png (run this from res folder)"
- fi
- }
- . ~/.git-completion.bash
- #export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
- export ANDROID_HOME=/Users/thimes/development/sdk
- #TODO: figure out how to check if it's in the path or not already, but then
- export PATH=$PATH:/Users/thimes/bin:$ANDROID_HOME/platform-tools:.:$ANDROID_HOME
- export PATH=/usr/local/bin:$PATH:/Users/thimes/bin
- export HISTIGNORE=' *'
- export HISTTIMEFORMAT="%h %d %H:%M:%S "
- export HISTSIZE=10000
- export HISTFILESIZE=10000
- export HISTCONTROL=ignorespace:erasedups
- PROMPT_COMMAND='history -a'
- shopt -s histappend
- shopt -s cmdhist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement