Skip to content

Instantly share code, notes, and snippets.

@zxdvd
Created October 15, 2016 06:02
Show Gist options
  • Save zxdvd/255d7136d530b7f58c27a973101b2ebc to your computer and use it in GitHub Desktop.
Save zxdvd/255d7136d530b7f58c27a973101b2ebc to your computer and use it in GitHub Desktop.
osx .bashrc
# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
##
# Your previous /Users/zxd/.bash_profile file was backed up as /Users/zxd/.bash_profile.macports-saved_2015-12-25_at_23:41:43
##
# MacPorts Installer addition on 2015-12-25_at_23:41:43: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
source "$HOME/.bashrc"
# There are 3 different types of shells in bash: the login shell, normal shell
# and interactive shell. Login shells read ~/.profile and interactive shells
# read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all
# settings made here will also take effect in a login shell.
#
# NOTE: It is recommended to make language settings in ~/.profile rather than
# here, since multilingual X sessions would not work properly if LANG is over ridden in every subshell.
# ctrl-x-e to edit a long command in vi mode, can also set it to emacs
export EDITOR=/usr/bin/vim
# For some news readers it makes sense to specify the NEWSSERVER variable here
#export NEWSSERVER=your.news.server
#export HISTCONTROL=ignoredups:erasedups
export HISTSIZE=100000
export HISTFILESIZE=100000
#shopt -s histappend #append to history
# Save and reload the history after each command finishes, works for multiple sessions
#export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
test -s ~/.alias && . ~/.alias || true
export JAVA_HOME=/usr/lib64/jvm/java
export NVM_DIR="$HOME/.nvm"
export GOPATH="$HOME/go"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
[[ -d ~/logssh ]] || mkdir ~/logssh
function logssh() {
logfile=$*
logfile=${logfile##*@} #get substring after last @
logfile=${logfile%% *} #get substring before first whitespace
logfile="${logfile}_$(date +'%F_%R')"
ssh $* 2>&1 | tee ~/logssh/${logfile}.log
}
PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[0;32m\] ($(git branch 2>/dev/null | grep "^*" | colrm 1 2)\[\033[0;32m\]\[\033[0m\033[0;32m\])\n\$\[\033[0m\033[0;32m\]\[\033[0m\] '
#only for mac osx
if [ "$(uname)" == "Darwin" ]; then
#settings for mac os x (default locale is C, change it to utf-8)
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH"
#bash_completion settings for MacPorts
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
fi
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment