-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,247 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Aliases ###################################################################### | ||
|
||
# List | ||
alias ll='ls -lahpF' # Ubuntu & Mac compatible | ||
|
||
# Reload the shell (i.e. invoke as a login shell) | ||
alias reload="exec $SHELL -l" | ||
|
||
# Network | ||
alias ip="dig +short myip.opendns.com @resolver1.opendns.com" | ||
alias flush="dscacheutil -flushcache" # Flush Directory Service cache | ||
|
||
# Git | ||
alias cola='(~/git-cola/bin/git-cola &)' | ||
alias dag='(~/git-cola/bin/git-dag &)' | ||
|
||
# Vim | ||
alias gvim="gvim 2>/dev/null" | ||
|
||
# Temp Dir | ||
alias tmp="cd `mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`" | ||
alias tmpf="vim `mktemp 2>/dev/null || mktemp -t 'mytmpfile'`" | ||
|
||
# Tmux | ||
alias ta="tmux attach-session -t" | ||
alias tc="tmux new-session -s" | ||
alias tl="tmux list-sessions" | ||
|
||
# Screen | ||
alias sc="screen -S" # Create | ||
alias sl="screen -ls" # List | ||
alias sr="screen -r" # Resume | ||
|
||
# DOCKER ####################################################################### | ||
|
||
# Aliases | ||
alias dl='docker ps -lq' | ||
alias dlc='docker ps -a' | ||
alias dli='docker images -a' | ||
|
||
# Kill all running containers. | ||
alias docker_killall='docker kill $(docker ps -q)' | ||
|
||
# Delete all stopped containers. | ||
alias docker_cleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps --no-trunc -aq)' | ||
|
||
# Delete all untagged images. | ||
alias docker_cleani='printf "\n>>> Deleting untagged images\n\n" && docker images -q --filter "dangling=true" | xargs docker rmi' | ||
|
||
# Delete all stopped containers and untagged images. | ||
alias docker_clean='docker_cleanc || true && docker_cleani' | ||
|
||
################################################################################ | ||
|
||
# vim: ft=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
AwesomePrint.defaults = { | ||
:indent => -2, | ||
:color => { | ||
:hash => :pale, | ||
:class => :white | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Bash Auto Complete ########################################################## | ||
|
||
# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards | ||
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh; | ||
|
||
# vim: ft=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Load environment variables | ||
[[ -s $HOME/.vlad ]] && source $HOME/.vlad | ||
|
||
# System functions and aliases | ||
[[ -s $HOME/.functions ]] && source $HOME/.functions | ||
[[ -s $HOME/.aliases ]] && source $HOME/.aliases | ||
[[ -s $HOME/.osx ]] && source $HOME/.osx | ||
|
||
# Load bash | ||
[[ -s $HOME/.profile ]] && source $HOME/.profile | ||
[[ -s $HOME/.bashrc ]] && source $HOME/.bashrc | ||
|
||
# vim: ft=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# ~/.bashrc: executed by bash(1) for non-login shells. | ||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | ||
# for examples | ||
|
||
# If not running interactively, don't do anything | ||
case $- in | ||
*i*) ;; | ||
*) return;; | ||
esac | ||
|
||
# don't put duplicate lines or lines starting with space in the history. | ||
# See bash(1) for more options | ||
HISTCONTROL=ignoreboth | ||
|
||
# append to the history file, don't overwrite it | ||
shopt -s histappend | ||
|
||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | ||
HISTSIZE=1000 | ||
HISTFILESIZE=2000 | ||
HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"; | ||
|
||
# Prefer US English and use UTF-8 | ||
export LANG="en_US.UTF-8"; | ||
export LC_ALL="en_US.UTF-8"; | ||
|
||
# Don’t clear the screen after quitting a manual page | ||
export MANPAGER="less -X"; | ||
|
||
# check the window size after each command and, if necessary, | ||
# update the values of LINES and COLUMNS. | ||
shopt -s checkwinsize | ||
|
||
# Case-insensitive globbing (used in pathname expansion) | ||
shopt -s nocaseglob; | ||
|
||
# Autocorrect typos in path names when using `cd` | ||
shopt -s cdspell; | ||
|
||
# make less more friendly for non-text input files, see lesspipe(1) | ||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | ||
|
||
# Highlight section titles in manual pages | ||
export LESS_TERMCAP_md="${yellow}"; | ||
|
||
# set a fancy prompt (non-color, unless we know we "want" color) | ||
case "$TERM" in | ||
xterm) [ "$COLORTERM" == "gnome-terminal" ] && color_prompt=yes;; # Ubuntu | ||
xterm-256color) color_prompt=yes;; | ||
esac | ||
|
||
# check for color support | ||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | ||
color_prompt=yes | ||
else | ||
color_prompt=no | ||
fi | ||
|
||
if [ "$color_prompt" = yes ]; then | ||
PS1="\[$(tput bold)$(tput setaf 2)\]\u\[$(tput setaf 7)\]@\[$(tput setaf 4)\]\h:\[$(tput setaf 6)\]\w $ \[$(tput sgr0)\]" | ||
else | ||
PS1='\u@\h:\w\$ ' | ||
fi | ||
unset color_prompt | ||
|
||
# enable color support of ls and also add handy aliases | ||
export CLICOLOR=1 | ||
export LSCOLORS=GxFxCxDxBxegedabagaced | ||
if [ -x /usr/bin/dircolors ]; then | ||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | ||
alias ls='ls --color=auto' | ||
alias grep='grep --color=auto' | ||
alias fgrep='fgrep --color=auto' | ||
alias egrep='egrep --color=auto' | ||
fi | ||
|
||
# colored GCC warnings and errors | ||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' | ||
|
||
# Grep colors | ||
export GREP_OPTIONS='--color=auto' | ||
|
||
# Alias definitions. | ||
if [ -f ~/.bash_aliases ]; then | ||
. ~/.bash_aliases | ||
fi | ||
|
||
# Add tab completion for many Bash commands | ||
if which brew > /dev/null && [ -f "$(brew --prefix)/etc/bash_completion" ]; then | ||
source "$(brew --prefix)/etc/bash_completion"; | ||
elif [ -f /etc/bash_completion ]; then | ||
source /etc/bash_completion; | ||
fi | ||
|
||
# GNU Core utilities | ||
if which brew > /dev/null && [ -d "$(brew --prefix coreutils)/libexec/gnubin" ]; then | ||
export PATH="$PATH:$(brew --prefix coreutils)/libexec/gnubin" | ||
export MANPATH="$MANPATH:$(brew --prefix coreutils)/libexec/gnubin" | ||
fi | ||
|
||
# RVM | ||
[[ -s "${HOME}/.rvm/scripts/rvm" ]] && source "${HOME}/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | ||
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion | ||
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting (needs to be last) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
### Functions ################################################################# | ||
|
||
## Logging stuff. | ||
function e_header() { echo -e "\n\033[1m$@\033[0m"; } | ||
function e_ok() { echo -e " \033[1;32m✔\033[0m $@"; } | ||
function e_error() { echo -e " \033[1;31m✖\033[0m $@"; } | ||
function e_warn() { echo -e " \033[1;33m $@\033[0m"; } | ||
function e_arrow() { echo -e " \033[0;34m➜\033[0m $@"; } | ||
function e_footer() { echo -e "\n\033[1m$@\033[0m\n"; } | ||
|
||
# $1 => error message, $2 => exit code | ||
function e_abort() { e_error $1; exit $2; } | ||
|
||
## OS detection | ||
is_osx() { [[ $(uname) == Darwin ]] || return 1; } | ||
is_linux() { [[ $(uname) == Linux ]] || return 1; } | ||
is_ubuntu() { [[ "$(cat /etc/issue 2> /dev/null)" =~ Ubuntu ]] || return 1; } | ||
|
||
# Start an HTTP server from a directory, optionally specifying the port | ||
server() { | ||
local port="${1:-8000}"; | ||
sleep 1 && 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"; | ||
} | ||
|
||
#Extract most know archives with one command | ||
extract () { | ||
if [ -f $1 ] ; then | ||
case $1 in | ||
*.tar.bz2) tar xjf $1 ;; | ||
*.tar.gz) tar xzf $1 ;; | ||
*.bz2) bunzip2 $1 ;; | ||
*.rar) unrar e $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 | ||
} | ||
|
||
# Make a directory and jump directly into it | ||
mkd() { mkdir -p "$1" && cd "$1" ;} | ||
|
||
## VMware | ||
vmware_install() { | ||
( | ||
cd `mktemp -d` | ||
sudo apt-get --quiet --yes install build-essential linux-headers-$(uname -r) | ||
tar zxvf /media/$(whoami)/"VMware Tools"/VMwareTools-*.tar.gz | ||
sudo ./vmware-tools-distrib/vmware-install.pl -d | ||
) | ||
} | ||
vmware_refresh() { sudo vmware-config-tools.pl -d ;} | ||
|
||
# DOTFILES | ||
# Create links for dotfiles | ||
link_dotfiles(){ | ||
[[ -n $@ ]] || return 1 | ||
|
||
e_header 'Symlinks' | ||
bakdir="$HOME/dotfiles.bak/$(date "+%Y_%m_%d-%H_%M_%S")" | ||
mkdir -p $bakdir && e_ok "Backups will be saved in '$bakdir'\n" | ||
|
||
( | ||
cd $HOME | ||
for dotfile in $@; do | ||
dot=$(basename $dotfile) | ||
old=${HOME}/${dot} | ||
|
||
if [[ -s $old ]]; then # IF old file exists | ||
if [[ -L $old ]]; then # Replace if old file is a symlink | ||
rm $old && \ | ||
ln -sfn $dotfile $old && \ | ||
e_ok "Replaced link for $old to $dotfile" | ||
else # Backup old file if it's not a symlink | ||
mv $old $bakdir && \ | ||
e_ok "$old saved at $bakdir" | ||
ln -s $dotfile $old && \ | ||
e_ok "Linked $old to $dotfile" | ||
fi | ||
else # Create symlink if the oldfile doesn't exist | ||
ln -sfn $dotfile $old && \ | ||
e_ok "Linked $old to $dotfile" | ||
fi | ||
done | ||
) | ||
} | ||
|
||
# vim: ft=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
gem: --no-ri --no-rdoc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[alias] | ||
st = !git fetch && git status | ||
co = checkout | ||
ci = commit | ||
br = branch | ||
mg = merge --no-ff | ||
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all --decorate | ||
smup = !"git fetch && git pull origin master && git submodule foreach --recursive git fetch && git submodule foreach --recursive git pull origin master && git commit -a -m 'Submodule updates' && git push" | ||
cm = !"git add -A; git ls-files --deleted -z | xargs -0 rm -f; git commit -v" | ||
cmm = !"git add -A; git ls-files --deleted -z | xargs -0 rm -f; git commit -m" | ||
wip = !"git add -A; git ls-files --deleted -z | xargs -0 rm -f; git commit -m \"WIP\"" | ||
unwip = !"git log -n 1 | grep -q -c WIP && git reset HEAD~1" | ||
|
||
[core] | ||
autocrlf = false | ||
excludesfile = ~/.gitignore.global | ||
|
||
[color] | ||
ui = auto | ||
diff = auto | ||
status = auto | ||
branch = auto | ||
interactive = auto | ||
grep = auto | ||
|
||
[push] | ||
default = tracking | ||
|
||
[include] | ||
path = ~/.gitconfig.private | ||
|
||
[filter "media"] | ||
required = true | ||
clean = git media clean %f | ||
smudge = git media smudge %f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Private | ||
.vlad | ||
.ssh | ||
.keys | ||
.gem | ||
.dockercfg | ||
.gitconfig.private | ||
|
||
# Ignore any file with '.local' in the name | ||
*.local* | ||
|
||
# Folder view configuration files | ||
.DS_Store | ||
Desktop.ini | ||
|
||
# Thumbnail cache files | ||
._* | ||
Thumbs.db | ||
|
||
# Files that might appear on external disks | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
# Vim | ||
[._]*.s[a-w][a-z] | ||
[._]s[a-w][a-z] | ||
*.un~ | ||
Session.vim | ||
.netrwhist | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
syntax: glob | ||
.#* | ||
[#]*# | ||
*~ | ||
.*.sw? | ||
.sw? | ||
Session.vim | ||
tags | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
.AppleDouble | ||
scratch.* |
Oops, something went wrong.