Skip to content

Instantly share code, notes, and snippets.

@leekiernan
Last active January 11, 2016 10:35
Show Gist options
  • Save leekiernan/9400827 to your computer and use it in GitHub Desktop.
Save leekiernan/9400827 to your computer and use it in GitHub Desktop.
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="robbyrussell"
# Aliases
alias ct="find . -name '._*' -type f -delete -o -name '*.DS_Store' -type f -delete -o -name '.AppleDouble' -type f -delete -o -name 'Thumbs.db' -type f -delete"
alias iown="sudo chown -R `whoami` $1"
alias zz="ssh -L 15704:127.0.0.1:15704 [email protected]"
alias sc=screen
alias tm=tmux
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
# For teh speedz
export RUBY_GC_MALLOC_LIMIT=90000000
export RUBY_FREE_MIN=200000
export UPDATE_ZSH_DAYS=1
# Which plugins
plugins=(git)
source $ZSH/oh-my-zsh.sh
PROMPT_TITLE='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
export PROMPT_COMMAND="${PROMPT_COMMAND} ${PROMPT_TITLE}; "
# Compress all images in folder
function compressImages(){
if (( $# == 0 ))
then echo usage: give percentage e.g: compressImages 50%; fi
if (( $# == 1))
then find -E . -type f -iregex '.*\.jpe?g' -exec mogrify -strip -interlace Plane -quality $1 +monitor {} \; && find -E . -type f -iregex '.*\.(png|jpe?g|gif)$' -exec open -a ImageOptim.app {} \;; fi
}
function cleanfiles() {
find . -type f -execdir sh -c 'mv "$1" "$(echo "$1" | tr " " "-" | tr -cd "[[:alnum:]]/._-" | sed "s/_/-/g" | sed "s/-\+/-/g" | tr "A-Z" "a-z")"' _ {} \;
}
# scale all images
function scaleImages(){
if (( $# == 0 ))
then echo usage: give percentage e.g: scaleImages 30%; fi
if (( $# == 1 ))
then find -E . -type f -iregex '.*\.(png|jpe?g|gif)$' -exec mogrify -resize $1 +monitor {} \;; fi
}
function mtrs() {
rsync -azve ssh $1 [email protected]:/home/110646/users/.home/domains/$2 --progress --stats --exclude 'publish/*' --exclude 'build/*' --exclude '${dir.intermediate}' --exclude '*.zip' --exclude '._*' --exclude '.DS_Store' --exclude 'Thumbs.db' --exclude 'perch/*' --exclude '.git/*' --exclude 'node_modules/*' --exclude '.sass-cache/*'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment