Added some gems from Paul Irish's dotfiles, Removed syntastic
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -70,9 +70,6 @@
|
|||||||
[submodule "vim/vim.symlink/bundle/vim-matchit"]
|
[submodule "vim/vim.symlink/bundle/vim-matchit"]
|
||||||
path = vim/vim.symlink/bundle/vim-matchit
|
path = vim/vim.symlink/bundle/vim-matchit
|
||||||
url = https://github.com/tsaleh/vim-matchit.git
|
url = https://github.com/tsaleh/vim-matchit.git
|
||||||
[submodule "vim/vim.symlink/bundle/syntastic"]
|
|
||||||
path = vim/vim.symlink/bundle/syntastic
|
|
||||||
url = https://github.com/scrooloose/syntastic.git
|
|
||||||
[submodule "vim/vim.symlink/bundle/vim-surround"]
|
[submodule "vim/vim.symlink/bundle/vim-surround"]
|
||||||
path = vim/vim.symlink/bundle/vim-surround
|
path = vim/vim.symlink/bundle/vim-surround
|
||||||
url = https://github.com/tpope/vim-surround.git
|
url = https://github.com/tpope/vim-surround.git
|
||||||
|
|||||||
@@ -17,10 +17,13 @@ alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C
|
|||||||
alias git-amend='git commit --amend -C HEAD'
|
alias git-amend='git commit --amend -C HEAD'
|
||||||
alias git-undo='git reset --soft HEAD~1'
|
alias git-undo='git reset --soft HEAD~1'
|
||||||
alias git-count='git shortlog -sn'
|
alias git-count='git shortlog -sn'
|
||||||
|
alias undopush="git push -f origin HEAD^:master"
|
||||||
|
# git root
|
||||||
|
alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`'
|
||||||
|
|
||||||
alias sub-pull='git submodule foreach git pull origin master'
|
alias sub-pull='git submodule foreach git pull origin master'
|
||||||
|
|
||||||
funciton get-credit() {
|
funciton give-credit() {
|
||||||
git commit --amend --author $1 <$2> -C HEAD
|
git commit --amend --author $1 <$2> -C HEAD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Submodule vim/vim.symlink/bundle/syntastic deleted from 2e7d73305b
@@ -13,3 +13,91 @@ function colours() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create a new directory and enter it
|
||||||
|
function md() {
|
||||||
|
mkdir -p "$@" && cd "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# find shorthand
|
||||||
|
function f() {
|
||||||
|
find . -name "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Start an HTTP server from a directory, optionally specifying the port
|
||||||
|
function server() {
|
||||||
|
local port="${1:-8000}"
|
||||||
|
open "http://localhost:${port}/"
|
||||||
|
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
||||||
|
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
|
||||||
|
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
||||||
|
}
|
||||||
|
|
||||||
|
# git log with per-commit cmd-clickable GitHub URLs (iTerm)
|
||||||
|
# function gf() {
|
||||||
|
# local remote="$(git remote -v | awk '/^origin.*\(push\)$/ {print $2}')"
|
||||||
|
# [[ "$remote" ]] || return
|
||||||
|
# local user_repo="$(echo "$remote" | perl -pe 's/.*://;s/\.git$//')"
|
||||||
|
# git log $* --name-status --color | awk "$(cat <<AWK
|
||||||
|
# /^.*commit [0-9a-f]{40}/ {sha=substr(\$2,1,7)}
|
||||||
|
# /^[MA]\t/ {printf "%s\thttps://github.com/$user_repo/blob/%s/%s\n", \$1, sha, \$2; next}
|
||||||
|
# /.*/ {print \$0}
|
||||||
|
# AWK
|
||||||
|
# )" | less -F
|
||||||
|
# }
|
||||||
|
|
||||||
|
# take this repo and copy it to somewhere else minus the .git stuff.
|
||||||
|
function gitexport(){
|
||||||
|
mkdir -p "$1"
|
||||||
|
git archive master | tar -x -C "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# get gzipped size
|
||||||
|
function gz() {
|
||||||
|
echo "orig size (bytes): "
|
||||||
|
cat "$1" | wc -c
|
||||||
|
echo "gzipped size (bytes): "
|
||||||
|
gzip -c "$1" | wc -c
|
||||||
|
}
|
||||||
|
|
||||||
|
# All the dig info
|
||||||
|
function digga() {
|
||||||
|
dig +nocmd "$1" any +multiline +noall +answer
|
||||||
|
}
|
||||||
|
|
||||||
|
# Escape UTF-8 characters into their 3-byte format
|
||||||
|
function escape() {
|
||||||
|
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
|
||||||
|
echo # newline
|
||||||
|
}
|
||||||
|
|
||||||
|
# Decode \x{ABCD}-style Unicode escape sequences
|
||||||
|
function unidecode() {
|
||||||
|
perl -e "binmode(STDOUT, ':utf8'); print \"$@\""
|
||||||
|
echo # newline
|
||||||
|
}
|
||||||
|
|
||||||
|
# Extract archives - use: extract <file>
|
||||||
|
# Credits to http://dotfiles.org/~pseup/.bashrc
|
||||||
|
function extract() {
|
||||||
|
if [ -f $1 ] ; then
|
||||||
|
case $1 in
|
||||||
|
*.tar.bz2) tar xjf $1 ;;
|
||||||
|
*.tar.gz) tar xzf $1 ;;
|
||||||
|
*.bz2) bunzip2 $1 ;;
|
||||||
|
*.rar) rar x $1 ;;
|
||||||
|
*.gz) gunzip $1 ;;
|
||||||
|
*.tar) tar xf $1 ;;
|
||||||
|
*.tbz2) tar xjf $1 ;;
|
||||||
|
*.tgz) tar xzf $1 ;;
|
||||||
|
*.zip) unzip $1 ;;
|
||||||
|
*.Z) uncompress $1 ;;
|
||||||
|
*.7z) 7z x $1 ;;
|
||||||
|
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "'$1' is not a valid file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,27 @@
|
|||||||
# reload zsh config
|
# reload zsh config
|
||||||
alias reload!='source ~/.zshrc'
|
alias reload!='source ~/.zshrc'
|
||||||
|
|
||||||
|
# Detect which `ls` flavor is in use
|
||||||
|
if ls --color > /dev/null 2>&1; then # GNU `ls`
|
||||||
|
colorflag="--color"
|
||||||
|
else # OS X `ls`
|
||||||
|
colorflag="-G"
|
||||||
|
fi
|
||||||
|
|
||||||
# Filesystem aliases
|
# Filesystem aliases
|
||||||
alias ..='cd ..'
|
alias ..='cd ..'
|
||||||
alias ...='cd ../..'
|
alias ...='cd ../..'
|
||||||
alias l='ls -lah'
|
alias ....="cd ../../.."
|
||||||
alias la='ls -AF'
|
alias .....="cd ../../../.."
|
||||||
alias ll='ls -lFh'
|
|
||||||
alias lld='ls -l | grep ^d'
|
alias l="ls -lah ${colorflag}"
|
||||||
alias rmf='rm -rf'
|
alias la="ls -AF ${colorflag}"
|
||||||
|
alias ll="ls -lFh ${colorflag}"
|
||||||
|
alias lld="ls -l | grep ^d"
|
||||||
|
alias rmf="rm -rf"
|
||||||
|
|
||||||
|
# shortcut to dotfiles
|
||||||
|
alias dot="cd ~/.dotfiles"
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
@@ -22,3 +35,54 @@ alias rake="noglob rake"
|
|||||||
alias mou='open -a Mou.app'
|
alias mou='open -a Mou.app'
|
||||||
alias mark='open -a Marked.app'
|
alias mark='open -a Marked.app'
|
||||||
alias ios='open -a /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
|
alias ios='open -a /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
|
||||||
|
|
||||||
|
# be nice
|
||||||
|
alias please=sudo
|
||||||
|
|
||||||
|
# IP addresses
|
||||||
|
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
|
||||||
|
alias localip="ipconfig getifaddr en1"
|
||||||
|
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
|
||||||
|
|
||||||
|
# Enhanced WHOIS lookups
|
||||||
|
alias whois="whois -h whois-servers.net"
|
||||||
|
|
||||||
|
# Flush Directory Service cache
|
||||||
|
alias flush="dscacheutil -flushcache"
|
||||||
|
|
||||||
|
# View HTTP traffic
|
||||||
|
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
|
||||||
|
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
|
||||||
|
|
||||||
|
# Trim new lines and copy to clipboard
|
||||||
|
alias trimcopy="tr -d '\n' | pbcopy"
|
||||||
|
|
||||||
|
# Recursively delete `.DS_Store` files
|
||||||
|
alias cleanup="find . -name '*.DS_Store' -type f -ls -delete"
|
||||||
|
|
||||||
|
# File size
|
||||||
|
alias fs="stat -f \"%z bytes\""
|
||||||
|
|
||||||
|
# ROT13-encode text. Works for decoding, too! ;)
|
||||||
|
alias rot13='tr a-zA-Z n-za-mN-ZA-M'
|
||||||
|
|
||||||
|
# Empty the Trash on all mounted volumes and the main HDD
|
||||||
|
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; rm -rfv ~/.Trash"
|
||||||
|
|
||||||
|
# Hide/show all desktop icons (useful when presenting)
|
||||||
|
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
|
||||||
|
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
|
||||||
|
|
||||||
|
|
||||||
|
# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it
|
||||||
|
alias plistbuddy="/usr/libexec/PlistBuddy"
|
||||||
|
|
||||||
|
# One of @janmoesen’s ProTip™s
|
||||||
|
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
|
||||||
|
alias "$method"="lwp-request -m '$method'"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
|
||||||
|
alias stfu="osascript -e 'set volume output muted true'"
|
||||||
|
alias pumpitup="osascript -e 'set volume 10'"
|
||||||
|
alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'"
|
||||||
|
|||||||
Reference in New Issue
Block a user