Skip to content

Commit

Permalink
Updated settings
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoremac committed Jun 27, 2014
1 parent ca6c1e2 commit c652082
Show file tree
Hide file tree
Showing 15 changed files with 312 additions and 545 deletions.
84 changes: 84 additions & 0 deletions .bash_aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#### Aiases ####
# Reload this file due to frequent edits
alias reload='source ~/.bashrc'

#enable color support of ls and also add handy aliases
#enable color support of ls and also add handy aliases
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color=auto"
else # OS X `ls`
colorflag="-G"
fi

alias ls='ls ${colorflag}'
alias grep='grep ${colorflag}'
alias fgrep='fgrep ${colorflag}'
alias egrep='egrep ${colorflag}'

alias lx='ls -lXB ${colorflag}' # sort by extension
alias lk='ls -lSr ${colorflag}' # sort by size
alias lm='ls -alh |more' # pipe through 'more'
alias lsd='ls -lh | grep "^d"' # list only directories
alias lsl='ls -lh | grep "^l"' # list only links

# list long, human readable, ignore implied~,
# ignore compiled python files
alias ll='ls -hlB --group-directories-first --hide=*.pyc'

# list including .dotfiles
alias lsa='ls -lAh --group-directories-first'
alias lz="ls -lZ" # SELinux display

## directory aliases
alias mkdir='mkdir -p' #Make intermediaries

# Disk usage
alias du="du -h"

# Grepping
alias h="history | grep"

# emacs modes
alias gemacs="emacs-snapshot-gtk"
alias nemacs="emacs -nw"

# maven stuff
alias mvnc="mvn clean && mvn -Dmaven.test.skip=true install"

# moving aliases
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../../'
alias downloads='cd ~/downloads'

# apt aliases
alias ainstall='sudo apt-get install'

# Misc
alias rtfm='man'

# Verify mvn build
alias verify='mvn checkstyle:checkstyle checkstyle:check pmd:pmd pmd:check && mvn test -T4'

# Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm update npm -g; npm update -g; sudo gem update --system; sudo gem update'

# 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 \/.*\""

# Enhanced WHOIS lookups
alias whois="whois -h whois-servers.net"

# 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"

# Show/hide hidden files in Finder
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"

# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
31 changes: 31 additions & 0 deletions .bash_exports
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Default editor
export EDITOR="emacs -nw -q"

# History settings file size
export HISTSIZE=32768;
export HISTFILESIZE=$HISTSIZE;
export HISTCONTROL=ignoredups;

# Make some commands not show up in history
export 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";

# Always enable colored `grep` output
export GREP_OPTIONS="--color=auto";

### THIS MACHINE SPECIFIC STUFF ####
export M2=~/.m2/repository
export WORKON_HOME=~/Envs

#### PATH ####
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export PATH=$PATH:~/bin:/usr/local/go/bin
export PATH=$PATH:/usr/local/share/npm/bin
export LD_LIBRARY_PATH=`pwd`

24 changes: 24 additions & 0 deletions osx/.bash_function → .bash_function
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,28 @@ function catorls () {
}
alias cat="catorls"

# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
}

# Get a character’s Unicode code point
function codepoint() {
perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))";
# print a newline unless we’re piping the output to another program
if [ -t 1 ]; then
echo ""; # newline
fi;
}

# Decode \x{ABCD}-style Unicode escape sequences
function unidecode() {
perl -e "binmode(STDOUT, ':utf8'); print \"$@\"";
# print a newline unless we’re piping the output to another program
if [ -t 1 ]; then
echo ""; # newline
fi;
}
106 changes: 35 additions & 71 deletions linux/.bashrc → .bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -8,92 +8,57 @@ esac

UNAME=uname

### THIS MACHINE SPECIFIC STUFF ####
export M2=~/.m2/repository
export WORKON_HOME=~/Envs
export ANDROID_HOME=~/workspace/java/android-sdk-linux
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# Reload this file due to frequent edits
alias reload='source ~/.bashrc'
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac

#### PATH ####
export PATH=$PATH:~/bin:$ANDROID_HOME/tools:/usr/local/go/bin
export LD_LIBRARY_PATH=`pwd`
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

#
# Stuff local to the environment
# This isn't checked into version control
if [ -f ~/.bash_local ]; then
. ~/.bash_local
fi
# Load all extra files
#
# Put anything that only exists on the local environment into local
#
for file in ~/.{bash_prompt,bash_exports,bash_aliases,bash_function,bash_local}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;


#######################################################
#### Defaults ####
#######################################################

# Default editor
export EDITOR="emacs -nw -q"

#enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi

# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# History settings file size
HISTSIZE=1000
HISTFILESIZE=2000
# Autocorrect typos in path names when using `cd`
shopt -s cdspell;

# Check window size after each command and, if necessary,
# update the values of LINES and COLUMNS
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# local aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# 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;

# Bash functions
if [ -f ~/.bash_function ]; then
. ~/.bash_function
fi

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# Enable tab completion for `g` by marking it as an alias for `git`
if type _git &> /dev/null && [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
complete -o default -o nospace -F _git g;
fi;

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac

### Completion ###
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

# Support for multiple interpreters.
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# Goodbye Grep
which ack > /dev/null
Expand All @@ -116,7 +81,6 @@ if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
source /usr/local/bin/virtualenvwrapper.sh
fi

# Sexy Bash Prompt
if [ -f ~/.bash_prompt ]; then
. ~/.bash_prompt
fi
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
File renamed without changes.
1 change: 1 addition & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ -n "$PS1" ] && source ~/.bash_profile;
101 changes: 101 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[user]
name = gnoremac
email = cgandevia@gmail.com
[push]
default = simple

[alias]

# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit

# View the current working tree status using the short format
s = status -s

# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"

# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"

[apply]

# Detect whitespace errors when applying a patch
whitespace = fix

[core]

# Use custom `.gitignore` and `.gitattributes`
excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes

# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space

# Make `git rebase` safer on OS X
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
trustctime = false

[color]

# Use colors in Git commands that are capable of colored output when
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
ui = auto

[color "branch"]

current = yellow reverse
local = yellow
remote = green

[color "diff"]

meta = yellow bold
frag = magenta bold # line info
old = red # deletions
new = green # additions

[color "status"]

added = yellow
changed = green
untracked = cyan

[diff]

# Detect copies as well as renames
renames = copies

[help]

# Automatically correct and execute mistyped commands
autocorrect = 1

[merge]

# Include summaries of merged commits in newly created merge commit messages
log = true

# URL shorthands

[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:"
Loading

0 comments on commit c652082

Please sign in to comment.