2015-03-13 09:08:23 +01:00
|
|
|
HISTFILE=~/.zsh_history
|
2016-10-31 08:15:34 +01:00
|
|
|
HISTSIZE=2000
|
|
|
|
SAVEHIST=2000
|
2015-03-12 07:33:04 +01:00
|
|
|
setopt append_history # append
|
|
|
|
setopt hist_ignore_all_dups # no duplicate
|
2016-10-31 08:08:48 +01:00
|
|
|
setopt hist_ignore_space # ignore space prefixed commands
|
2015-03-12 07:33:04 +01:00
|
|
|
setopt hist_reduce_blanks # trim blanks
|
|
|
|
setopt inc_append_history # add commands as they are typed, don't wait until shell exit
|
|
|
|
setopt share_history # share hist between sessions
|
2015-06-01 20:18:19 +02:00
|
|
|
setopt ignoreeof # don't exit the shell on ^D (EOF)
|
2015-03-12 07:33:04 +01:00
|
|
|
|
|
|
|
# emacs bindings
|
|
|
|
bindkey -e
|
|
|
|
# make delete key work
|
|
|
|
bindkey "^[[3~" delete-char
|
|
|
|
bindkey "^[3;5~" delete-char
|
|
|
|
|
|
|
|
# autocomplete
|
|
|
|
autoload -Uz compinit
|
|
|
|
compinit
|
|
|
|
|
|
|
|
# OS-specific things
|
|
|
|
if [[ "$OSTYPE" =~ ^darwin.*$ ]]; then
|
2015-11-23 22:40:00 +01:00
|
|
|
# set homebrew paths
|
|
|
|
# see: http://brew.sh/
|
|
|
|
PATH=/opt/brew/sbin:/opt/brew/bin:$PATH
|
|
|
|
MANPATH=/opt/brew/man:$MANPATH
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2016-04-25 21:38:31 +02:00
|
|
|
# opt out of Homebrew analytics
|
|
|
|
# see: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md
|
|
|
|
export HOMEBREW_NO_ANALYTICS=1
|
2016-08-21 09:57:55 +02:00
|
|
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
|
|
export HOMEBREW_NO_EMOJI=1
|
|
|
|
export HOMEBREW_MAKE_JOBS=3
|
|
|
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
2016-04-25 21:38:31 +02:00
|
|
|
|
2015-11-21 17:36:15 +01:00
|
|
|
# pass needs umount and diskutil, which are in /sbin and /usr/sbin
|
|
|
|
PATH=$PATH:/sbin:/usr/sbin
|
|
|
|
|
2015-11-23 22:40:00 +01:00
|
|
|
# use homebrew's GNU coreutils (prefixed with 'g')
|
|
|
|
# requires at least: coreutils findutils gnu-sed
|
2015-07-30 22:35:19 +02:00
|
|
|
alias du='gdu'
|
|
|
|
alias ls='gls -F --color=auto'
|
|
|
|
alias df='gdf'
|
|
|
|
alias rm='grm'
|
|
|
|
alias cp='gcp'
|
|
|
|
alias mv='gmv'
|
|
|
|
alias mkdir='gmkdir'
|
|
|
|
alias rmdir='grmdir'
|
|
|
|
alias chmod='gchmod'
|
|
|
|
alias chown='gchown'
|
|
|
|
alias ln='gln'
|
|
|
|
alias find='gfind'
|
|
|
|
alias sed='gsed'
|
|
|
|
alias dircolors='gdircolors'
|
2015-08-01 14:35:24 +02:00
|
|
|
alias sort='gsort'
|
2015-08-14 07:46:45 +02:00
|
|
|
alias grep='ggrep'
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2015-06-11 21:56:01 +02:00
|
|
|
# If BasicTeX installation exists, add it to PATH
|
|
|
|
# See: https://tug.org/mactex/morepackages.html
|
2015-07-26 12:23:56 +02:00
|
|
|
[[ -d /usr/local/texlive/2015basic/bin/x86_64-darwin ]] && PATH=$PATH:/usr/local/texlive/2015basic/bin/x86_64-darwin
|
2015-06-11 21:56:01 +02:00
|
|
|
|
2015-05-26 18:26:12 +02:00
|
|
|
elif [[ "$OSTYPE" =~ ^linux.*$ ]]; then
|
2015-05-05 10:39:45 +02:00
|
|
|
# aliases
|
|
|
|
alias ls='ls -F --color=auto'
|
|
|
|
fi
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2015-05-09 17:21:45 +02:00
|
|
|
alias less='less -R' # preserves colors in GNU coreutils' `less`
|
|
|
|
|
2015-05-10 11:32:50 +02:00
|
|
|
# solarized dircolors
|
2015-07-30 22:35:45 +02:00
|
|
|
[[ -r ~/.dircolors.ansi-dark ]] && eval `dircolors ~/.dircolors.ansi-dark`
|
2015-05-10 11:32:50 +02:00
|
|
|
|
2015-03-12 07:33:04 +01:00
|
|
|
# Environment
|
2015-03-13 09:09:01 +01:00
|
|
|
export PS1='[%n@%m: %~]$ '
|
2015-05-05 10:39:45 +02:00
|
|
|
export EDITOR=vim
|
|
|
|
export PAGER=less
|
2015-03-12 07:33:04 +01:00
|
|
|
|
|
|
|
# look for Ansible hosts file in current directory
|
2015-05-09 17:22:32 +02:00
|
|
|
export ANSIBLE_HOSTS=hosts
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2015-10-25 22:07:35 +01:00
|
|
|
# Enable node version manager (nvm)
|
|
|
|
if [[ -d ~/.nvm ]]; then
|
|
|
|
. ~/.nvm/nvm.sh
|
2015-03-12 07:33:04 +01:00
|
|
|
fi
|
|
|
|
|
2016-08-20 20:58:25 +02:00
|
|
|
# Initialize pyenv if it exists
|
|
|
|
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2016-08-20 21:15:05 +02:00
|
|
|
# Initialize jenv if it exists
|
|
|
|
if which jenv > /dev/null; then
|
|
|
|
export JENV_ROOT=~/.jenv
|
2016-08-21 08:08:23 +02:00
|
|
|
eval "$(jenv init -)"
|
2016-08-20 21:15:05 +02:00
|
|
|
fi
|
|
|
|
|
2015-03-12 07:33:04 +01:00
|
|
|
# If a private bin directory exists, add it to PATH
|
2015-05-16 13:15:27 +02:00
|
|
|
[[ -d ~/bin ]] && PATH=$PATH:~/bin
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2015-05-21 21:49:07 +02:00
|
|
|
# If a binary go distribution exists, add it to PATH
|
|
|
|
# From here: http://golang.org/dl/
|
|
|
|
if [[ -d ~/Downloads/go ]]; then
|
|
|
|
export GOROOT=~/Downloads/go
|
|
|
|
export GOPATH=~/src/go
|
|
|
|
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
|
|
|
fi
|
|
|
|
|
2015-06-23 17:05:33 +02:00
|
|
|
|
2015-09-05 19:52:16 +02:00
|
|
|
# resize images using GraphicsMagick
|
2015-08-30 16:58:36 +02:00
|
|
|
#
|
2015-09-05 19:52:16 +02:00
|
|
|
# $ smartresize DSC_0788.JPG 1920x1080 outputdir
|
2015-08-30 16:58:36 +02:00
|
|
|
#
|
2015-09-05 19:52:16 +02:00
|
|
|
# Similar to the one from SmashingMagazine, but ported to GraphicsMagick
|
2015-08-30 16:58:36 +02:00
|
|
|
# see: http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/
|
|
|
|
smartresize() {
|
2016-08-14 22:04:01 +02:00
|
|
|
gm mogrify -filter Triangle -define filter:support=2 -thumbnail $2 -unsharp 2x0.5+0.7+0 -dither -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace Line -strip -output-directory $3 $1
|
2015-09-02 22:51:31 +02:00
|
|
|
}
|
|
|
|
|
2016-03-17 22:01:40 +01:00
|
|
|
# optimize jpeg using GraphicsMagick
|
|
|
|
#
|
|
|
|
# $ jpegoptimize DSC_0788.JPG outputdir [quality]
|
|
|
|
#
|
|
|
|
# Similar to smartresize above, but just optmizes the jpeg
|
|
|
|
jpegoptimize() {
|
|
|
|
if [[ -z $3 ]]; then QUALITY=82; else QUALITY=$3; fi
|
|
|
|
|
2016-08-14 22:04:01 +02:00
|
|
|
gm mogrify -filter Triangle -define filter:support=2 -unsharp 2x0.5+0.7+0 -dither -quality $QUALITY -define jpeg:fancy-upsampling=off -interlace Line -strip -output-directory $2 $1
|
2016-03-17 22:01:40 +01:00
|
|
|
}
|
|
|
|
|
2016-03-07 11:39:25 +01:00
|
|
|
# generate random password 25 characters long:
|
|
|
|
# $ openssl rand -base64 18 | wc -c
|
|
|
|
# 25
|
|
|
|
genpass() {
|
|
|
|
openssl rand -base64 18
|
|
|
|
}
|
|
|
|
|
2015-03-12 07:33:04 +01:00
|
|
|
export PATH
|
2015-05-05 10:40:42 +02:00
|
|
|
export MANPATH
|