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
|
2013-09-18 22:43:50 +00:00
|
|
|
##shopt -s autocd #Like zsh
|
2013-06-02 11:02:37 +00:00
|
|
|
PROMPT_COMMAND='history -a'
|
|
|
|
|
2013-07-30 23:01:39 +00:00
|
|
|
|
2014-04-10 13:49:27 +00:00
|
|
|
alias dvorak='setxkbmap dvorak; setxkbmap -option compose:ralt'
|
2014-05-06 09:40:03 +00:00
|
|
|
dvorak
|
2014-04-02 21:43:21 +00:00
|
|
|
alias qwertz='setxkbmap ch,fr'
|
|
|
|
|
|
|
|
|
2013-09-15 14:31:08 +00:00
|
|
|
#For autocompletions
|
|
|
|
|
2013-09-18 22:43:50 +00:00
|
|
|
#function have() { return 1; } #Some files use have: suppress warnings (yeah: 2>.. )
|
|
|
|
#function _completion_loader() { return 1; }
|
2013-09-15 14:31:08 +00:00
|
|
|
#cd /usr/share/bash-completion/completions
|
|
|
|
#for i in *; do source ./$i; done
|
|
|
|
#unset have
|
|
|
|
#unset _completion_loader
|
|
|
|
|
2013-09-18 22:43:50 +00:00
|
|
|
complete -cf sudo
|
|
|
|
complete -cf man
|
|
|
|
|
2013-09-15 14:31:08 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
#####ON DEFINIT LES COULEURS
|
|
|
|
red='\033[31m'
|
|
|
|
RED='\033[31m\033[01m'
|
2013-11-07 14:51:53 +00:00
|
|
|
YELLOW='\033[33m'
|
|
|
|
GREEN='\033[32m'
|
2013-06-01 23:09:59 +00:00
|
|
|
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'
|
|
|
|
|
2013-10-04 23:59:41 +00:00
|
|
|
alias halt='sudo poweroff'
|
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
#alias pacman='pacman-color'
|
|
|
|
alias pacmacn='pacman'
|
2013-09-26 21:46:43 +00:00
|
|
|
# '[r]emove [o]rphans' - recursively remove ALL orphaned packages
|
|
|
|
alias pacro="/usr/bin/pacman -Qtdq > /dev/null && sudo /usr/bin/pacman -Rns \$(/usr/bin/pacman -Qtdq | sed -e ':a;N;\$!ba;s/\n/ /g')"
|
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-09-04 10:50:08 +00:00
|
|
|
alias git_mail='git send-email --annotate --compose origin'
|
2013-06-01 23:09:59 +00:00
|
|
|
alias poule='git pull'
|
2013-09-04 10:50:08 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
alias makew='make'
|
2013-12-18 22:08:34 +00:00
|
|
|
alias mkae='make'
|
|
|
|
alias amek='make'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
2014-01-15 20:02:19 +00:00
|
|
|
alias BSI2='cd ~/Documents/Studies/BSI2*/'
|
|
|
|
BSI3_PATH='/home/frank/Documents/Studies/BSI3 - 2013-2014/'
|
2013-09-28 20:57:33 +00:00
|
|
|
alias BSI3='cd "$BSI3_PATH"'
|
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'
|
2013-12-26 16:54:54 +00:00
|
|
|
alias programming='$OCTOPUS monitor programming'
|
2013-06-11 21:26:08 +00:00
|
|
|
alias extern='$OCTOPUS monitor extern'
|
2013-09-29 15:36:18 +00:00
|
|
|
alias clone='$OCTOPUS monitor clone'
|
2013-06-11 21:26:08 +00:00
|
|
|
|
|
|
|
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-09-18 22:43:50 +00:00
|
|
|
alias muni='cd /dev/shm && mkdir uni && sshfs villaro0@pc69240:/user/l1/2011/villaro0/ uni/'
|
2013-06-16 16:52:23 +00:00
|
|
|
|
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'
|
2014-04-10 13:49:27 +00:00
|
|
|
alias o='octave --quiet'
|
2014-02-24 20:17:49 +00:00
|
|
|
alias R='R --quiet'
|
2013-08-30 13:20:42 +00:00
|
|
|
alias cdu='cdu -idh'
|
|
|
|
alias dus='du -sh * | sort -h'
|
2013-10-14 09:22:08 +00:00
|
|
|
alias im='profanity'
|
2014-03-24 20:37:32 +00:00
|
|
|
alias eclipseJEE='/home/frank/Programmation/J2EE/eclipse/eclipse'
|
2014-04-30 21:34:59 +00:00
|
|
|
alias mst='mvn install -DskipTests'
|
|
|
|
alias arc='tig'
|
2014-05-21 17:40:43 +00:00
|
|
|
alias ccat='pygmentize -g' #python-fragments
|
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 ##
|
|
|
|
###############
|
|
|
|
# {{{
|
2014-02-24 20:17:49 +00:00
|
|
|
function fuck {
|
|
|
|
killall -9 "$1"
|
|
|
|
echo "fucking $1" killed
|
|
|
|
}
|
|
|
|
|
2013-10-22 21:13:38 +00:00
|
|
|
function cd #{{{
|
2013-06-01 23:09:59 +00:00
|
|
|
{
|
|
|
|
if [ $# -eq 0 ]; then
|
2013-12-26 16:54:54 +00:00
|
|
|
builtin cd ~ && cons_set > /dev/null && ls
|
2013-06-01 23:09:59 +00:00
|
|
|
else
|
2013-12-26 16:54:54 +00:00
|
|
|
builtin cd "$*" && cons_set > /dev/null && ls
|
2013-06-01 23:09:59 +00:00
|
|
|
fi
|
|
|
|
}
|
2013-08-22 19:28:44 +00:00
|
|
|
#}}}
|
2013-06-01 23:09:59 +00:00
|
|
|
|
2014-01-16 13:43:31 +00:00
|
|
|
function pdfsearch #{{{
|
|
|
|
{
|
|
|
|
for pdf in `find ./ -name "*.pdf"`; do
|
|
|
|
pdftotext $pdf - | grep --color --with-filename --label="$pdf" "$1";
|
|
|
|
done
|
|
|
|
}
|
|
|
|
#}}}
|
|
|
|
|
2014-01-09 22:08:27 +00:00
|
|
|
function man { #{{{
|
|
|
|
env LESS_TERMCAP_mb=$'\E[01;31m' \
|
|
|
|
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
|
|
|
|
LESS_TERMCAP_me=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_se=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_so=$'\E[38;5;246m' \
|
|
|
|
LESS_TERMCAP_ue=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
|
|
|
|
man "$@"
|
|
|
|
} #}}}
|
|
|
|
|
2013-08-26 23:07:53 +00:00
|
|
|
alias ssh='my_ssh'
|
2013-10-22 21:13:38 +00:00
|
|
|
function my_ssh #{{{
|
|
|
|
{
|
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;
|
2013-10-22 21:13:38 +00:00
|
|
|
/usr/bin/ssh "$@"
|
2013-08-22 10:15:15 +00:00
|
|
|
}
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-08-22 10:15:15 +00:00
|
|
|
|
2013-08-26 23:07:53 +00:00
|
|
|
alias scp='my_scp'
|
2013-10-22 21:13:38 +00:00
|
|
|
function my_scp #{{{
|
|
|
|
{
|
2013-08-26 23:07:53 +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;
|
2013-10-22 21:13:38 +00:00
|
|
|
/usr/bin/scp "$@"
|
2013-08-26 23:07:53 +00:00
|
|
|
}
|
|
|
|
# }}}
|
|
|
|
|
2013-10-22 21:13:38 +00:00
|
|
|
function logs #{{{
|
|
|
|
{
|
2013-06-01 23:09:59 +00:00
|
|
|
tail -f $1 | ccze -A
|
2013-10-22 21:13:38 +00:00
|
|
|
} # }}}
|
2013-06-01 23:09:59 +00:00
|
|
|
|
2013-10-22 21:13:38 +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-10-22 21:13:38 +00:00
|
|
|
function 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-09-14 23:20:00 +00:00
|
|
|
|
2013-10-22 21:13:38 +00:00
|
|
|
function study #{{{
|
2013-09-28 20:57:33 +00:00
|
|
|
{
|
2013-09-29 16:56:07 +00:00
|
|
|
if [ -z $1 ]; then
|
|
|
|
STUDY_PATH=''
|
|
|
|
else
|
|
|
|
if [ -d "$BSI3_PATH$1" ]; then
|
|
|
|
STUDY_PATH="$1"
|
|
|
|
else
|
|
|
|
STUDY_PATH=''
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
builtin cd "$BSI3_PATH$STUDY_PATH"
|
|
|
|
if [ -e calendar ]; then
|
|
|
|
echo -e "$RED WORK TO DO SOON:$BLUE"
|
|
|
|
calendar -A10
|
|
|
|
echo -e "$DFT"
|
|
|
|
fi
|
|
|
|
ls
|
2013-10-22 21:13:38 +00:00
|
|
|
} #}}}
|
2013-09-28 20:57:33 +00:00
|
|
|
|
2013-09-29 16:56:07 +00:00
|
|
|
_StudyCompletion()
|
|
|
|
{ # {{{
|
|
|
|
local cur # Pointer to current completion word.
|
|
|
|
|
|
|
|
COMPREPLY=() # Array variable storing the possible completions.
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
|
|
|
|
_STUDY_ACTUAL_DIR=`pwd`
|
|
|
|
builtin cd "$BSI3_PATH"
|
|
|
|
ALL_POSSIBLE_WORDS=(*)
|
|
|
|
builtin cd "$_STUDY_ACTUAL_DIR"
|
|
|
|
|
|
|
|
for i in ${ALL_POSSIBLE_WORDS[@]}; do
|
|
|
|
# echo ">>>$i"
|
|
|
|
WORD=$(echo $i | grep "^$cur" | tr -d ' ') #ugly
|
|
|
|
if [ $WORD ]; then
|
|
|
|
COMPREPLY+=("$WORD");
|
|
|
|
fi;
|
|
|
|
done
|
|
|
|
|
|
|
|
return 0
|
|
|
|
} # }}}
|
|
|
|
complete -F _StudyCompletion -o filenames study
|
|
|
|
|
2013-09-14 23:20:00 +00:00
|
|
|
|
2013-09-15 14:31:08 +00:00
|
|
|
RO_ROOT_DIRECTORY=/dev/shm/ro_$USER
|
2013-10-22 21:13:38 +00:00
|
|
|
ro()
|
2013-09-14 23:20:00 +00:00
|
|
|
{ # {{{
|
2013-09-15 14:31:08 +00:00
|
|
|
if [ ! -d $RO_ROOT_DIRECTORY ]; then
|
|
|
|
mkdir $RO_ROOT_DIRECTORY
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
my_root_set=`cat $RO_ROOT_DIRECTORY/default 2>/dev/null`
|
|
|
|
else
|
|
|
|
my_root_set=`cat $RO_ROOT_DIRECTORY/$1 2>/dev/null`
|
|
|
|
fi;
|
|
|
|
|
2013-09-14 23:20:00 +00:00
|
|
|
if [ -n "$my_root_set" ]; then
|
|
|
|
cd $my_root_set;
|
|
|
|
else
|
2013-09-15 14:31:08 +00:00
|
|
|
if [ -z $1 ]; then
|
|
|
|
echo -e "root for flag $1 not set.\nSet-it with roset $1"
|
|
|
|
else
|
|
|
|
echo "root not set ! set it with roset !";
|
|
|
|
fi
|
2013-09-14 23:20:00 +00:00
|
|
|
fi;
|
|
|
|
} # }}}
|
2013-10-22 21:13:38 +00:00
|
|
|
roset()
|
2013-09-14 23:20:00 +00:00
|
|
|
{ # {{{
|
2013-09-15 14:31:08 +00:00
|
|
|
if [ ! -d $RO_ROOT_DIRECTORY ]; then
|
|
|
|
mkdir $RO_ROOT_DIRECTORY
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
pwd > $RO_ROOT_DIRECTORY/default
|
|
|
|
else
|
|
|
|
pwd > $RO_ROOT_DIRECTORY/$1
|
|
|
|
fi
|
2013-09-14 23:20:00 +00:00
|
|
|
} # }}}
|
2013-09-15 14:31:08 +00:00
|
|
|
_RoRosetCompletion()
|
2013-09-29 16:56:07 +00:00
|
|
|
{ # {{{
|
2013-09-15 14:31:08 +00:00
|
|
|
local cur # Pointer to current completion word.
|
|
|
|
|
|
|
|
COMPREPLY=() # Array variable storing the possible completions.
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
|
|
|
|
_ROSET_ACTUAL_DIR=`pwd`
|
|
|
|
builtin cd $RO_ROOT_DIRECTORY
|
|
|
|
ALL_POSSIBLE_WORDS=(*)
|
|
|
|
builtin cd $_ROSET_ACTUAL_DIR
|
|
|
|
|
|
|
|
# echo "Cur: >>$cur<<"
|
|
|
|
|
|
|
|
for i in ${ALL_POSSIBLE_WORDS[@]}; do
|
|
|
|
# echo ">>>$i"
|
|
|
|
WORD=$(echo $i | grep "^$cur" | tr -d ' ') #ugly
|
|
|
|
if [ $WORD ]; then
|
|
|
|
# echo "blah!: >>$WORD<<"
|
|
|
|
COMPREPLY+=("$WORD");
|
|
|
|
fi;
|
|
|
|
done
|
|
|
|
|
|
|
|
return 0
|
2013-09-29 16:56:07 +00:00
|
|
|
} # }}}
|
2013-09-15 14:31:08 +00:00
|
|
|
complete -F _RoRosetCompletion -o filenames ro roset
|
|
|
|
|
2013-10-22 21:13:38 +00:00
|
|
|
function calc #{{{
|
2013-09-18 22:43:50 +00:00
|
|
|
{
|
|
|
|
echo "scale=3;$@" | bc -l
|
2013-10-22 21:13:38 +00:00
|
|
|
} #}}}
|
2013-09-18 22:43:50 +00:00
|
|
|
|
2013-10-22 21:13:38 +00:00
|
|
|
function xournal { #{{{
|
2013-09-30 07:49:46 +00:00
|
|
|
if [ -e "$1".xoj ]; then
|
|
|
|
/usr/bin/xournal "$1".xoj
|
|
|
|
else
|
|
|
|
/usr/bin/xournal "$1"
|
|
|
|
fi
|
2013-10-22 21:13:38 +00:00
|
|
|
} #}}}
|
2013-09-15 14:31:08 +00:00
|
|
|
|
2013-10-22 21:13:38 +00:00
|
|
|
function mutt { #{{{
|
2013-10-15 18:59:15 +00:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
if [ "$(pidof mutt)" ]; then
|
2013-10-15 19:02:20 +00:00
|
|
|
/usr/bin/mutt -R
|
2013-10-15 18:59:15 +00:00
|
|
|
else
|
|
|
|
/usr/bin/mutt
|
|
|
|
fi;
|
|
|
|
else
|
|
|
|
/usr/bin/mutt $@
|
|
|
|
fi;
|
2013-10-22 21:13:38 +00:00
|
|
|
} #}}}
|
|
|
|
|
2013-10-23 22:01:14 +00:00
|
|
|
function up2frank
|
|
|
|
{ #{{{
|
2013-10-22 21:13:38 +00:00
|
|
|
if [ ! $# -eq 1 ]; then
|
|
|
|
echo "usage: up2frank FILE"
|
|
|
|
return
|
|
|
|
else
|
|
|
|
file=$(echo $1 | sed 's/ /_/g')
|
|
|
|
scp "$1" "frank@vi-di.fr:public_html/upload/$file" > /dev/null
|
|
|
|
echo "https://frank.villaro-dixon.eu/upload/$file"
|
|
|
|
fi;
|
|
|
|
} #}}}
|
2013-10-15 18:59:15 +00:00
|
|
|
|
2013-10-23 22:01:14 +00:00
|
|
|
function rfc
|
|
|
|
{ #{{{
|
|
|
|
|
|
|
|
firefox http://www.ietf.org/rfc/rfc$1.txt
|
|
|
|
|
|
|
|
} #}}}
|
|
|
|
|
2013-11-07 14:51:53 +00:00
|
|
|
function tobed
|
|
|
|
{ #{{{
|
|
|
|
if [ $? -eq 0 ]; then #want to sleep now
|
|
|
|
tstmp=`date +%s`
|
|
|
|
tstmp=$(($tstmp+1000)) #16 min to fall asleep
|
|
|
|
tomorrow=$(($tstmp + 82800))
|
|
|
|
cycles=0;
|
|
|
|
one_cycle=5580 #93 min
|
|
|
|
while true; do
|
|
|
|
tstmp=$(($tstmp + $one_cycle))
|
|
|
|
((cycles++))
|
|
|
|
hour=`echo $tstmp | date --date=@$tstmp +%-H`
|
|
|
|
if [[ $hour -gt 4 && $hour -lt 12 ]]; then
|
|
|
|
min=`echo $tstmp | date --date=@$tstmp +%M`
|
|
|
|
stime=`echo "scale=1; $one_cycle * $cycles / 3600" | bc`
|
|
|
|
|
|
|
|
if [ $cycles -lt 5 ]; then #Not quite right: btw 7 and 9 hours -> 5/6 cycles
|
|
|
|
echo -ne $RED
|
|
|
|
elif [ $cycles -lt 6 ]; then
|
|
|
|
echo -ne $YELLOW
|
|
|
|
else
|
|
|
|
echo -ne $GREEN
|
|
|
|
fi
|
|
|
|
echo -e "$cycles cycles ($stime h)\t\tGet up: [$hour:$min]"
|
|
|
|
echo -ne $DFT
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $tstmp -gt $tomorrow && $cycles -gt 6 ]]; then
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done;
|
|
|
|
fi
|
|
|
|
} #}}}
|
2013-10-23 22:01:14 +00:00
|
|
|
|
2013-11-07 14:51:53 +00:00
|
|
|
function bpm
|
|
|
|
{
|
|
|
|
read n
|
|
|
|
start=`date +%s`
|
|
|
|
beats=0
|
|
|
|
while true; do
|
|
|
|
read n
|
|
|
|
((beats++))
|
|
|
|
actual=`date +%s`
|
|
|
|
diff=`echo "scale=1; $beats / (($actual - $start) / 60)" | bc`
|
|
|
|
echo $diff bpm
|
|
|
|
done
|
2013-12-18 22:08:34 +00:00
|
|
|
}
|
2013-11-07 14:51:53 +00:00
|
|
|
|
2013-12-18 22:08:34 +00:00
|
|
|
function op
|
|
|
|
{
|
|
|
|
file="$1"
|
|
|
|
ext=${file##*\.}
|
|
|
|
echo file is "$ext"
|
|
|
|
case $ext in
|
|
|
|
"pdf")
|
|
|
|
echo "toto"
|
|
|
|
evince "$1"
|
|
|
|
;;
|
|
|
|
"zip")
|
|
|
|
file-roller "$1"
|
|
|
|
;;
|
|
|
|
"latex"|"tex")
|
|
|
|
vim "$1"
|
|
|
|
;;
|
|
|
|
"java")
|
|
|
|
vim "$1"
|
|
|
|
;;
|
2014-03-24 20:37:32 +00:00
|
|
|
"uxf")
|
|
|
|
umlet "$1"
|
|
|
|
;;
|
2013-12-18 22:08:34 +00:00
|
|
|
*)
|
|
|
|
xdg-open "$1"
|
|
|
|
;;
|
|
|
|
esac
|
2013-11-07 14:51:53 +00:00
|
|
|
}
|
2013-12-18 22:08:34 +00:00
|
|
|
|
2013-12-26 16:54:54 +00:00
|
|
|
function vim
|
|
|
|
{
|
2014-01-02 22:55:00 +00:00
|
|
|
#Pour Ctrl-S sur vim
|
2013-12-26 16:54:54 +00:00
|
|
|
local STTYOPTS="$(stty --save)"
|
|
|
|
stty stop '' -ixoff
|
|
|
|
command vim "$@"
|
|
|
|
stty "$STTYOPTS"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#CONS(OLE) function, a pretty useful functions that keeps track of
|
|
|
|
# the lasts whereabouts (in terms of folders) of the terminal
|
|
|
|
CONS_ROOT_DIRECTORY=/dev/shm/cons_$USER
|
|
|
|
function cons
|
|
|
|
{
|
|
|
|
if [ ! -d $CONS_ROOT_DIRECTORY ]; then
|
|
|
|
mkdir $CONS_ROOT_DIRECTORY
|
|
|
|
fi;
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
for f in $CONS_ROOT_DIRECTORY/*; do
|
|
|
|
echo -e "`echo $f|rev|cut -d/ -f1|rev` >>\n\t`cat $f`"
|
2013-12-27 22:01:52 +00:00
|
|
|
#XXX basename
|
2013-12-26 16:54:54 +00:00
|
|
|
done
|
|
|
|
elif [ $# -eq 1 ]; then
|
|
|
|
if [ -e $CONS_ROOT_DIRECTORY/$1 ]; then
|
|
|
|
cd $(cat $CONS_ROOT_DIRECTORY/$1)
|
|
|
|
else
|
|
|
|
echo $1 does not exist
|
|
|
|
fi;
|
|
|
|
fi;
|
|
|
|
}
|
|
|
|
|
|
|
|
function cons_set
|
|
|
|
{
|
|
|
|
TTY=$(tty)
|
|
|
|
|
|
|
|
if [ ! -d $CONS_ROOT_DIRECTORY ]; then
|
|
|
|
mkdir $CONS_ROOT_DIRECTORY
|
|
|
|
fi;
|
|
|
|
|
|
|
|
TTYNO=`echo $TTY | cut -d/ -f 4`
|
|
|
|
pwd > $CONS_ROOT_DIRECTORY/$TTYNO
|
|
|
|
}
|
|
|
|
|
2014-04-01 21:06:21 +00:00
|
|
|
#cttc: Copy To my Tty Cwd
|
|
|
|
# cttc TTY_NO FILE
|
|
|
|
function cttc
|
|
|
|
{
|
|
|
|
if [ $# -eq 2 ]; then
|
|
|
|
cwd=`cat $CONS_ROOT_DIRECTORY/$1`
|
2014-04-02 21:43:21 +00:00
|
|
|
cp -r "$2" "$cwd"
|
2014-04-01 21:06:21 +00:00
|
|
|
else
|
2014-04-30 21:34:59 +00:00
|
|
|
echo "cons to see terminals - cttc TERM FILE"
|
2014-04-01 21:06:21 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-08-22 10:15:15 +00:00
|
|
|
|
2013-11-14 18:02:51 +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
|
2013-11-11 08:36:29 +00:00
|
|
|
export GPGKEY=016106A6AF223DBE
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
export PYTHONPATH=/usr/local/lib/python2.7/dist-packages
|
|
|
|
export CC=clang
|
2013-11-25 23:41:55 +00:00
|
|
|
#export OMPI_MPICC=clang++
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
export DEVKITPRO=/opt/devkitpro
|
|
|
|
export DEVKITARM=$DEVKITPRO/devkitARM
|
|
|
|
export PATH=$PATH:$DEVKITARM/bin
|
|
|
|
export MANPATH=$MANPATH:$DEVKITARM/man
|
2013-10-19 13:53:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
export PATH=$PATH:~/Programmation/dotfiles/Utils
|
2013-11-14 18:02:51 +00:00
|
|
|
|
|
|
|
export HISTCONTROL=erasedups
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-10-22 21:13:38 +00:00
|
|
|
export PATH="$HOME/opt/cross/bin:$PATH"
|
2014-01-06 13:18:06 +00:00
|
|
|
export PATH="/home/frank/.gem/ruby/2.0.0/bin/:$PATH"
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
#Launch startx when login
|
2013-11-14 18:02:51 +00:00
|
|
|
[[ -z $DISPLAY && $XDG_VTNR -le 4 && -z $SSH_CLIENT ]] && exec startx
|
2013-09-28 20:57:33 +00:00
|
|
|
|
|
|
|
calendar -f ~/calendar
|