Skip to content

Instantly share code, notes, and snippets.

@mping
Last active September 7, 2016 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mping/fc7ace5f0a8934c78e8a to your computer and use it in GitHub Desktop.
Save mping/fc7ace5f0a8934c78e8a to your computer and use it in GitHub Desktop.
Bash and Zsh dot.rc files
#
# shared history: http://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows#3055135
#
HISTCONTROL=ignoredups:erasedups # no duplicate entries
HISTSIZE=100000 # big big history
HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
#st should be a function to pass args
st(){ sublime-text $*
}
alias pserv='python -m SimpleHTTPServer $*'
alias snap='python -m snappy $*'
alias wget='wget --trust-server-names --no-check-certificate'
alias ls='LC_COLLATE=C ls -lFha --group-directories-first --color '
alias grep='grep --color=always'
alias less='less -R'
# git aliases
alias glg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gco='git checkout'
alias gcob='git checkout -b'
alias glog='git log'
alias gd='git diff --color --ignore-space-at-eol -b -w --ignore-blank-lines'
alias gdw='git diff -w --word-diff=color --word-diff-regex=.'
alias gstap='git stash && git stash apply'
alias gsc='git diff --name-only --diff-filter=U'
alias xephyrstart='Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :1 &'
# 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=/home/mping/.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"
# eval `dircolors ~/.solarized/colors/dark`
#
# aliases
#
alias pserv='python -m SimpleHTTPServer $*'
alias wget='wget --trust-server-names --no-check-certificate'
alias ls='LC_COLLATE=C ls -lFha --group-directories-first --color '
alias grep='grep --color=always'
alias less='less -R'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
### functions
# read markdown from shell
function mdread {
cat $1 | pandoc -f markdown_github | lynx -stdin
}
# start emacs windowed in osx
function emacs {
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"
}
# pstate freq
function cpu_min {
sudo pstate-frequency -S -g powersave
sudo pstate-frequency -S -m 50
}
function cpu_silent {
sudo pstate-frequency -S -g powersave
sudo pstate-frequency -S -m 80
}
function cpu_maxed {
sudo pstate-frequency -S -g performance
sudo pstate-frequency -S -m 100
}
### Path
export GOROOT="$HOME/devel/go"
export GOPATH="$HOME/devel/gopath"
export ANDROID_HOME="/home/mping/devel/android-sdk-linux/"
export ANDROID_NDK="/home/mping/devel/android-ndk-r10e/"
export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
export GRADLE_HOME="/home/mping/devel/gradle-2.13"
export PATH="$PATH:$ANDROID_HOME/tools"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
export PATH="$PATH:$GOROOT/bin"
export PATH="$PATH:$GOPATH/bin"
export PATH="$PATH:$HOME/devel/node-v0.12.2-linux-x64/bin"
export PATH="$PATH:$HOME/devel/jdk1.8.0_45/bin"
export PATH="$PATH:$GRADLE_HOME/bin"
export PATH="$PATH:$HOME/devel/etcd-v2.0.9-linux-amd64"
export PATH="$PATH:$HOME/devel/fleet-v0.10.1-linux-amd64"
export PATH="$PATH:$HOME/devel/apache-maven-3.3.3/bin"
export PATH="$PATH:$HOME/.rbenv/bin"
export PATH="$PATH:$HOME/devel/sbt/bin"
# Less colors
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;38;5;74m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[30;43m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[04;38;5;146m'
### Git aliases
# git aliases
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.st "status"
git config --global alias.pl "pull"
git config --global alias.p "push"
git config --global alias.c "commit -v"
git config --global alias.ca "commit -v -a"
git config --global alias.b "branch"
git config --global alias.co "checkout"
git config --global alias.cob "checkout -b"
git config --global alias.log "log"
git config --global alias.d "diff --color --ignore-space-at-eol -b -w --ignore-blank-lines"
git config --global alias.dw "diff -w --word-diff=color --word-diff-regex=."
git config --global alias.stap "stash && git stash apply"
git config --global alias.sc "diff --name-only --diff-filter=U"
# 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)
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/dsa_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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment