Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-----------------------------------------------------------------------------------------------------------------------#
- # Author: Erik Zephyr
- # Description: File used to hold Bash configuration, aliases, functions, completions, etc...
- #
- # Sections:
- # 1. ENVIRONMENT SETUP
- # 2. MAKE TERMINAL BETTER
- # 3. FOLDER MANAGEMENT
- # 4. MISC ALIAS'
- # 5. GIT SHORTCUTS
- # 6. OS X COMMANDS
- #
- #-----------------------------------------------------------------------------------------------------------------------
- #-----------------------------------------------------------------------------------------------------------------------# 1. ENVIRONMENT SETUP
- #-----------------------------------------------------------------------------------------------------------------------
- # DigitalOcean
- export DIGITALOCEAN_ACCESS_TOKEN='xxx'
- # Github
- export GITHUB_TOKEN='xxx'
- # Set default editor
- export EDITOR=code
- #-----------------------------------------------------------------------------------------------------------------------
- # 2. MAKE TERMINAL BETTER
- #-----------------------------------------------------------------------------------------------------------------------
- alias loadbash='source ~/.bash_profile' # Load bash profile
- alias edithosts='code /etc/hosts' # Edit hosts file
- alias editbash='code ~/.bash_profile' # Edit bash profile
- alias editsshconfig='code ~/.ssh/config' # Edit ssh config file
- alias ..='cd ../' # Go back 1 directory level
- alias ...='cd ../../' # Go back 2 directory levels
- alias .3='cd ../../../' # Go back 3 directory levels
- alias .4='cd ../../../../' # Go back 4 directory levels
- alias .5='cd ../../../../../' # Go back 5 directory levels
- alias .6='cd ../../../../../../'
- #-----------------------------------------------------------------------------------------------------------------------# 3. FOLDER MANAGEMENT
- #-----------------------------------------------------------------------------------------------------------------------
- mktar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; } # Creates a *.tar.gz archive of a file or folder
- mkzip() { zip -r "${1%%/}.zip" "$1" ; } # Create a *.zip archive of a file or folder
- #-----------------------------------------------------------------------------------------------------------------------
- # 4. MISC ALIAS'
- #-----------------------------------------------------------------------------------------------------------------------
- # Homebrew
- alias brewup='brew update && brew upgrade && brew cleanup'
- alias brewup-cask='brew update && brew upgrade && brew cleanup && brew cask outdated | awk "{print $1}" | xargs brew cask reinstall && brew cask cleanup'
- # Copy local files to a remote server
- dir-to-remote() { rsync -avz . $1; }
- # npm
- alias nrs='npm run start'
- alias nrd='npm run dev'
- alias nrb='npm run build'
- alias ni='npm install'
- # Homebrew
- alias bci='brew cask install'
- alias bcun='brew cask uninstall'
- alias bcre='brew cask reinstall'
- alias bs="brew search"
- # Run last command with sudo
- alias fuck='sudo $(fc -ln -1)'
- # Switching shells
- alias shell-to-zsh='chsh -s $(which zsh)'
- alias shell-to-bash='chsh -s $(which bash)'
- #-----------------------------------------------------------------------------------------------------------------------
- # 5. GIT SHORTCUTS
- #-----------------------------------------------------------------------------------------------------------------------
- alias gs='git status'
- alias ga='git add .'
- alias unstage='git reset --'
- alias gc='git commit -m'
- #Β COMMIT TEMPLATES
- show_options() {
- clear
- echo "~~~~~~~~~~~~~~~~~~~~~"
- echo " M A I N - M E N U"
- echo "~~~~~~~~~~~~~~~~~~~~~"
- echo "1. Initial commit π"
- echo "2. Version π"
- echo "3. New feature β¨"
- echo "4. Bug fix π"
- echo "5. Changes to project documentation π"
- echo "6. Changes to code documentation π‘"
- echo "7. Perfomance improvement π"
- echo "8. Tests π¨"
- echo "9. Adding a Test β "
- echo "10. Test passing βοΈ"
- echo "11. General update β‘οΈ"
- echo "12. Refactoring code π¨"
- echo "13. Removing code/files π₯"
- echo "14. Continuous Integration π"
- echo "15. Security improvement π"
- echo "16. Adding CI build system π·"
- echo "17. Upgrading dependencies β¬οΈ"
- echo "18. Downgrading dependencies β¬οΈ"
- echo "19. Adding dependencies β"
- echo "20. Removing dependencies β"
- echo "21. Styling code π "
- echo "22. Critical hotfix π"
- echo "23. Deploying stuff π"
- echo "24. Fixing on MacOS π"
- echo "25. Fixing on Linux π§"
- echo "26. Fixing on Windows πΌ"
- echo "27. Docker π³"
- echo "28. Configuration files π§"
- echo "29. Bad code / need improvement π©"
- echo "30. Useless changes πΊ"
- echo "31. Exit β"
- }
- read_options(){
- local choice
- echo "Desired option: "
- read choice
- echo "Desired message: "
- read msg
- case $choice in
- 1) tada $msg;;
- 2) versiontag $msg;;
- 3) newfeature $msg;;
- 4) bugfix $msg;;
- 5) projectdocu $msg;;
- 6) codedocu $msg;;
- 7) performance $msg;;
- 8) tests $msg;;
- 9) addtest $msg;;
- 10) testok $msg;;
- 11) generalupdate $msg;;
- 12) refactor $msg;;
- 13) dracarys $msg;;
- 14) cintegration $msg;;
- 15) cibuildsystem $msg;;
- 16) security $msg;;
- 17) updependencies $msg;;
- 18) downdependencies $msg;;
- 19) adddependencies $msg;;
- 20) removedependencies $msg;;
- 21) style $msg;;
- 22) criticalfix $msg;;
- 23) deployingstuff $msg;;
- 24) fixingmacosx $msg;;
- 25) fixinglinux $msg;;
- 26) fixingwindows $msg;;
- 27) dockerrr $msg;;
- 28) configfiles $msg;;
- 29) popo $msg;;
- 30) uselesss $msg;;
- 31) exit 0 ;;
- *) echo -e "${RED}Error...${STD}" && sleep 2
- esac
- }
- commit_menu() {
- show_options
- read_options
- }
- tada() { git add . && git commit -m "Initial commit π: $1"}
- versiontag() { git add . && git commit -m "Version π: $1"}
- newfeature() { git add . && git commit -m "New feature β¨: $1"}
- bugfix() { git add . && git commit -m "Bug fix π: $1"}
- projectdocu() { git add . && git commit -m "Changes to project documentation π: $1"}
- codedocu() { git add . && git commit -m "Changes to code documentation π‘: $1"}
- performance() { git add . && git commit -m "Perfomance improvement π: $1"}
- tests() { git add . && git commit -m "Tests π¨: $1"}
- addtest() { git add . && git commit -m "Adding a Test β : $1"}
- testok() { git add . && git commit -m "Test passing βοΈ: $1"}
- generalupdate() { git add . && git commit -m "General update β‘οΈ: $1"}
- refactor() { git add . && git commit -m "Refactoring code π¨: $1"}
- dracarys() { git add . && git commit -m "Removing code/files π₯: $1"}
- cintegration() { git add . && git commit -m "Continuous Integration π: $1"}
- cibuildsystem() { git add . && git commit -m "Adding CI build system π·: $1"}
- security() { git add . && git commit -m "Security improvement π: $1"}
- updependencies() { git add . && git commit -m "Upgrading dependencies β¬οΈ: $1"}
- downdependencies() { git add . && git commit -m "Downgrading dependencies β¬οΈ: $1"}
- adddependencies() { git add . && git commit -m "Adding dependencies β: $1"}
- removedependencies() { git add . && git commit -m "Removing dependencies β: $1"}
- style() { git add . && git commit -m "Styling code π : $1"}
- criticalfix() { git add . && git commit -m "Critical hotfix π: $1"}
- deployingstuff() { git add . && git commit -m "Deploying stuff π: $1"}
- fixingmacosx() { git add . && git commit -m "Fixing on MacOS π: $1"}
- fixinglinux() { git add . && git commit -m "Fixing on Linux π§: $1"}
- fixingwindows() { git add . && git commit -m "Fixing on Windows πΌ: $1"}
- dockerrr() { git add . && git commit -m "Docker π³: $1"}
- configfiles() { git add . && git commit -m "Configuration files π§: $1"}
- popo() { git add . && git commit -m "Bad code / need improvement π©: $1"}
- uselesss() { git add . && git commit -m "Useless changes πΊ: $1"}
- alias gremotes='git remote -v'
- alias remotename= 'git remote rename'
- alias gb='git branch'
- alias go='git checkout'
- alias nrama='git checkout -b'
- alias gundo='git reset --hard HEAD~1'
- alias pmaster='git push origin master'
- alias pdev='git push origin dev'
- alias newgit='rm -rf .git; git init; git add .;git commit -m "starting project";'
- alias expressproj='git clone git@github.com:erikzephyr/express-rest-es2017-boilerplate.git; cd express-rest-es2017-boilerplate; rm -rf .git'
- #-----------------------------------------------------------------------------------------------------------------------
- # 5. OSX COMMANDS
- #-----------------------------------------------------------------------------------------------------------------------
- # Docker
- rund() {
- docker container run --rm -it $@
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement