# ------------------------------- # 1. ENVIRONMENT CONFIGURATION # ------------------------------- # Set Paths # ------------------------------------------------------------ #export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/opt:/opt/local/bin:/opt/local/sbin:$HOME/.npm-packages/bin:/usr/local/opt/yarn/bin:$HOME/Library/Python/2.7/bin:/usr/local/opt/python/libexec/bin:/usr/local/opt/go/libexec/bin:$(go env GOPATH)/bin:$HOME/Documents/Scripts:$PATH" # Homebrew export PATH="/usr/local/sbin:$PATH" # MySQL #export PATH=/usr/local/mysql/bin:$PATH # Homebrew Python 3.7 export PATH=/usr/local/opt/python/libexec/bin:$PATH export PATH=/Users/bruno/Library/Python/3.7/bin:$PATH # macOS Pyhton 2.7 #export PATH=$HOME/Library/Python/2.7/bin:$PATH # golang #export PATH=/usr/local/opt/go/libexec/bin:$(go env GOPATH)/bin:$PATH # Scripts perso export PATH=$HOME/Documents/Scripts:$PATH # sqlite export PATH="/usr/local/opt/sqlite/bin:$PATH" # echo $PATH sans export ci-dessus # /Users/bruno/.nvm/versions/node/v8.11.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin # /Users/bruno/.nvm/versions/node/v8.11.4/bin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin # Python # ------------------------------------------------------------ export PYTHONPATH=/usr/local/lib/python3.7/site-packages export PYTHONSTARTUP=~/.pythonrc # Set Prompt # ------------------------------------------------------------ #export PS1="\u@\h:\w\\$ \[$(tput sgr0)\]" #export PS1="\u@\h \w> " #export PS1="\u@\h:\w\\$ " export PS1="\[\e[36m\]\u\[\e[m\]@\[\e[33m\]\h\[\e[m\]: \[\e[32m\]\w\[\e[m\] \$ " #scripts=$HOME/Documents/Scripts #export scripts #export NVM_DIR=~/.nvm #source $(brew --prefix nvm)/nvm.sh #export NVM_DIR="$HOME/.nvm" #[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm #[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion" # This loads nvm bash_completion export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Set Default Editor (change 'Nano' to the editor of your choice) # ------------------------------------------------------------ #export EDITOR=/usr/bin/nano export EDITOR="/usr/local/bin/bbedit" # ----------------------------- # 2. MAKE TERMINAL BETTER # ----------------------------- # The Fuck # https://github.com/nvbn/thefuck eval "$(thefuck --alias)" # cd Documents #cd() { builtin cd "$@" && ls -la; } #alias cdls='cd "$@" && ls -la' alias ex='exa --tree --level=4' # mcd Test mcd () { mkdir -p "$1" && cd "$1"; } # go back x directories b() { str="" count=0 while [ "$count" -lt "$1" ]; do str=$str"../" let count=count+1 done cd $str } # ----------------------------- # 3. FINDER # ----------------------------- # cdf: 'Cd's to frontmost window of MacOS Finder # ------------------------------------------------------ cdf () { currFolderPath=$( /usr/bin/osascript < "$ps" ; open "$ps" ; } # cleanupDS: Recursively delete .DS_Store files # ------------------------------------------------------------------- alias cleanupDS="find . -type f -name '*.DS_Store' -ls -delete" # showHidden: Show hidden files in Finder # hideHidden: Hide hidden files in Finder # ------------------------------------------------------------------- alias showHidden='defaults write com.apple.finder ShowAllFiles TRUE' alias hideHidden='defaults write com.apple.finder ShowAllFiles FALSE' # --------------------------- # 4. PROCESS MANAGEMENT # --------------------------- # topForever: Continual 'top' listing (every 10 seconds) # ----------------------------------------------------- alias topForever='top -l 9999999 -s 10 -o cpu' # ttop: Recommended 'top' invocation to minimize resources # ------------------------------------------------------------ # Taken from this macosxhints article # http://www.macosxhints.com/article.php?story=20060816123853639 # ------------------------------------------------------------ alias ttop="top -R -F -s 10 -o rsize" #top -ocpu -R -F -s 2 -n30 # my_ps: List processes owned by my user: # ------------------------------------------------------------ my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,start,time,bsdtime,command ; } # --------------------------------------- # 5. ENVIRONEMENT # --------------------------------------- export HOMEBREW_NO_AUTO_UPDATE=1 export GOPATH=$HOME/Documents/go export GOBIN=$HOME/Documents/go/bin export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced # --------------------------------------- # 6. SYSTEMS OPERATIONS & INFORMATION # --------------------------------------- # ii: display useful host related informaton # ------------------------------------------------------------------- ii() { echo -e "\nYou are logged on ${RED}$HOST" echo -e "\nAdditionnal information:$NC " ; uname -a echo -e "\n${RED}Users logged on:$NC " ; w -h echo -e "\n${RED}Current date :$NC " ; date echo -e "\n${RED}Machine stats :$NC " ; uptime echo -e "\n${RED}Current network location :$NC " ; scselect echo -e "\n${RED}Public facing IP Address :$NC " ;myip #echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns echo } # --------------------------------------- # 7. BASH # --------------------------------------- # grabs the latest .bash_profile file and reloads the prompt #alias restorebashprofile="curl https://clicclac.info/backup/.bash_profile_silverbook > ~/.bash_profile && reload" #alias backupbashprofile="scp .bash_profile funnymac@ftp.cluster011.ovh.net:www/backup/ .bash_profile_silverbook" #alias backupbash="cd && zip - .bash_profile .bash_aliases .sh_aliases | ssh funnymac@ftp.cluster011.ovh.net 'cat > www/backup/bash_silverbook.zip'" alias backupbash="cd && COPYFILE_DISABLE=1 tar -czvf - .bash_profile .bash_aliases .sh_aliases | ssh funnymac@ftp.cluster011.ovh.net 'cat > www/backup/bash_silverbook.tar.gz'" #alias restorebash="curl https://clicclac.info/backup/bash_silverbook.zip > bash_silverbook.zip" alias restorebash="cd && curl https://clicclac.info/backup/bash_silverbook.tar.gz | tar -xzv && reload" # reloads the prompt, usefull to take new modifications into account alias reload="source ~/.bash_profile && echo 'source ~/.bash_profile'" source ~/.sh_aliases test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion source ~/Documents/Scripts/wp-completion.bash # venv #source /usr/local/bin/activate.sh # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # --------------------------------------- # 8. OTHERS # --------------------------------------- # A mettre après 'source /usr/local/bin/activate.sh' cd() { builtin cd "$@" && ls -la; }