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
|
2014-07-21 14:06:37 +00:00
|
|
|
shopt -s autocd #No more cd xx
|
2014-10-20 20:51:11 +00:00
|
|
|
shopt -s cdspell #drain bramage
|
|
|
|
shopt -s dirspell
|
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'
|
|
|
|
|
2020-01-23 12:08:08 +00:00
|
|
|
set -o vi
|
|
|
|
|
|
|
|
source /usr/share/bash-completion/completions/pass
|
2013-07-30 23:01:39 +00:00
|
|
|
|
2019-01-04 12:24:13 +00:00
|
|
|
alias dvorak='setxkbmap dvorak; setxkbmap -option compose:ralt && xmodmap .Xmodmap'
|
2016-02-19 11:09:15 +00:00
|
|
|
#dvorak
|
2014-04-02 21:43:21 +00:00
|
|
|
alias qwertz='setxkbmap ch,fr'
|
2020-01-23 12:08:08 +00:00
|
|
|
alias mousespeed="sudo xinput --set-prop 'USB Optical Mouse' 'libinput Accel Speed' 1"
|
2014-04-02 21:43:21 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
source ~/.bash_ps1
|
2013-07-29 16:34:39 +00:00
|
|
|
|
2013-06-01 23:09:59 +00:00
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
###############
|
|
|
|
#### ALIAS ####
|
|
|
|
###############
|
|
|
|
# {{{
|
2022-05-29 09:23:19 +00:00
|
|
|
alias dive='docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive:latest'
|
2022-05-30 20:26:55 +00:00
|
|
|
|
2019-11-22 15:15:22 +00:00
|
|
|
alias kl='kubectl'
|
2020-04-23 15:35:00 +00:00
|
|
|
alias klks='kubectl -n kube-system'
|
2022-05-29 09:23:19 +00:00
|
|
|
alias change_yubikey='gpg-connect-agent "scd serialno" "learn --force" /bye'
|
2019-11-22 15:15:22 +00:00
|
|
|
alias dockerdns=' docker run -d --hostname dns.mageddo --restart=unless-stopped -p 5380:5380 -v /var/run/docker.sock:/var/run/docker.sock -v /etc/resolv.conf:/etc/resolv.conf -d defreitas/dns-proxy-server'
|
2020-02-17 14:58:47 +00:00
|
|
|
alias flake='docker run --rm -v $(pwd):/data -it gitlab.infomaniak.ch:4567/production-purple/ci/flake8/master:latest flake8 --ignore=E266,E303,E501,W391,E722,W503,F403,F405 --max-line-length=110 --exclude=venv,__pycache__ /data'
|
2022-05-29 09:23:19 +00:00
|
|
|
alias hadolint='docker run --rm -v $(pwd):/data -it hadolint/hadolint:latest-debian hadolint /data/Dockerfile'
|
2019-08-28 15:59:12 +00:00
|
|
|
alias dockre='docker'
|
2019-11-22 15:15:22 +00:00
|
|
|
alias dokcer='docker'
|
2013-06-01 23:09:59 +00:00
|
|
|
alias ..='cd ..'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
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`"
|
2016-02-21 21:40:26 +00:00
|
|
|
alias ls='ls --color=auto -N'
|
2013-08-22 19:28:44 +00:00
|
|
|
fi
|
2016-02-21 21:40:26 +00:00
|
|
|
alias la='ls -lahN'
|
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-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-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'
|
2014-10-20 20:51:11 +00:00
|
|
|
alias vmi='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'
|
2015-10-14 12:51:33 +00:00
|
|
|
alias gti='git'
|
2013-06-01 23:09:59 +00:00
|
|
|
alias poule='git pull'
|
2014-06-09 21:09:15 +00:00
|
|
|
alias push='git push'
|
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'
|
2015-10-14 12:51:33 +00:00
|
|
|
alias amke='make'
|
2015-01-02 12:37:34 +00:00
|
|
|
alias mak='make'
|
2013-12-18 22:08:34 +00:00
|
|
|
alias amek='make'
|
2013-06-04 16:43:31 +00:00
|
|
|
|
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
|
|
|
|
2014-04-30 21:34:59 +00:00
|
|
|
alias arc='tig'
|
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-08-28 16:28:17 +00:00
|
|
|
|
2013-10-22 21:13:38 +00:00
|
|
|
function cd #{{{
|
2013-06-01 23:09:59 +00:00
|
|
|
{
|
2014-06-06 19:43:37 +00:00
|
|
|
MY_LAST=`pwd`
|
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-06-06 19:43:37 +00:00
|
|
|
function back {
|
|
|
|
cd $MY_LAST
|
|
|
|
}
|
|
|
|
|
2013-08-26 23:07:53 +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-12-26 16:54:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
}
|
|
|
|
|
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
|
2022-05-29 09:23:19 +00:00
|
|
|
#eval `$SSHAGENT $SSHAGENTARGS`
|
|
|
|
#trap "kill $SSH_AGENT_PID" 0
|
|
|
|
true
|
2013-11-14 18:02:51 +00:00
|
|
|
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
|
|
|
|
2020-04-23 15:35:00 +00:00
|
|
|
export GOPATH=~/Programmation/
|
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
|
2016-02-21 21:40:26 +00:00
|
|
|
export HISTSIZE=99999999
|
2016-06-13 09:00:37 +00:00
|
|
|
HISTTIMEFORMAT="%d/%m/%y %T "
|
2013-08-22 19:28:44 +00:00
|
|
|
# }}}
|
2013-10-22 21:13:38 +00:00
|
|
|
export PATH="$HOME/opt/cross/bin:$PATH"
|
2019-01-04 12:24:13 +00:00
|
|
|
|
|
|
|
|
2019-08-28 15:59:12 +00:00
|
|
|
PATH=$PATH:/home/frank/Programmation/kubectx
|
2022-05-29 09:23:19 +00:00
|
|
|
PATH=$PATH:$GOPATH/bin
|
2022-05-30 21:53:19 +00:00
|
|
|
PATH="/home/frank/.local/bin:$PATH"
|
2022-05-29 09:23:19 +00:00
|
|
|
#export KUBECONFIG=$(echo ~/.kube/*yml | tr ' ' ':')
|
|
|
|
#export KUBECONFIG=~/.kube/macmini.yaml
|
2019-08-28 15:59:12 +00:00
|
|
|
|
2013-08-22 19:28:44 +00:00
|
|
|
|
|
|
|
#Launch startx when login
|
2022-05-30 20:26:55 +00:00
|
|
|
#[[ -z $DISPLAY && $XDG_VTNR -le 4 && -z $SSH_CLIENT ]] && exec startx
|
2013-09-28 20:57:33 +00:00
|
|
|
|
2019-01-04 12:24:13 +00:00
|
|
|
|
2022-05-30 20:26:55 +00:00
|
|
|
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
2020-04-23 15:35:00 +00:00
|
|
|
source /etc/profile.d/bash_completion.sh
|
2020-08-31 08:54:50 +00:00
|
|
|
source <(kubectl completion bash) # completion will save a lot of time and avoid typo
|
|
|
|
source <(kubectl completion bash | sed 's/kubectl/kl/g' ) # so completion works with the alias "k"
|
2022-05-29 09:23:19 +00:00
|
|
|
source <(kubectl completion bash | sed 's/kubectl/klks/g' ) # so completion works with the alias "k"
|
|
|
|
source <(kubectl completion bash | sed 's/kubectl/kp/g' ) # so completion works with the alias "k"
|
|
|
|
. <(flux completion bash)
|
2020-04-23 15:35:00 +00:00
|
|
|
eval "$(direnv hook bash)"
|
2022-05-30 20:26:55 +00:00
|
|
|
|