Skip to content

Instantly share code, notes, and snippets.

@chouyang
Created July 24, 2018 07:36
Show Gist options
  • Save chouyang/44d41b20623604829094828e9769518e to your computer and use it in GitHub Desktop.
Save chouyang/44d41b20623604829094828e9769518e to your computer and use it in GitHub Desktop.
[my bash_profile] #bash
# sys env
export PATH="/usr/local/sbin:/Users/{user_name}/.composer/vendor/bin:$PATH"
export PATH="/Users/{user_name}/.go/bin:$PATH"
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# app env
export PGDATA=/usr/local/postgres
export GOROOT=/usr/local/Cellar/go/1.10.2/libexec
export GOPATH=$HOME/.go
export NODE_PATH="/usr/local/lib/node_modules"
export PATH="$HOME/.fastlane/bin:$PATH"
export CXX=`xcrun -find c++`
export CC=`xcrun -find cc`
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export EDITOR="/usr/local/bin/mate -w"
# tomcat
# export CATALINA_HOME="/usr/local/tomcat"
# export CATALINA_BASE="/usr/local/tomcat"
# export CLASSPATH="$CLASSPATH:/usr/local/tomcat/lib"
# terminal proxy
alias proxy='export all_proxy=socks5://127.0.0.1:1080'
alias unproxy='unset all_proxy'
# SSH Shortcut
# some ssh rapid login alias
# alias to switch between JDK versions
alias jdk7='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7); java -version'
alias jdk8='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8); java -version'
alias jdk9='export JAVA_HOME=$(/usr/libexec/java_home -v 9); java -version'
alias jdk10='export JAVA_HOME=$(/usr/libexec/java_home -v 10); java -version'
# alias to switch between PHP versions
alias php72='brew unlink [email protected] && brew link --force --overwrite php'
alias php56='brew unlink php && brew link --force --overwrite [email protected]'
# datetime and commands alias
alias now='date +%Y%m%d%H%M%S'
alias nowiso="date '+%Y-%m-%d %H:%M:%S'"
alias today='date +%Y%m%d'
alias yesterday='date -v -1d +%Y%m%d'
alias tomorrow='date -v +1d +%Y%m%d'
alias notebook='jupyter notebook /Users/{user_name}/Workspace/python/notebook'
alias dush='ls -A |xargs -I {} du -sh '{}'|gsort -h'
eval "$(thefuck --alias)"
# welcome message
animals=(bong bud-frogs bunny cower daemon default dragon dragon-and-cow elephant elephant-in-snake flaming-sheep head-in hellokitty kitty koala kosh luke-koala meow moofasa moose mutilated ren satanic sheep skeleton small stegosaurus stimpy supermilker surgery three-eyes turkey turtle tux udder vader vader-koala www)
let "i=$RANDOM%${#animals[@]}"
echo -e "\033[1;36m$(fortune -aes|cowsay -f ${animals[$i]}) \033[0m"
# git branch
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/.\1/'
}
# prompt label
export PS1="\u⚡︎\h \[\033[33;1m\]☢︎ \w\[\033[m\]\[\033[31;1m\]\$(git_branch)\[\033[m\] 💀 "
# enable terminal color
export CLICOLOR=1
# terminal color for mac
export LSCOLORS=GxFxCxDxBxegedabagaced
# check if ~/.iterm2_shell_integration.bash exists and then source
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
test -e "${HOME}/.profile" && source "${HOME}/.profile"
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
export PATH="{$PATH}:/Library/Frameworks/Python.framework/Versions/3.6/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment