Skip to content

Instantly share code, notes, and snippets.

@shrekuu
Last active July 16, 2018 06:09
Show Gist options
  • Select an option

  • Save shrekuu/a5c8142d8d4873d2c110c97880ce96a7 to your computer and use it in GitHub Desktop.

Select an option

Save shrekuu/a5c8142d8d4873d2c110c97880ce96a7 to your computer and use it in GitHub Desktop.
.zshrc macOS High Serria php72 mysql nginx apache
# 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/bond/.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="robbyrussell"
# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# 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=(
# git
zsh-autosuggestions
)
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"
# path
export PATH="/Users/bond/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
# zsh
alias zsh.config="vi ~/.zshrc"
alias source.zsh="source ~/.zshrc"
# git
alias gs="git status"
alias gtags="git for-each-ref --sort=taggerdate --format '%(refname) %(taggerdate)' refs/tags"
# nginx apache php mysql
alias ng.config="code /usr/local/etc/nginx"
alias ng.test="sudo nginx -t"
alias ap.config="code /etc/apache2"
alias ap.test="sudo apachectl -t"
alias ph.config="vi /usr/local/etc/php/7.2/php.ini"
alias fp.config="vi /usr/local/etc/php/7.2/php-fpm.conf"
alias fp.test="php-fpm -t"
alias my.config="sudo vi /usr/local/etc/my.conf"
alias ng.start="sudo brew services start nginx"
alias ng.restart="sudo brew services restart nginx"
alias ng.stop="sudo brew services stop nginx"
alias ap.start="sudo apachectl start"
alias ap.restart="sudo apachectl restart"
alias ap.stop="sudo apachectl stop"
alias fp.start="sudo brew services start php"
alias fp.restart="sudo brew services restart php"
alias fp.stop="sudo brew services stop php"
alias my.start="brew services start mysql"
alias my.restart="brew services restart mysql"
alias my.stop="brew services stop mysql"
# android
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
# sign and align apk file
alias saf="jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/keystores/companyname-release-key.keystore platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk companyname -storepass storepass -keypass keypass"
alias aaf="~/Library/Android/sdk/build-tools/26.0.2/zipalign -v 4 platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk android-release-signed.apk"
alias saaf="saf && aaf"
# github api token for homebrew
export HOMEBREW_GITHUB_API_TOKEN=^_^
# istats
alias sys="istats cpu"
alias syst="istats"
# hosts
alias hosts.config="sudo vi /etc/hosts"
# hombrew bottles
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
# better ls color
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# display a slash / after directores
alias ls="ls -FG"
# quick jump to often used directories
# http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
export MARKPATH=$HOME/.marks
function jump {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
pwd
}
function mark {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
}
function unmark {
rm -i "$MARKPATH/$1"
}
function marks {
\ls -l "$MARKPATH" | tail -n +2 | sed 's/ / /g' | cut -d' ' -f9- | awk -F ' -> ' '{printf "%-10s -> %s\n", $1, $2}'
}
# tab completion for jump and unmark
function _completemarks {
reply=($(ls $MARKPATH))
}
compctl -K _completemarks jump
compctl -K _completemarks unmark
# get size of dir or file
function dudu {
du -h -d 0 $1
}
# tab completion for dudu
function _completedudu {
reply=($(ls .))
}
compctl -K _completedudu dudu
# shorten mark name
alias cdd='jump'
# sourcetree alias
alias st='open -a SourceTree'
# http proxy
function proxy {
export http_proxy=http://127.0.0.1:1086;
export https_proxy=http://127.0.0.1:1086;
echo -e "芝麻开门了"
}
function unproxy {
unset http_proxy
unset https_proxy
echo -e "芝麻发霉了"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment