Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaime Melis committed Sep 17, 2012
0 parents commit 77d4501
Show file tree
Hide file tree
Showing 7 changed files with 389 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .bash_aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
alias ll='ls -lh'
alias la='ls -halrt'
alias l='ls -hlrt'
alias grep='grep --color=auto'
alias less='less -r'
alias forget='unset HISTFILE'
alias tree='tree -CF'
alias mtr='mtr -t'

# alias lspwd='realpath -s'
# alias diff='colordiff -u'
alias vi='vim'

# Git
alias git-graph='git log --oneline --graph --decorate'
alias gs='git status'
alias gl='git log'
alias gsl='git sl'
alias gslhead='gsl|head'
alias gr='gitroot'

#opennebula
export ONE_AUTH=$HOME/.one/auth
echo 'oneadmin:-' > $ONE_AUTH

function one_env {
#!/bin/bash

DATE=$(date "+%Y%m%d%H%M%S")
PID=$$

TEMPFILE=/tmp/one-$PID-$DATE

cat <<EOF > $TEMPFILE
export ONE_LOCATION=$(pwd)
export ONE_AUTH=\$ONE_LOCATION/.one-auth
export ONE_XMLRPC=http://localhost:2633/RPC2
export PATH=\$ONE_LOCATION/bin:\$PATH
echo oneadmin:- > \$ONE_AUTH
function onelog {
if [ -n "\$1" ]; then
vm=\$1
if echo \$vm|grep -qE '^[0-9]+$'; then
if [ -f $ONE_LOCATION/var/$vm/vm.log ]; then
less $ONE_LOCATION/var/$vm/vm.log
else
echo "The log for the VM '\$vm' does not exist."
fi
else
echo "'\$vm' is not a valid VM identifier."
fi
else
less \$ONE_LOCATION/var/oned.log
fi
}
#. \$HOME/.one-bash_completion
EOF

source $TEMPFILE
rm $TEMPFILE
}


function delkey {
line=$1
sed -i "${line}d" ~/.ssh/known_hosts
}

function gitroot {
ROOTDIR=`git rev-parse --show-cdup 2>/dev/null`
test -n "$ROOTDIR" && cd $ROOTDIR
}


function set_one_auth {
TMP=$(mktemp)
echo "$1" > $TMP
export ONE_AUTH=$TMP
}
46 changes: 46 additions & 0 deletions .bash_colors
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# colors
txtblk='\[\e[0;30m\]' # Black - Regular
txtred='\[\e[0;31m\]' # Red
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
txtblu='\[\e[0;34m\]' # Blue
txtpur='\[\e[0;35m\]' # Purple
txtcyn='\[\e[0;36m\]' # Cyan
txtwht='\[\e[0;37m\]' # White
bldblk='\[\e[1;30m\]' # Black - Bold
bldred='\[\e[1;31m\]' # Red
bldgrn='\[\e[1;32m\]' # Green
bldylw='\[\e[1;33m\]' # Yellow
bldblu='\[\e[1;34m\]' # Blue
bldpur='\[\e[1;35m\]' # Purple
bldcyn='\[\e[1;36m\]' # Cyan
bldwht='\[\e[1;37m\]' # White
unkblk='\[\e[4;30m\]' # Black - Underline
undred='\[\e[4;31m\]' # Red
undgrn='\[\e[4;32m\]' # Green
undylw='\[\e[4;33m\]' # Yellow
undblu='\[\e[4;34m\]' # Blue
ndpur='\[\e[4;35m\]' # Purple
undcyn='\[\e[4;36m\]' # Cyan
undwht='\[\e[4;37m\]' # White
bakblk='\[\e[40m\]' # Black - Background
bakred='\[\e[41m\]' # Red
badgrn='\[\e[42m\]' # Green
bakylw='\[\e[43m\]' # Yellow
bakblu='\[\e[44m\]' # Blue
bakpur='\[\e[45m\]' # Purple
bakcyn='\[\e[46m\]' # Cyan
bakwht='\[\e[47m\]' # White
txtrst='\[\e[0m\]' # Text Reset

man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
58 changes: 58 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Check for an interactive session
[ -z "$PS1" ] && return

# history
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
export HISTCONTROL=ignoreboth
export HISTFILESIZE=1000000
export HISTSIZE=1000000
export HISTTIMEFORMAT='%F %T '
shopt -s histappend

# hostname
export HOSTNAME=`hostname`

# detect OS
OS=`uname -s`
[ "$OS" = "Darwin" ] && Mac=y
[ "$OS" = "Linux" ] && Linux=y

# safe_load
function safe_load {
for file in "$@"; do
if [ -f "$file" ];then
source "$file"
fi
done
return 0
}

# bash completion
test -n "$Linux" && safe_load /etc/bash_completion
test -n "$Mac" && safe_load /usr/local/etc/bash_completion

# colors
safe_load ~/.bash_colors

# exit_status
function get_exit_status {
status=`echo $?`
if [ `echo $status` != "0" ]; then
exit_status="($status)"
else
exit_status=""
fi
}

HOST_PROMPT="${bldgrn}\h${txtrst} "
PROMPT_COMMAND='get_exit_status'
GIT_PS1_SHOWDIRTYSTATE=1
PS1="${HOST_PROMPT}${bldred}>\${exit_status}${txtrst} ${bldcyn}\W${txtrst} ${bldpur}\$(__git_ps1 '(%s)')${txtrst} $ "

#env variables
export EDITOR=/usr/bin/vi
export PATH=$HOME/bin:/sbin:/usr/bin/perlbin/vendor/:$HOME/.cabal/bin:$PATH
export BROWSER=chromium

# bash_aliases
safe_load ~/.bash_aliases
30 changes: 30 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[user]
name = Jaime Melis
email = jmelis@opennebula.org
[color]
ui = auto
wtf = auto
[gist]
private = true
browse = false
[push]
default = current
[alias]
slog = log --abbrev-commit --oneline
sl = log --abbrev-commit --oneline
cx = cherry-pick -x
st = status
br = branch
s = status
co = checkout
nb = checkout -b
ack = !git-ack
find = !git-find
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
lol = log --oneline --graph --decorate
lola = log --oneline --graph --decorate --all
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
[gui]
spellingdictionary = none
[credential]
helper = cache
82 changes: 82 additions & 0 deletions .screenrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #

### Created by Brad Sims 25/06/2004

### I got tired of .screenrc's on the internet being so
### poorly commented... So being a good GNUbie I took matters
### into my own hands; and wrote this dotfile.

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #

## Explanation of hardstatus line ##

# Ignore the ' marks if you use these examples for yourself

# Note that if you want to use the color brown under konsole
# You actually use bright yellow (%{Y}).

# Note the embeded space after the colon, I feel
# it just looks nicer with a blank between the
# text and console edge:
# '%{=b}%{G} Screen(s): '

# This prints the window listing in blue:
# '%{b}%w'

# This right-aligns what follows:
# '%='

# This displays the time (hours and minutes) in 12hr format
# and adds an AM/PM flag, in bold green:
# '%{G}%C%A'

# This displays the day of the week:
# '%D'

#This displays the date in Mon/day/year format:
# and again I embeded a space to give me one space
# between the text and console edge:
# '%M/%d/%Y '

# The resulting command give you a status line that
# looks like this:
# | Screen(s): 0* bash 5:30PM Fri, Jun/25/2004 |
# (The pipes indicate the edges of the xterm/console).

# Green text, time, and date; windows in blue:
#hardstatus alwayslastline "%{=b}%{G} Screen(s): %{b}%w %=%{kG}%C%A %D, %M/%d/%Y "
hardstatus alwayslastline "%{=b}%{B}%w"

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #

## Some general options ##

# Turn off start message:
startup_message off

# Set messages timeout to one second:
msgwait 1

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #

## Keybindings ##

# bind F7 to detach screen session from this terminal
# bind F8 to kill current screen window.
# bind F9 to create a new screen
# bind F10 to rename current screen window
# bind F11 to move to previous window
# bind F12 to move to next window
#bindkey -k k7 detach
#bindkey -k k8 kill
#bindkey -k k9 screen
#bindkey -k k; title
bindkey -k k7 prev
bindkey -k k8 next

# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #

vbell off
defscrollback 5000

bind b eval "writebuf" "exec sh -c 'xclip /tmp/screen-exchange'"
20 changes: 20 additions & 0 deletions .tmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
#
unbind C-b
set -g prefix C-a
#
#
set-window-option -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-option -g mouse-resize-pane on
#
#
#
bind -n C-left select-pane -L
bind -n C-right select-pane -R
bind -n C-up select-pane -U
bind -n C-down select-pane -D

bind -n C-n swap-window -t +1
bind -n C-p swap-window -t -1
72 changes: 72 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
syntax on
set ts=4
set sw=4
set sts=4
set et
set ai
set hlsearch
set bg=dark
"set ic
set foldlevelstart=99
set hidden
"set colorcolumn=80

hi ColorColumn ctermbg=3 guibg=#888

" Press F4 to toggle highlighting on/off, and show current value.
noremap <F4> :set hlsearch! hlsearch?<CR>
noremap <F12> @@<CR>

let mapleader = ","
map <leader>d :execute 'NERDTreeToggle ' . getcwd()<CR>
map <F9> <ESC>:tabprevious<CR>
map <F10> <ESC>:tabnext<CR>
map! <F9> <ESC>:tabprevious<CR>
map! <F10> <ESC>:tabnext<CR>
"inoremap <up> g<up>
"inoremap <down> g<down>

map <m-left> <ESC>:tabprevious<CR>
map <m-right> <ESC>:tabnext<CR>
map! <m-left> <ESC>:tabprevious<CR>
map! <m-right> <ESC>:tabnext<CR>
map <C-s> :w<CR>
cabbr te tabedit
cabbr ff FufFile

" highlight ExtraWhitespace ctermbg=red guibg=red
" match ExtraWhitespace /\s\+$/
" match ErrorMsg '\%>80v.\+'

" NERDTree
let NERDTreeShowBookmarks=1

nnoremap j gj
nnoremap k gk
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
" Remember last position
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction

augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END

0 comments on commit 77d4501

Please sign in to comment.