bastos (owner)

Revisions

gist: 23961 Download_button fork
public
Description:
my .bashrc with lots of dotfiles.org stuff :D
Public Clone URL: git://gist.github.com/23961.git
Embed All Files: show embed
bashrc #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# If not running interactively, don't do anything
# [ -z "$PS1" ] && return
 
export EDITOR=emacsclient
 
export IOKE_HOME=~/code/ioke
 
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth
 
# check the 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 "$(lesspipe)"
 
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac
 
force_colored_prompt=yes
 
if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
    else
color_prompt=
    fi
fi
 
unset color_prompt force_color_prompt
 
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
*)
    ;;
esac
 
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
 
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias iso2utf='iconv -f iso-8859-1 -t utf-8'
alias utf2iso='iconv -f utf-8 -t iso-8859-1'
alias config-data='sudo ntpdate -u -b ntp.usp.br' # ajusta data pela rede
# list 10 biggest files in current path
alias big_files="BLOCKSIZE=1048576; du -x | sort -nr | head -10"
alias ..="cd .."
alias ...="cd ../.."
alias gemi='sudo gem install --no-rdoc --no-ri'
alias e='emacs'
alias ec='emacsclient'
 
if [ -f /etc/bash_completion.d/git ]; then
    . /etc/bash_completion.d/git
fi
 
reload()
{
  source ~/.bashrc
}
 
shot ()
{
  import -w root -quality 75 "$HOME/shot-$(date +%s).png"
}
 
# compressed file excractor
 
extract () {
     if [ -f $1 ] ; then
         case $1 in
             *.tar.bz2) tar xvjf $1 ;;
             *.tar.gz) tar xvzf $1 ;;
             *.bz2) bunzip2 $1 ;;
             *.rar) unrar x $1 ;;
             *.gz) gunzip $1 ;;
             *.tar) tar xvf $1 ;;
             *.tbz2) tar xvjf $1 ;;
             *.tgz) tar xvzf $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
}
 
bz2 () {
tar cvpjf $1.tar.bz2 $1
}
 
# Services
 
rcstart()
{
    for arg in $*
    do
        sudo /etc/rc.d/$arg start
    done
}
 
rcstop()
{
        for arg in $*
        do
        sudo /etc/rc.d/$arg stop
    done
}
 
rcrestart()
{
        for arg in $*
        do
        sudo /etc/rc.d/$arg restart
    done
}
 
rcreload()
{
        for arg in $*
        do
        sudo /etc/rc.d/$arg reload
    done
}