Advertisement
Guest User

Untitled

a guest
May 21st, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.56 KB | None | 0 0
  1. #-----------------------------------------------------------------------------------------------------------------------#
  2. # Author: Erik Zephyr
  3. # Description: File used to hold Bash configuration, aliases, functions, completions, etc...
  4. #
  5. # Sections:
  6. # 1. ENVIRONMENT SETUP
  7. # 2. MAKE TERMINAL BETTER
  8. # 3. FOLDER MANAGEMENT
  9. # 4. MISC ALIAS'
  10. # 5. GIT SHORTCUTS
  11. # 6. OS X COMMANDS
  12. #
  13. #-----------------------------------------------------------------------------------------------------------------------
  14.  
  15.  
  16. #-----------------------------------------------------------------------------------------------------------------------# 1. ENVIRONMENT SETUP
  17. #-----------------------------------------------------------------------------------------------------------------------
  18.  
  19. # DigitalOcean
  20. export DIGITALOCEAN_ACCESS_TOKEN='xxx'
  21.  
  22. # Github
  23. export GITHUB_TOKEN='xxx'
  24.  
  25. # Set default editor
  26. export EDITOR=code
  27.  
  28. #-----------------------------------------------------------------------------------------------------------------------
  29. # 2. MAKE TERMINAL BETTER
  30. #-----------------------------------------------------------------------------------------------------------------------
  31.  
  32. alias loadbash='source ~/.bash_profile' # Load bash profile
  33. alias edithosts='code /etc/hosts' # Edit hosts file
  34. alias editbash='code ~/.bash_profile' # Edit bash profile
  35. alias editsshconfig='code ~/.ssh/config' # Edit ssh config file
  36.  
  37. alias ..='cd ../' # Go back 1 directory level
  38. alias ...='cd ../../' # Go back 2 directory levels
  39. alias .3='cd ../../../' # Go back 3 directory levels
  40. alias .4='cd ../../../../' # Go back 4 directory levels
  41. alias .5='cd ../../../../../' # Go back 5 directory levels
  42. alias .6='cd ../../../../../../'
  43.  
  44. #-----------------------------------------------------------------------------------------------------------------------# 3. FOLDER MANAGEMENT
  45. #-----------------------------------------------------------------------------------------------------------------------
  46.  
  47. mktar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; } # Creates a *.tar.gz archive of a file or folder
  48. mkzip() { zip -r "${1%%/}.zip" "$1" ; } # Create a *.zip archive of a file or folder
  49.  
  50. #-----------------------------------------------------------------------------------------------------------------------
  51. # 4. MISC ALIAS'
  52. #-----------------------------------------------------------------------------------------------------------------------
  53.  
  54. # Homebrew
  55. alias brewup='brew update && brew upgrade && brew cleanup'
  56. alias brewup-cask='brew update && brew upgrade && brew cleanup && brew cask outdated | awk "{print $1}" | xargs brew cask reinstall && brew cask cleanup'
  57.  
  58. # Copy local files to a remote server
  59. dir-to-remote() { rsync -avz . $1; }
  60.  
  61. # npm
  62. alias nrs='npm run start'
  63. alias nrd='npm run dev'
  64. alias nrb='npm run build'
  65. alias ni='npm install'
  66.  
  67. # Homebrew
  68. alias bci='brew cask install'
  69. alias bcun='brew cask uninstall'
  70. alias bcre='brew cask reinstall'
  71. alias bs="brew search"
  72.  
  73. # Run last command with sudo
  74. alias fuck='sudo $(fc -ln -1)'
  75.  
  76. # Switching shells
  77. alias shell-to-zsh='chsh -s $(which zsh)'
  78. alias shell-to-bash='chsh -s $(which bash)'
  79.  
  80. #-----------------------------------------------------------------------------------------------------------------------
  81. # 5. GIT SHORTCUTS
  82. #-----------------------------------------------------------------------------------------------------------------------
  83.  
  84. alias gs='git status'
  85. alias ga='git add .'
  86. alias unstage='git reset --'
  87. alias gc='git commit -m'
  88.  
  89. #Β COMMIT TEMPLATES
  90. show_options() {
  91. clear
  92. echo "~~~~~~~~~~~~~~~~~~~~~"
  93. echo " M A I N - M E N U"
  94. echo "~~~~~~~~~~~~~~~~~~~~~"
  95. echo "1. Initial commit πŸŽ‰"
  96. echo "2. Version πŸ”–"
  97. echo "3. New feature ✨"
  98. echo "4. Bug fix πŸ›"
  99. echo "5. Changes to project documentation πŸ“š"
  100. echo "6. Changes to code documentation πŸ’‘"
  101. echo "7. Perfomance improvement 🐎"
  102. echo "8. Tests 🚨"
  103. echo "9. Adding a Test βœ…"
  104. echo "10. Test passing βœ”οΈ"
  105. echo "11. General update ⚑️"
  106. echo "12. Refactoring code πŸ”¨"
  107. echo "13. Removing code/files πŸ”₯"
  108. echo "14. Continuous Integration πŸ’š"
  109. echo "15. Security improvement πŸ”’"
  110. echo "16. Adding CI build system πŸ‘·"
  111. echo "17. Upgrading dependencies ⬆️"
  112. echo "18. Downgrading dependencies ⬇️"
  113. echo "19. Adding dependencies βž•"
  114. echo "20. Removing dependencies βž–"
  115. echo "21. Styling code πŸ’…"
  116. echo "22. Critical hotfix πŸš‘"
  117. echo "23. Deploying stuff πŸš€"
  118. echo "24. Fixing on MacOS 🍎"
  119. echo "25. Fixing on Linux 🐧"
  120. echo "26. Fixing on Windows πŸ–Ό"
  121. echo "27. Docker 🐳"
  122. echo "28. Configuration files πŸ”§"
  123. echo "29. Bad code / need improvement πŸ’©"
  124. echo "30. Useless changes 🍺"
  125. echo "31. Exit ❌"
  126. }
  127. read_options(){
  128. local choice
  129. echo "Desired option: "
  130. read choice
  131. echo "Desired message: "
  132. read msg
  133. case $choice in
  134. 1) tada $msg;;
  135. 2) versiontag $msg;;
  136. 3) newfeature $msg;;
  137. 4) bugfix $msg;;
  138. 5) projectdocu $msg;;
  139. 6) codedocu $msg;;
  140. 7) performance $msg;;
  141. 8) tests $msg;;
  142. 9) addtest $msg;;
  143. 10) testok $msg;;
  144. 11) generalupdate $msg;;
  145. 12) refactor $msg;;
  146. 13) dracarys $msg;;
  147. 14) cintegration $msg;;
  148. 15) cibuildsystem $msg;;
  149. 16) security $msg;;
  150. 17) updependencies $msg;;
  151. 18) downdependencies $msg;;
  152. 19) adddependencies $msg;;
  153. 20) removedependencies $msg;;
  154. 21) style $msg;;
  155. 22) criticalfix $msg;;
  156. 23) deployingstuff $msg;;
  157. 24) fixingmacosx $msg;;
  158. 25) fixinglinux $msg;;
  159. 26) fixingwindows $msg;;
  160. 27) dockerrr $msg;;
  161. 28) configfiles $msg;;
  162. 29) popo $msg;;
  163. 30) uselesss $msg;;
  164. 31) exit 0 ;;
  165. *) echo -e "${RED}Error...${STD}" && sleep 2
  166. esac
  167. }
  168.  
  169. commit_menu() {
  170.  
  171. show_options
  172. read_options
  173. }
  174.  
  175. tada() { git add . && git commit -m "Initial commit πŸŽ‰: $1"}
  176. versiontag() { git add . && git commit -m "Version πŸ”–: $1"}
  177. newfeature() { git add . && git commit -m "New feature ✨: $1"}
  178. bugfix() { git add . && git commit -m "Bug fix πŸ›: $1"}
  179. projectdocu() { git add . && git commit -m "Changes to project documentation πŸ“š: $1"}
  180. codedocu() { git add . && git commit -m "Changes to code documentation πŸ’‘: $1"}
  181. performance() { git add . && git commit -m "Perfomance improvement 🐎: $1"}
  182. tests() { git add . && git commit -m "Tests 🚨: $1"}
  183. addtest() { git add . && git commit -m "Adding a Test βœ…: $1"}
  184. testok() { git add . && git commit -m "Test passing βœ”οΈ: $1"}
  185. generalupdate() { git add . && git commit -m "General update ⚑️: $1"}
  186. refactor() { git add . && git commit -m "Refactoring code πŸ”¨: $1"}
  187. dracarys() { git add . && git commit -m "Removing code/files πŸ”₯: $1"}
  188. cintegration() { git add . && git commit -m "Continuous Integration πŸ’š: $1"}
  189. cibuildsystem() { git add . && git commit -m "Adding CI build system πŸ‘·: $1"}
  190. security() { git add . && git commit -m "Security improvement πŸ”’: $1"}
  191. updependencies() { git add . && git commit -m "Upgrading dependencies ⬆️: $1"}
  192. downdependencies() { git add . && git commit -m "Downgrading dependencies ⬇️: $1"}
  193. adddependencies() { git add . && git commit -m "Adding dependencies βž•: $1"}
  194. removedependencies() { git add . && git commit -m "Removing dependencies βž–: $1"}
  195. style() { git add . && git commit -m "Styling code πŸ’…: $1"}
  196. criticalfix() { git add . && git commit -m "Critical hotfix πŸš‘: $1"}
  197. deployingstuff() { git add . && git commit -m "Deploying stuff πŸš€: $1"}
  198. fixingmacosx() { git add . && git commit -m "Fixing on MacOS 🍎: $1"}
  199. fixinglinux() { git add . && git commit -m "Fixing on Linux 🐧: $1"}
  200. fixingwindows() { git add . && git commit -m "Fixing on Windows πŸ–Ό: $1"}
  201. dockerrr() { git add . && git commit -m "Docker 🐳: $1"}
  202. configfiles() { git add . && git commit -m "Configuration files πŸ”§: $1"}
  203. popo() { git add . && git commit -m "Bad code / need improvement πŸ’©: $1"}
  204. uselesss() { git add . && git commit -m "Useless changes 🍺: $1"}
  205.  
  206. alias gremotes='git remote -v'
  207. alias remotename= 'git remote rename'
  208. alias gb='git branch'
  209. alias go='git checkout'
  210. alias nrama='git checkout -b'
  211. alias gundo='git reset --hard HEAD~1'
  212. alias pmaster='git push origin master'
  213. alias pdev='git push origin dev'
  214. alias newgit='rm -rf .git; git init; git add .;git commit -m "starting project";'
  215. alias expressproj='git clone git@github.com:erikzephyr/express-rest-es2017-boilerplate.git; cd express-rest-es2017-boilerplate; rm -rf .git'
  216.  
  217. #-----------------------------------------------------------------------------------------------------------------------
  218. # 5. OSX COMMANDS
  219. #-----------------------------------------------------------------------------------------------------------------------
  220.  
  221. # Docker
  222. rund() {
  223. docker container run --rm -it $@
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement