Skip to content

Instantly share code, notes, and snippets.

@FlowerWrong
Created July 24, 2020 03:55
Show Gist options
  • Save FlowerWrong/d2234c16004784535bd4c4c0eb58c6cc to your computer and use it in GitHub Desktop.
Save FlowerWrong/d2234c16004784535bd4c4c0eb58c6cc to your computer and use it in GitHub Desktop.
zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/kingyang/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
DEFAULT_USER="$(whoami)"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(osx autojump brew command-not-found common-aliases dirhistory git github history jsontools urltools zsh-autosuggestions)
# custom plugins
# zsh-autosuggestions
# zsh-syntax-highlighting
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# ------------------------------------------------------------------------------
# java
# export JAVA_6_HOME=$(/usr/libexec/java_home -v1.6)
# export JAVA_7_HOME="/Users/kingyang/.sdkman/candidates/java/7u141-zulu"
# export JAVA_8_HOME=$(/usr/libexec/java_home 1.8)
# export JAVA_9_HOME=$(/usr/libexec/java_home -v9)
# export JAVA_10_HOME="/Users/kingyang/.sdkman/candidates/java/10.0.2-open"
export JAVA_11_HOME=$(/usr/libexec/java_home -v11)
# export JAVA_12_HOME=$(/usr/libexec/java_home 1.12)
# alias java6='export JAVA_HOME=$JAVA_6_HOME'
# alias java7='export JAVA_HOME=$JAVA_7_HOME'
# alias java8='export JAVA_HOME=$JAVA_8_HOME'
# alias java9='export JAVA_HOME=$JAVA_9_HOME'
# alias java10='export JAVA_HOME=$JAVA_10_HOME'
alias java11='export JAVA_HOME=$JAVA_11_HOME'
# alias java12='export JAVA_HOME=$JAVA_12_HOME'
# default java11
export JAVA_HOME=$JAVA_11_HOME
export SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
# golang
export GOROOT=/usr/local/opt/go/libexec
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
# android
export ANT_HOME="/usr/local/opt/ant"
export MAVEN_HOME="/usr/local/opt/maven"
export GRADLE_HOME="/usr/local/opt/gradle"
export ANDROID_HOME="/Users/kingyang/Library/Android/sdk"
export ANDROID_SDK_ROOT="/Users/kingyang/Library/Android/sdk"
export ANDROID_NDK_HOME="/Users/kingyang/Library/Android/sdk/ndk-bundle"
export PATH=$ANT_HOME/bin:$PATH
export PATH=$MAVEN_HOME/bin:$PATH
export PATH=$GRADLE_HOME/bin:$PATH
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/build-tools/28.0.3
# rbenv
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
# export RUBYOPT=--jit
## zsh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
fpath=(/usr/local/share/zsh-completions $fpath)
# ------------------------------------------------------------------------------
export PATH="/usr/local/sbin:$PATH"
export PATH="$PATH:/Users/kingyang/bin"
export PATH="/usr/local/opt/openssl/bin:$PATH"
export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"
export PATH="/usr/local/opt/curl/bin:$PATH"
# nvm
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
# pg
export PGDATABASE=postgres
export PGHOST=127.0.0.1
export PGPORT=5432
export PGUSER=kingyang
export REACT_EDITOR=code
# ------------------------------------------------------------------------------
# useful shell
## ls
## Colorize the ls output ##
alias ls='ls -G'
## Use a long listing format ##
alias ll='ls -la'
## Show hidden files only ##
alias l.='ls -d .* -G'
## cd
## get rid of command not found ##
alias cd..='cd ..'
## a quick way to get out of current directory ##
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
## grep
## Colorize the grep command output for ease of use (good for log files)##
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
## mkdir
alias mkdir='mkdir -pv'
## diff
# install colordiff package :)
alias diff='colordiff'
## date
alias path='echo -e ${PATH//:/\\n}'
alias now='date +"%Y-%m-%d %T"'
## ports
# sudo lsof -PiTCP -sTCP:LISTEN
alias ports='netstat -ap tcp | grep -i "listen"'
## ps
## get top process eating memory
alias psmem='ps aux | sort -nr -k 4'
alias psmem10='ps aux | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps aux | sort -nr -k 3'
alias pscpu10='ps aux | sort -nr -k 3 | head -10'
## wget
alias wget='wget -c'
## df du
## set some other defaults ##
alias df='df -H'
alias du='du -ch'
## rm
alias rf='rm -rf'
## rails
alias rc='./bin/rails c'
alias rs='./bin/rails s -b 0.0.0.0'
## git
alias gc='git checkout'
alias gp='git pull'
alias gm='git commit -am'
alias gp='git push origin'
alias gt='git status'
## ruby
alias be=bundle exec
alias bes=bundle exec rails
## docker
function stop_all() {
docker kill $(docker ps -q)
}
function del_all_containers() {
docker rm $(docker ps -a -q)
}
function del_all_imgs() {
docker rmi $(docker images -q)
}
function flush_dns() {
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
}
function kill_ruby() {
kill $(ps aux | grep ruby | awk '{print $2}')
}
function for_pull() {
find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull \;
}
##=======================================================================================================
## mysql
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"
## rust
export PATH="/Users/kingyang/.cargo/bin:$PATH"
## openssl for ruby-build
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment