Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.85 KB | None | 0 0
  1. alias ls='ls -a -G'
  2. alias ll='ls -l'
  3.  
  4. # adb commands targeted at specific devices without having to remember the device string
  5. alias adbm='adb -s TA989069LK'
  6. alias adbn='adb -s HT4CTJT01433'
  7. alias adbs='adb -s 1a138b5e'
  8.  
  9. # copy prefs from an xml file to the device, save some of the settings setup work
  10. function cpPrefs {
  11. $(
  12. adb push shared_prefs.xml /sdcard/temp_prefs.xml
  13. cat <<EOF | adb shell
  14. run-as com.myapp.packagename
  15. cat /sdcard/temp_prefs.xml > /data/data/com.myapp.packagename/shared_prefs/com.myapp.packagename_preferences.xml
  16. exit
  17. exit
  18. EOF
  19. )
  20. }
  21.  
  22. # navigate up in directory structure, with less work
  23. function up {
  24. if [ $# -eq 0 ]
  25. then
  26. cd ..
  27. return
  28. fi
  29.  
  30. ret=$PWD
  31. (( numTimes = $1 ))
  32. while [ $numTimes -gt 0 ]
  33. do
  34. ret=$ret'/..'
  35. (( numTimes-- ))
  36. done
  37. cd $ret
  38. }
  39.  
  40. # fb login, call it with a username, the password needs to be "test" though
  41. function fbl {
  42. sendString $1; tab; sendString test; tab; enter
  43. }
  44.  
  45. # don't type stuff on the phone keyboard
  46. function sendString {
  47. #aadb shell input text $1
  48. for i in $* ; do
  49. adb shell input text $i
  50. adb shell input keyevent 62
  51. done
  52. # delete the trailing space you entered!
  53. adb shell input keyevent 4
  54. }
  55.  
  56. # miss with that "up" command? just use `no <new_up_distance>` and your cd - will be correct still
  57. alias no='cd - && up $1'
  58.  
  59. # setup prompt, simple here
  60. export PS1='\w [\#] $ '
  61.  
  62. alias gs='git status'
  63. alias gw='git whatchanged'
  64.  
  65. alias logme='adb logcat -v time *:S TRAVIS:V'
  66. alias logr='adb logcat -v time *:S Retrofit:V'
  67. alias user='aadb shell input text myRealUsername'
  68. alias pass='aadb shell input text myRealPassword'
  69. alias qauser='aadb shell input text realQaUsername'
  70. alias qapass='aadb shell input text realQaPassword'
  71. alias tab='aadb shell input keyevent 61'
  72. alias enter='aadb shell input keyevent 66'
  73. # login commands, must have username focused and not blocked by an autocomplete suggestion for email addresses..
  74. alias login='user;tab;pass;tab;tab;enter'
  75. 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'
  76. 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'
  77. # adb uninstall for my app
  78. alias adbu='aadb uninstall com.myapp.packagename'
  79. alias get='git'
  80. alias gvim='mvim'
  81. # Samsung devices need to calm their logging already, wow
  82. 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'
  83. # same as going to settings and hitting 'clear data' for the different apps
  84. alias clearMyAppData='echo "adb shell pm clear com.myapp.packagename"; adb shell pm clear com.myapp.packagename'
  85. # shortcuts for the clear data commands for the different apps
  86. alias clma='clearMyAppData'
  87. # toggle airplane mode - 2lazy4dat
  88. 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'
  89.  
  90.  
  91. function notes() {
  92. #echo "===============================================" >> ~/notes/notes.txt
  93. #date +"%b %d %Y - %A" >> ~/notes/notes.txt
  94. #echo "===============================================" >> ~/notes/notes.txt
  95. gvim +9999999 ~/notes/notes.txt
  96. }
  97.  
  98. function push() {
  99. git push origin HEAD:refs/publish/$1
  100. }
  101.  
  102. function insL() {
  103. adbu && adb install `ls -1t *.apk | sed -n '1 p'`
  104. }
  105.  
  106. function updL() {
  107. adb install -r `ls -1t *.apk | sed -n '1 p'`
  108. }
  109.  
  110. function rmOrig() {
  111. rm `find . -name '*.orig'`
  112. }
  113.  
  114. function cpRes() {
  115. if [ $# -eq 1 ]; then
  116. for filename in `find . -name '*.png'`; do
  117. destFilename=$1$(echo $filename | sed -e 's/^.\///g')
  118. echo "cp $filename $destFilename"
  119. cp -f $filename $destFilename
  120. echo $?
  121. done
  122. else
  123. echo "USAGE: cpRes <to there>"
  124. fi
  125. }
  126.  
  127. function renameResources() {
  128. if [ $# -eq 2 ]; then
  129. for filename in `echo 'm'; echo 'h'; echo 'xh'; echo 'xxh'; echo 'xxxh'`; do
  130. mv drawable-"$filename"dpi/ drawable-"$filename"dpi/
  131. done
  132. else
  133. echo "USAGE: renameResources old_filename.png new_filename.png (run this from res folder)"
  134. fi
  135. }
  136.  
  137. . ~/.git-completion.bash
  138.  
  139. #export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
  140. export ANDROID_HOME=/Users/thimes/development/sdk
  141.  
  142. #TODO: figure out how to check if it's in the path or not already, but then
  143. export PATH=$PATH:/Users/thimes/bin:$ANDROID_HOME/platform-tools:.:$ANDROID_HOME
  144.  
  145. export PATH=/usr/local/bin:$PATH:/Users/thimes/bin
  146.  
  147. export HISTIGNORE=' *'
  148. export HISTTIMEFORMAT="%h %d %H:%M:%S "
  149. export HISTSIZE=10000
  150. export HISTFILESIZE=10000
  151. export HISTCONTROL=ignorespace:erasedups
  152.  
  153. PROMPT_COMMAND='history -a'
  154.  
  155. shopt -s histappend
  156. shopt -s cmdhist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement