Skip to content

Instantly share code, notes, and snippets.

@peleteiro
Created January 23, 2012 15:45
Show Gist options
  • Save peleteiro/1663889 to your computer and use it in GitHub Desktop.
Save peleteiro/1663889 to your computer and use it in GitHub Desktop.
--type-add
css=scss
--type-add
ruby=slim
# Bash functions
if [ -f ~/.bash_functions ]; then
source ~/.bash_functions
fi
# setup some basic variables
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export HOMEBREW_LLVM=true
: ${HOME=~}
: ${LOGNAME=$(id -un)}
: ${UNAME=$(uname)}
# Compilation
export ARCHFLAGS="-arch x86_64"
# PATH
export PATH=~/.cabal/bin:/usr/local/bin:/usr/local/sbin:$PATH
# bash-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
if [ -d ~/.bash_completion.d ]; then
for file in ~/.bash_completion.d/*; do
source $file
done
fi
# virtualenv
export WORKON_HOME=$HOME/.virtualenv
source /usr/local/bin/virtualenvwrapper.sh
# rvm
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
# npm setup
export NODE_PATH=/usr/local/lib/node
export PATH=$PATH:~/node_modules/.bin
# Java
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home/"
# Hadoop
export HADOOP_INSTALL=`brew --prefix hadoop`/libexec
export HBASE_INSTALL=`brew --prefix hbase`
export PIG_INSTALL=`brew --prefix pig`
export ZOOKEEPER_INSTALL=`brew --prefix zookeeper`/libexec
# AWS
export EC2_HOME=`brew --prefix ec2-api-tools`/jars
export AWS_AUTO_SCALING_HOME=`brew --prefix as-api-tools`/
export AWS_CLOUDWATCH_HOME=`brew --prefix cloud-watch`/jars
export EC2_AMITOOL_HOME=`brew --prefix ec2-ami-tools`/jars
export AWS_ELB_HOME=`brew --prefix elb-tools`/jars
# editor
export EDITOR='vim'
export VISUAL='vim'
# bash prompt
export HISTCONTROL=ignoredups
export CLICOLOR=true
export LSCOLORS=gxfxcxdxbxegedabagacad
export PS1='\[\033[01;32m\]\w\[\e[m\]\[\e[1;34m\]$(__bundler_ps1 " [%s]")$(__git_ps1 )\[\e[m\]\[\e[m\]\$ '
# Misc
export PAGER='less'
export CLICOLOR='yes'
export INPUTRC='~/.inputrc'
export PATH=~/bin:$PATH
# Alias ###################################################################
alias vim='mvim -v'
alias cdd='cd - ' # goto last dir cd'ed from
alias ts='date +%Y%m%d%H%M%S'
alias screen='screen -R'
# Virtuoso
alias virtuoso-start='cd `brew --prefix virtuoso`/var/lib/virtuoso/db; virtuoso-t -f'
# Postgresql
alias pg-start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias pg-stop='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
# Emacs
alias em='/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -q -n'
#!bash
#
# git-flow-completion
# ===================
#
# Bash completion support for launchctl (mostly)
#
#
# Installation
# ------------
#
# 1. Install this file. Either:
#
# a. Place it in a `bash-completion.d` folder:
#
# * /etc/bash-completion.d
# * /usr/local/etc/bash-completion.d
# * ~/bash-completion.d
#
# b. Or, copy it somewhere (e.g. ~/.launchctl-completion.sh) and put the following line in
# your .bashrc:
#
# source ~/.launchctl-completion.sh
#
#
#
# The Fine Print
# --------------
#
# Copyright (c) 2010 [Justin Hileman](http://justinhileman.com)
#
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
__launchctl_list_labels ()
{
launchctl list | tail -n +2 | grep -v -P "0x[0-9a-fA-F]+\.(anonymous|mach_init)\." | awk '{print $3}'
}
__launchctl_list_started ()
{
launchctl list | tail -n +2 | grep -v "^-" | grep -v -P "0x[0-9a-fA-F]+\.(anonymous|mach_init)\." | awk '{print $3}'
}
__launchctl_list_stopped ()
{
launchctl list | tail -n +2 | grep "^-" | grep -v -P "0x[0-9a-fA-F]+\.(anonymous|mach_init)\." | awk '{print $3}'
}
_launchctl ()
{
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
# Subcommand list
local subcommands="load unload submit remove start stop list help"
[[ ${COMP_CWORD} -eq 1 ]] && {
COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
return
}
case "$prev" in
remove|list)
COMPREPLY=( $(compgen -W "$(__launchctl_list_labels)" -- ${cur}) )
return
;;
start)
COMPREPLY=( $(compgen -W "$(__launchctl_list_stopped)" -- ${cur}) )
return
;;
stop)
COMPREPLY=( $(compgen -W "$(__launchctl_list_started)" -- ${cur}) )
return
;;
load|unload)
COMPREPLU=( $(compgen -d $(pwd)) )
return
;;
esac
}
complete -F _launchctl launchctl
#!/bin/bash
_vagrant()
{
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version"
if [ $COMP_CWORD == 1 ]
then
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
return 0
fi
if [ $COMP_CWORD == 2 ]
then
case "$prev" in
"box")
box_commands="add help list remove repackage"
COMPREPLY=($(compgen -W "${box_commands}" -- ${cur}))
return 0
;;
"help")
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
return 0
;;
*)
;;
esac
fi
if [ $COMP_CWORD == 3 ]
then
action="${COMP_WORDS[COMP_CWORD-2]}"
if [ $action == 'box' ]
then
case "$prev" in
"remove"|"repackage")
local box_list=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ')
COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
return 0
;;
*)
;;
esac
fi
fi
}
complete -F _vagrant vagrant
function __bundler_ps1 {
if [ -n "${BUNDLE_GEMFILE-}" ]; then
project_path="${BUNDLE_GEMFILE%/Gemfile}"
project_name="${project_path##**/}"
if [ -n "${1-}" ]; then
printf "$1" "${project_name}"
else
printf " (%s)" "${project_name}"
fi
fi
}
function proj() {
if [ -z "$*" ]; then
[ `pwd` == '/' ] && return
[ -e .git ] && return
cd ..
proj
fi
proj_dir=`find ~/Projects -path "*/$*/.git"`
[ -z $proj_dir ] && echo "Projeto $* não encontrado" && return 1
cd $proj_dir/..
}
# vim: set ft=bash
---
:benchmark: false
:verbose: true
:update_sources: true
gem: --no-rdoc --no-ri
gemcutter_key: 0b034f37e6fa658c9e1810e4fc2a8407
:sources:
- http://rubygems.org
:backtrace: false
:bulk_threshold: 1000
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
rvm_trust_rvmrcs_flag=1
rvm_gemset_create_on_use_flag=1
rvm_project_rvmrc_default=1
# don't display the copyright page
startup_message off
# UTF stuff
setenv LC_CTYPE en_US.UTF-8
defutf8 on
# Obvious...
startup_message off
autodetach on
vbell off
shell -/bin/bash
term xterm-color
# My awesome hardstatus d-:
hardstatus alwayslastline "%{=b kW}[ %{= Y}$USER @ %H %{b W}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{b W}][%{= Y} %l %{b W}][%{= Y} %d/%m %{Y}%c %{b W}]"
# Double-check to force the focus to irssi after boot
select 0
# Use ALT-; and ALT-' to switch to previous and next window, respectively
bindkey "^[;" prev
bindkey "^['" next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment