From 7d022705ed126d78881fb7356e28f64ee7e540f4 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Mon, 5 Sep 2011 20:08:58 +0200 Subject: Initial commit. --- .aliases | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ .bash_profile | 9 +++++++++ .bash_prompt | 42 ++++++++++++++++++++++++++++++++++++++++++ .bashrc | 1 + .exports | 8 ++++++++ .functions | 15 +++++++++++++++ .gitattributes | 1 + .gitconfig | 35 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + .inputrc | 6 ++++++ .osx | 44 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 10 ++++++++++ bootstrap.sh | 1 + 13 files changed, 225 insertions(+) create mode 100644 .aliases create mode 100755 .bash_profile create mode 100644 .bash_prompt create mode 100644 .bashrc create mode 100644 .exports create mode 100644 .functions create mode 100644 .gitattributes create mode 100644 .gitconfig create mode 100644 .gitignore create mode 100644 .inputrc create mode 100644 .osx create mode 100644 README.md create mode 100755 bootstrap.sh diff --git a/.aliases b/.aliases new file mode 100644 index 0000000..abc6d91 --- /dev/null +++ b/.aliases @@ -0,0 +1,52 @@ +# Easier navigation: .., ..., ~ and - +alias ..="cd .." +alias ...="cd ../.." +alias ~="cd ~" # `cd` is probably faster to type though +alias -- -="cd -" + +# List all files colorized in long format, including dot files +alias la="ls -Gla" + +# 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'" + +# 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 \/.*\"" + +# Start an HTTP server from a directory +alias server="open http://localhost:8080/ && python -m SimpleHTTPServer 8080" + +# Trim new lines and copy to clipboard +alias c="tr -d '\n' | pbcopy" + +# Shortcuts +alias d="cd ~/Documents/Dropbox" +alias p="cd ~/Projects" +alias g="git" +alias v="vim" +alias m="mate ." + +# 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' + +# Disable Spotlight +alias spotoff="sudo mdutil -a -i off" +# Enable Spotlight +alias spoton="sudo mdutil -a -i on" + +# One of @janmoesen’s ProTip™s +for method in GET POST HEAD PUT DELETE; 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'" \ No newline at end of file diff --git a/.bash_profile b/.bash_profile new file mode 100755 index 0000000..d9840c4 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,9 @@ +# Load ~/.bash_prompt, ~/.exports, ~/.aliases, ~/.functions and ~/.extra +# ~/.extra can be used for settings you don’t want to commit +for file in bash_prompt exports aliases functions extra; do + file="$HOME/.$file" + [ -e "$file" ] && source "$file" +done + +# Case-insensitive globbing (used in pathname expansion) +shopt -s nocaseglob diff --git a/.bash_prompt b/.bash_prompt new file mode 100644 index 0000000..764fdfc --- /dev/null +++ b/.bash_prompt @@ -0,0 +1,42 @@ +# @gf3’s Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt" +# Shamelessly copied from https://github.com/gf3/dotfiles + +if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color +elif infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color +fi + +if tput setaf 1 &> /dev/null; then + tput sgr0 + if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then + MAGENTA=$(tput setaf 9) + ORANGE=$(tput setaf 172) + GREEN=$(tput setaf 190) + PURPLE=$(tput setaf 141) + WHITE=$(tput setaf 256) + else + MAGENTA=$(tput setaf 5) + ORANGE=$(tput setaf 4) + GREEN=$(tput setaf 2) + PURPLE=$(tput setaf 1) + WHITE=$(tput setaf 7) + fi + BOLD=$(tput bold) + RESET=$(tput sgr0) +else + MAGENTA="\033[1;31m" + ORANGE="\033[1;33m" + GREEN="\033[1;32m" + PURPLE="\033[1;35m" + WHITE="\033[1;37m" + BOLD="" + RESET="\033[m" +fi + +parse_git_dirty () { + [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" +} +parse_git_branch () { + git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" +} + +PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]" \ No newline at end of file diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..6296f51 --- /dev/null +++ b/.bashrc @@ -0,0 +1 @@ +source "$HOME/.bash_profile" diff --git a/.exports b/.exports new file mode 100644 index 0000000..969cd34 --- /dev/null +++ b/.exports @@ -0,0 +1,8 @@ +# Make vim the default editor +export EDITOR="vim" +# Don’t clear the screen after quitting a manual page +export MANPAGER="less -X" + +# Larger bash history (allow 32³ entries; default is 500) +export HISTSIZE=32768 +export HISTFILESIZE=$HISTSIZE diff --git a/.functions b/.functions new file mode 100644 index 0000000..91ec6c1 --- /dev/null +++ b/.functions @@ -0,0 +1,15 @@ +# Create a new directory and enter it +md() { + mkdir -p "$@" && cd "$@" +} + +# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. +# Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!) +httpcompression() { + encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding" +} + +# All the dig info +digga() { + dig +nocmd "$1" any +multiline +noall +answer +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..2aeaccc --- /dev/null +++ b/.gitconfig @@ -0,0 +1,35 @@ +[apply] + whitespace = fix +[core] + excludesfile = ~/.gitignore + attributesfile = ~/.gitattributes + whitespace = fix,space-before-tab,tab-in-indent,trailing-space +[color] + ui = auto +[color "branch"] + current = yellow reverse + local = yellow + remote = green +[color "diff"] + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold +[color "status"] + added = yellow + changed = green + untracked = cyan +[merge] + log = true +[url "git@github.com:"] + insteadOf = "gh:" + pushInsteadOf = "github:" + pushInsteadOf = "git://github.com/" +[url "git://github.com/"] + insteadOf = "github:" +[url "git@gist.github.com:"] + insteadOf = "gst:" + pushInsteadOf = "gist:" + pushInsteadOf = "git://gist.github.com/" +[url "git://gist.github.com/"] + insteadOf = "gist:" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/.inputrc b/.inputrc new file mode 100644 index 0000000..af7702b --- /dev/null +++ b/.inputrc @@ -0,0 +1,6 @@ +# Make Tab autocomplete regardless of filename case +set completion-ignore-case on +# Append a slash when autocompleting symbolic links to directories +set mark-symlinked-directories on +# List all matches in case multiple possible completions are possible +set show-all-if-ambiguous on diff --git a/.osx b/.osx new file mode 100644 index 0000000..53ba7d0 --- /dev/null +++ b/.osx @@ -0,0 +1,44 @@ +# 2D Dock +defaults write com.apple.dock no-glass -bool true + +# Disable menu bar transparency +defaults write -g AppleEnableMenuBarTransparency -bool false + +# Expand save panel by default +defaults write -g NSNavPanelExpandedStateForSaveMode -bool true + +# Expand print panel by default +defaults write -g PMPrintingExpandedStateForPrint -bool true + +# Disable shadow in screenshots +defaults write com.apple.screencapture disable-shadow -bool true + +# Enable highlight hover effect for the grid view of a stack (Dock) +defaults write com.apple.dock mouse-over-hilte-stack -bool true + +# Disable Safari’s thumbnail cache for History and Top Sites +defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 + +# Remove useless icons from Safari’s bookmarks bar +defaults write com.apple.Safari ProxiesInBookmarksBar "()" + +# Disable Lion’s press-and-hold for keys in favor of key repeat +defaults write -g ApplePressAndHoldEnabled -bool false + +# Disable OS X Lion auto-correct +defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false + +# Reset Launchpad +rm ~/Library/Application\ Support/Dock/*.db + +# Show the ~/Library folder +chflags nohidden ~/Library + +# Disable local Time Machine backups +sudo tmutil disablelocal + +# Kill applications +killall Safari && killall Finder && killall Dock + +# Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo) +echo "0×08000100:0" > ~/.CFUserTextEncoding \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..36dc440 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Mathias’s dotfiles + +Suggestions/improvements +[welcome](https://github.com/mathiasbynens/dotfiles/issues)! + +## Thanks to… +* [Gianni Chiappetta](http://gf3.ca/) for sharing his [amazing collection of dotfiles](https://github.com/gf3/dotfiles) +* [Matijs Brinkhuis](http://hotfusion.nl/) and his [homedir repository](https://github.com/matijs/homedir)) +* [Jan Moesen](http://jan.moesen.nu/) +* [Tim Esselens](http://devel.datif.be/) diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..c7fd02e --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1 @@ +git pull && rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ -- cgit v1.2.3