My MacBook Pro .zshrc
# https://gist.github.com/devxoul/541252cef3207088fd5e
# Path to your oh-my-zsh installation.
export ZSH=/Users/xoul/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
USER=""
HOST=""
# 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)
# User configuration
# export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# 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"
###############
# Suyeol Jeon #
###############
export LC_ALL=ko_KR.UTF-8
export LANG=ko_KR.UTF-8
export PATH=/usr/local/bin:$PATH:/usr/local/sbin:/usr/libexec:/usr/local/opt/postgresql/bin
# Java
export JAVA_HOME=$(/usr/libexec/java_home)
# git-pushme
export PATH=$PATH:~/bin
# swiftenv
export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="$SWIFTENV_ROOT/bin:$PATH"
eval "$(swiftenv init -)"
# swift package manager completion
fpath=(~/.zsh $fpath)
compinit
# pyenv
eval "$(pyenv init -)"
pyenv virtualenvwrapper_lazy
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" --no-use # This loads nvm
export PATH=~/.nvm/versions/node/v5.8.0/bin:$PATH
# resize dock
rd() {
size=$(defaults read com.apple.dock tilesize)
if [ $size != 50 ]
then
defaults write com.apple.dock tilesize -int 50
killall Dock
fi
}
# resize iTerm
rt() {
osascript -e '
tell application "Finder"
set desktopBounds to bounds of window of desktop
set screenWidth to item 3 of desktopBounds
end tell
tell application "iTerm"
tell the first window
tell the current session
set columns to 80
set rows to 100
end tell
end tell
set newBounds to bounds of first window
set delta to screenWidth - item 3 of newBounds
set item 1 of newBounds to item 1 of newBounds + delta
set item 2 of newBounds to 0
set item 3 of newBounds to item 3 of newBounds + delta
set bounds of first window to newBounds
end tell'
}
# original: https://gist.github.com/SlexAxton/4989674
gifify() {
if [[ -n "$1" ]]; then
rm -r $1.gif.out
mkdir $1.gif.out
ffmpeg -i $1 -r 30 -vcodec png $1.gif.out/out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> $1.gif.out/out-static*.png GIF:- | gifsicle --colors 256 --loop --optimize=3 --delay 3 --multifile - > $1.gif
rm -r $1.gif.out
else
echo "proper usage: gifify <input_movie.mov>. You DO need to include extension."
fi
}
# 1. move ~/Downloads/*.mp3 to ~/Downloads/Bugs
# 2. replace '-' with ' - ' of all files in ~/Downloads/Bugs
bugs() {
mv ~/Downloads/*.mp3 ~/Downloads/Bugs/ 2>/dev/null
mv ~/Downloads/bugs_*/*.mp3 ~/Downloads/Bugs/ 2>/dev/null
rm -r ~/Downloads/bugs_* 2>/dev/null
python -c "import os; dir = '/Users/xoul/Downloads/Bugs'; [os.rename(dir + '/' + f, (dir + '/' + f).replace('_', ' - ')) for f in os.listdir(dir)]"
}
dnsflush() {
sudo killall -HUP mDNSResponder &&
echo "Successfully flushed DNS cache."
}
updateprofile() {
curl "https://gist.githubusercontent.com/devxoul/541252cef3207088fd5e/raw/.zshrc" > ~/.zshrc;
source ~/.zshrc
}
# list file sizes in current directory (needs `brew install coreutils`)
fs() {
du -sh .[!.]* * | gsort -h
}
# login to ktx internet
ktx() {
curl -X POST -d "user=WiFIUser&password=604598&cmd=authenticate" http://securelogin.arubanetworks.com/cgi-bin/login
}
mounthome() {
umount ~/remote 2>/dev/null
mkdir ~/remote 2>/dev/null
sshfs 192.168.0.100:/ ~/remote
}
mounthomeurl() {
umount ~/remote 2>/dev/null
mkdir ~/remote 2>/dev/null
sshfs home.xoul.kr:/ ~/remote
}
# kills fxxxing Ahnlab agent
killkb() {
ps aux | grep -i astx | grep -v grep | awk '{ print $2 }' | xargs sudo kill -9; ps aux | grep -i astx | grep -v grep
}
# Enables Korean fonts of PDF files in SlideShare
slideshare() {
if [[ -n "$1" ]]; then
LANG=C LC_ALL=C sed -i '' s'|/Registry (Adobe) /Ordering (Korea1) /Supplement [0-9]|/Registry(Adobe) /Ordering(Identity) /Supplement 0|g' $1
else
echo "Usage: slideshare FILENAME"
fi
}
# Opens a new finder tab
# Usage:
# finder # open $PWD
# finder . # open .
# finder $HOME # open $HOME
function finder() {
osascript -e "
set dirname to \"$1\"
if count of dirname is 0 then set dirname to \"$PWD\"
tell application \"Finder\" to activate
tell application \"System Events\"
tell process \"Finder\" to keystroke \"t\" using command down
end tell
tell application \"Finder\"
set target of front window to POSIX file dirname as alias
end tell
" &> /dev/null
}