shopt -s checkwinsize #Pour pas s'écrire dessus shopt -s histappend shopt -s autocd #No more cd xx shopt -s cdspell #drain bramage shopt -s dirspell ##shopt -s autocd #Like zsh PROMPT_COMMAND='history -a' set -o vi #source /usr/share/bash-completion/completions/pass alias dvorak='setxkbmap dvorak; setxkbmap -option compose:ralt && xmodmap .Xmodmap' #dvorak alias qwertz='setxkbmap ch,fr' alias mousespeed="sudo xinput --set-prop 'USB Optical Mouse' 'libinput Accel Speed' 1" #For autocompletions #function have() { return 1; } #Some files use have: suppress warnings (yeah: 2>.. ) #function _completion_loader() { return 1; } #cd /usr/share/bash-completion/completions #for i in *; do source ./$i; done #unset have #unset _completion_loader complete -cf sudo complete -cf man source /etc/bash_completion.d/azure-cli #####ON DEFINIT LES COULEURS red='\033[31m' RED='\033[31m\033[01m' YELLOW='\033[33m' GREEN='\033[32m' blue='\033[34m' BLUE='\033[34m' cyan='\033[36m' CYAN='\033[36m' magenta='\033[35m' DFT='\033[0m' white='\033[37m' #####ON DÉFINIT LE TITRE DE LA FENETRE PAR LE REP EN COURS case "$TERM" in xterm*|rxvt*) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' ;; *) ;; esac source ~/.bash_ps1 ############### #### ALIAS #### ############### # {{{ alias laptop='octopush.sh monitor laptop' alias dive='docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive:latest' alias kl='kubectl' alias klks='kubectl -n kube-system' alias change_yubikey='gpg-connect-agent "scd serialno" "learn --force" /bye' 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' 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' alias hadolint='docker run --rm -v $(pwd):/data -it hadolint/hadolint:latest-debian hadolint /data/Dockerfile' alias dockre='docker' alias dokcer='docker' alias ..='cd ..' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias vm='mv -i' alias df='dfc' alias free='freec' alias shred='shred -n 35 -z -u -v -f' if [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias ls='ls --color=auto -N' fi alias la='ls -lahN' alias sudp='sudo' #fuck tpyos :p alias sudpo='sudo' alias grep='grep --color' alias svim='sudo vim' alias bim='vim' alias vi='vim' alias VIM='vim' alias ivm='vim' alias vmi='vim' alias gl='git log --graph --abbrev-commit --pretty=oneline --decorate' alias gti='git' alias poule='git pull' alias push='git push' alias makew='make' alias mkae='make' alias amke='make' alias mak='make' alias amek='make' alias upkey='gpg --keyserver subkeys.pgp.net --send-key 6F36914A' alias shm='cd /dev/shm' alias arc='tig' # }}} ############### ## FONCTIONS ## ############### # {{{ function cd #{{{ { MY_LAST=`pwd` if [ $# -eq 0 ]; then builtin cd ~ && cons_set > /dev/null && ls else builtin cd "$*" && cons_set > /dev/null && ls fi } #}}} function back { cd $MY_LAST } function mkcd #{{{ { mkdir -p "$@" cd "$@" } # }}} #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`" #XXX basename 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 } 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 true fi ############### ### EXPORTS ### ############### # {{{ export EDITOR="vim" GPG_TTY=`tty` export GPG_TTY export GPGKEY=016106A6AF223DBE export GOPATH=~/Programmation/ export PATH=$PATH:~/Programmation/dotfiles/Utils export HISTCONTROL=erasedups export HISTSIZE=99999999 HISTTIMEFORMAT="%d/%m/%y %T " # }}} PATH=$PATH:/home/frank/Programmation/kubectx PATH=$PATH:$GOPATH/bin PATH="/home/frank/.local/bin:$PATH" #export KUBECONFIG=$(echo ~/.kube/*yml | tr ' ' ':') #export KUBECONFIG=~/.kube/macmini.yaml #Launch startx when login #[[ -z $DISPLAY && $XDG_VTNR -le 4 && -z $SSH_CLIENT ]] && exec startx export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) source /etc/profile.d/bash_completion.sh 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" 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) eval "$(direnv hook bash)" source ~/.env_secrets