2013-08-22 19:28:44 +00:00
|
|
|
shopt -s checkwinsize #Pour pas s'écrire dessus
|
2013-06-02 11:02:37 +00:00
|
|
|
shopt -s histappend
|
|
|
|
PROMPT_COMMAND='history -a'
|
|
|
|
|
2013-07-30 23:01:39 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
#####ON DEFINIT LES COULEURS
|
|
|
|
red='\033[31m'
|
|
|
|
RED='\033[31m\033[01m'
|
|
|
|
blue='\033[34m'
|
|
|
|
BLUE='\033[34m'
|
|
|
|
cyan='\033[36m'
|
|
|
|
CYAN='\033[36m'
|
|
|
|
magenta='\033[35m'
|
|
|
|
DFT='\033[0m'
|
|
|
|
white='\033[37m'
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
#####ON DÉFINIT LE TITRE DE LA FENETRE PAR LE REP EN COURS
|
2013-06-01 23:09:59 +00:00
|
|
|
case "$TERM" in
|
|
|
|
xterm*|rxvt*)
|
2013-08-22 19:28:44 +00:00
|
|
|
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
|
|
|
|
;;
|
2013-06-01 23:09:59 +00:00
|
|
|
*)
|
2013-08-22 19:28:44 +00:00
|
|
|
;;
|
2013-06-01 23:09:59 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
#####LA COULEUR DU SHELL
|
|
|
|
#PS1="$RED\u$DFT$white@$magenta\h $DFT>>$CYAN\w $DFT"
|
|
|
|
#PS1="\u@\h >>\w "
|
|
|
|
#PS1="\[$RED\u$DFT$white@$magenta\h $DFT>>$CYAN\w $DFT\]"
|
|
|
|
#PS1="\[$RED\]\u\[$DFT$white\]@\[$magenta\]\h \[$DFT\]>>\[$CYAN\]\w \[$DFT\]"
|
|
|
|
#PROMPT_COMMAND='history -a;echo -en "\033[m\033[38;5;2m"$(( `sed -nu "s/MemFree:[\t ]\+\([0-9]\+\) kB/\1/p" /proc/meminfo`/1024))"\033[38;5;22m/"$((`sed -nu "s/MemTotal:[\t ]\+\([0-9]\+\) kB/\1/Ip" /proc/meminfo`/1024 ))MB"\t\033[m\033[38;5;55m$(< /proc/loadavg)\033[m"'
|
|
|
|
|
2013-07-29 16:34:39 +00:00
|
|
|
if [ "$HOSTNAME" == "chuck" ]; then
|
|
|
|
MY_HOST_COL='[31m' #ugly !
|
|
|
|
else
|
|
|
|
MY_HOST_COL='[34m'
|
|
|
|
fi
|
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
#PS1='\[\e[0;36m\]\t \[\e[1;30m\][\[\e$MY_HOST_COL\]\u@\H\[\e[1;30m\]\[\e[0;32m\]\[\e[1;30m\]] \[\e[1;37m\]\w\[\e[0;37m\] \n$ '
|
|
|
|
source ~/.bash_ps1
|
2013-07-29 16:34:39 +00:00
|
|
|
|
|
|
|
#PS1='\[\e[0;36m\] \T \[\e[1;30m\][\[\e$MY_HOST_COL\]\u@\H\[\e[1;30m\]\[\e[0;32m\]\[\e[1;30m\]] \[\e[1;37m\]\w\[\e[0;37m\] \n$ '
|
2013-06-01 23:09:59 +00:00
|
|
|
|
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
###############
|
|
|
|
#### ALIAS ####
|
|
|
|
###############
|
|
|
|
# {{{
|
2013-06-01 23:09:59 +00:00
|
|
|
alias ..='cd ..'
|
2013-06-04 16:43:31 +00:00
|
|
|
alias vf='cd'
|
|
|
|
alias xs='cd'
|
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
alias rm='rm -i'
|
|
|
|
alias cp='cp -i'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
alias mv='mv -i'
|
|
|
|
alias vm='mv -i'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
|
|
|
alias df='dfc'
|
|
|
|
alias free='freec'
|
2013-06-01 23:09:59 +00:00
|
|
|
alias shred='shred -n 35 -z -u -v -f'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
if [ "$TERM" != "dumb" ]; then
|
|
|
|
eval "`dircolors -b`"
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
fi
|
2013-06-01 23:09:59 +00:00
|
|
|
alias sl='ls'
|
|
|
|
alias la='ls -lah'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
|
|
|
|
alias sudp='sudo' #fuck tpyos :p
|
|
|
|
alias sudpo='sudo'
|
|
|
|
|
|
|
|
#alias pacman='pacman-color'
|
|
|
|
alias pacmacn='pacman'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
alias grep='grep --color'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-06-28 16:05:24 +00:00
|
|
|
alias b+='xbacklight -inc 10% -steps 1 -time 0'
|
|
|
|
alias b-='xbacklight -dec 10% -steps 1 -time 0'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
alias svim='sudo vim'
|
|
|
|
alias bim='vim'
|
|
|
|
alias vi='vim'
|
2013-07-30 15:20:58 +00:00
|
|
|
alias VIM='vim'
|
2013-07-30 23:01:39 +00:00
|
|
|
alias ivm='vim'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
alias gl='git log --graph --abbrev-commit --pretty=oneline --decorate'
|
|
|
|
alias gitst='git status'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
alias poule='git pull'
|
|
|
|
alias makew='make'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
|
|
|
alias BSI2='cd ~/Documents/UniGE/BSI2*/'
|
2013-06-04 16:56:56 +00:00
|
|
|
|
2013-08-22 14:26:45 +00:00
|
|
|
OCTOPUS=~/.my_utils/octopus.sh
|
2013-06-11 21:26:08 +00:00
|
|
|
alias dual='$OCTOPUS monitor dual'
|
|
|
|
alias laptop='$OCTOPUS monitor laptop'
|
|
|
|
alias extern='$OCTOPUS monitor extern'
|
|
|
|
|
|
|
|
alias volup='$OCTOPUS volume up'
|
|
|
|
alias voldown='$OCTOPUS volume down'
|
|
|
|
alias volmute='$OCTOPUS volume mute'
|
|
|
|
|
2013-06-14 17:13:19 +00:00
|
|
|
alias suspend='$OCTOPUS suspend'
|
|
|
|
|
2013-06-16 16:52:23 +00:00
|
|
|
alias mfilms='cd /dev/shm && mkdir films && sshfs frank@vi-di.fr:/media/ films/'
|
|
|
|
|
2013-06-22 18:48:25 +00:00
|
|
|
alias upgrub='sudo grub-mkconfig -o /boot/grub/grub.cfg'
|
|
|
|
|
2013-07-30 23:01:39 +00:00
|
|
|
alias upkey='gpg --keyserver subkeys.pgp.net --send-key 6F36914A'
|
2013-08-04 15:50:26 +00:00
|
|
|
alias shm='cd /dev/shm'
|
2013-06-11 21:26:08 +00:00
|
|
|
|
2013-08-21 16:22:38 +00:00
|
|
|
alias ip6='ip -6'
|
|
|
|
|
2013-08-22 10:15:15 +00:00
|
|
|
alias disk-usage-analyser='baobab'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-06-01 23:09:59 +00:00
|
|
|
|
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
###############
|
|
|
|
## FONCTIONS ##
|
|
|
|
###############
|
|
|
|
# {{{
|
2013-06-01 23:09:59 +00:00
|
|
|
function cd()
|
|
|
|
{
|
2013-08-22 19:28:44 +00:00
|
|
|
# {{{
|
2013-06-01 23:09:59 +00:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
builtin cd ~ && ls
|
|
|
|
else
|
|
|
|
builtin cd "$*" && ls
|
|
|
|
fi
|
|
|
|
}
|
2013-08-22 19:28:44 +00:00
|
|
|
#}}}
|
2013-06-01 23:09:59 +00:00
|
|
|
|
2013-08-22 10:15:15 +00:00
|
|
|
alias ssh='hh'
|
2013-08-22 19:28:44 +00:00
|
|
|
function hh
|
|
|
|
{ # {{{
|
2013-08-22 10:15:15 +00:00
|
|
|
ssh-add -l | grep id_rsa.auth > /dev/null
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo -e "$RED Please enter ssh passphrase ;) $DFT"
|
|
|
|
ssh-add ~/.ssh/id_rsa.auth
|
|
|
|
fi;
|
|
|
|
"/usr/bin/ssh" "$*"
|
|
|
|
}
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-08-22 10:15:15 +00:00
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
function logs
|
|
|
|
{ # {{{
|
2013-06-01 23:09:59 +00:00
|
|
|
tail -f $1 | ccze -A
|
|
|
|
}
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-06-01 23:09:59 +00:00
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
function mkcd()
|
|
|
|
{ # {{{
|
2013-06-01 23:09:59 +00:00
|
|
|
mkdir -p "$@"
|
|
|
|
cd "$@"
|
|
|
|
}
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-06-02 11:02:37 +00:00
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
extract()
|
|
|
|
{ # {{{
|
2013-06-02 11:02:37 +00:00
|
|
|
local e=0 i c
|
|
|
|
for i; do
|
|
|
|
if [ -f $i && -r $i ]; then
|
|
|
|
c=
|
|
|
|
case $i in
|
|
|
|
*.tar.bz2) c='tar xjf' ;;
|
|
|
|
*.tar.gz) c='tar xzf' ;;
|
|
|
|
*.bz2) c='bunzip2' ;;
|
|
|
|
*.gz) c='gunzip' ;;
|
|
|
|
*.tar) c='tar xf' ;;
|
|
|
|
*.tbz2) c='tar xjf' ;;
|
|
|
|
*.tgz) c='tar xzf' ;;
|
|
|
|
*.7z) c='7z x' ;;
|
|
|
|
*.Z) c='uncompress' ;;
|
|
|
|
*.exe) c='cabextract' ;;
|
|
|
|
*.rar) c='unrar x' ;;
|
|
|
|
*.xz) c='unxz' ;;
|
|
|
|
*.zip) c='unzip' ;;
|
|
|
|
*) echo "$0: cannot extract \`$i': Unrecognized file extension" >&2; e=1 ;;
|
|
|
|
esac
|
|
|
|
[ $c ] && command $c "$i"
|
|
|
|
else
|
|
|
|
echo "$0: cannot extract \`$i': File is unreadable" >&2; e=2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return $e
|
|
|
|
}
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
|
|
|
# }}}
|
2013-08-22 10:15:15 +00:00
|
|
|
|
|
|
|
SSHAGENT=/usr/bin/ssh-agent
|
|
|
|
SSHAGENTARGS="-s"
|
|
|
|
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
|
|
|
|
eval `$SSHAGENT $SSHAGENTARGS`
|
|
|
|
trap "kill $SSH_AGENT_PID" 0
|
|
|
|
fi
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
###############
|
|
|
|
### EXPORTS ###
|
|
|
|
###############
|
|
|
|
# {{{
|
|
|
|
export EDITOR="vim"
|
|
|
|
|
|
|
|
GPG_TTY=`tty`
|
|
|
|
export GPG_TTY
|
|
|
|
export GPGKEY=6F36914A
|
|
|
|
|
|
|
|
export PYTHONPATH=/usr/local/lib/python2.7/dist-packages
|
|
|
|
export CC=clang
|
|
|
|
|
|
|
|
export DEVKITPRO=/opt/devkitpro
|
|
|
|
export DEVKITARM=$DEVKITPRO/devkitARM
|
|
|
|
export PATH=$PATH:$DEVKITARM/bin
|
|
|
|
export MANPATH=$MANPATH:$DEVKITARM/man
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
#Launch startx when login
|
|
|
|
[[ -z $DISPLAY && $XDG_VTNR -le 4 && -z $SSH_CLIENT ]] && exec startx
|