diff --git a/.Xresources b/.Xresources index 702e934..6a38715 100644 --- a/.Xresources +++ b/.Xresources @@ -1,3 +1,46 @@ -Xft.dpi: 180 -Xft.autohint: 1 -Xft.antialias: 1 +*foreground: gray90 +*background: black + + +! XTerm +! /usr/share/X11/app-defaults/XTerm{,-color} +! FIXME *XTerm*font: 9x15 +*XTerm*saveLines: 10000 +*XTerm*HiForeColor: white +*XTerm*HiBackColor: #c06077 + +! FIMXE xterm*font: *-fixed-*-*-*-18-* + + +! from https://ubuntuplace.info/questions/819/comment-changer-la-taille-de-police-par-defaut-de-xterm +! change size with +<+> and +<-> +!FIXME *XTerm*VT100.translations: #override \n\ +! Ctrl minus: smaller-vt-font() \n\ +! Ctrl plus: larger-vt-font() + + +! from https://wiki.archlinux.org/index.php/Color_output_in_console#Terminal_emulators +! Black + DarkGrey +*color0: #000000 +*color8: #555753 +! ! DarkRed + Red +*color1: #ff6565 +*color9: #ff8d8d +! ! DarkGreen + Green +*color2: #93d44f +*color10: #c8e7a8 +! ! DarkYellow + Yellow +*color3: #eab93d +*color11: #ffc123 +! ! DarkBlue + Blue +*color4: #204a87 +*color12: #3465a4 +! ! DarkMagenta + Magenta +*color5: #ce5c00 +*color13: #f57900 +! !DarkCyan + Cyan (both not tango) +*color6: #89b6e2 +*color14: #46a4ff +! ! LightGrey + White +*color7: #cccccc +*color15: #ffffff diff --git a/.bash_aliases b/.bash_aliases index e22f64e..2099dd7 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -1,51 +1,81 @@ # .bash_aliases # (c) pcht 199x - 2019 -alias ls='ls -F --color' +alias ls='ls --color' alias l='ls -lh' +alias la='ls -Alh' +alias lt='ls -lrt' alias d='ls -al | egrep ^d' -alias dl='ls -al | egrep "^[d|l]"' -alias ll='ls -alh' +alias dl='ls -al | grep -E "^[d|l]"' +alias ll='ls -al | grep -E ^l' alias h=history alias td='todo -c --force-colour --filter -done,+children | less -r' alias tdall='todo --force-colour -A|less -r' -alias o=xdg-open alias pp='python -mjson.tool' alias cd='cd -P' -alias tm=tmux -alias tma='tmux attach' -alias tmn='tmux new' +alias x='chmod +x' +alias nx='chmod -x' +alias m=make + +# setfont +alias f32='setfont /usr/share/kbd/consolefonts/latarcyrheb-sun32.psfu.gz' + +# clavier +alias us='setxkbmap -layout us,us -variant ,intl -option grp:rctrl_rshift_toggle' # raccourcis alias vmc='vim ~/.mailcap' +# ldap +alias lds=ldapsearch_dalembert # bash alias sa='source ~/.bash_aliases' alias va='vim ~/.bash_aliases' +alias sb='source ~/.bashrc' alias vb='vim ~/.bashrc' # dirs alias cb='cd ~/bin' -alias cdoc='cd ~/docs/docs-braque' +alias cdoc='cd ~/docs-braque' alias cdot='cd ~/dotfiles' alias csrc='cd ~/src' alias csuck='cd ~/src/suckless/' -alias cdev='cd ~/devel' +alias cmpv='cd ~/.config/mpv' +alias cserv='cd ~/services' + +# symblinks +# find all symblink what link to $1 +alias revln='find . -xdev -type l -exec echo -n "{} -> " \; -exec readlink {} \; 2>/dev/null | grep' + +# run-mailcap +# alias see=run-mailcap +# alias seed='run-mailcap --norun --debug' +alias edit='run-mailcap --action=edit' + +alias lf='/bin/ls -rt1|tail -1' +alias slf='run-mailcap "$(/bin/ls -rt1|tail -1)"' +alias vlf='edit "$(/usr/bin/ls -rt1|tail -1)"' + + +# vim +alias vr='vim ~/.vimrc' +alias vi=vim # irssi +alias irssi='TERM=tmux irssi' alias vic='vim ~/.irssi/config' # mutt alias cm='cd ~/.mutt' alias vm='vim ~/.mutt/muttrc' -alias vma='vim ~/.mutt/alias' +alias vma='vim ~/.mutt/muttrc-alias' +alias ou='offlineimap -a upmc' +alias og='offlineimap -a gmail' # w3m +alias cw='cd ~/.w3m' alias vw='vim ~/.w3m/config' - -# fzf -alias vf='vim $(fzf --preview="head -$LINES {}")' -alias of='xdg-open "$(fzf --preview="head -$LINES {}")"' +alias wb='w3m -B' #newsboat alias nb=newsboat @@ -54,8 +84,73 @@ alias vnbu='vim ~/.newsboat/urls' alias vnbc='vim ~/.newsboat/config' #gcalcli -alias gcm='gcalcli --calendar Weather agenda' -alias gca='gcalcli agenda --military' -alias gcall='gcalcli --calendar travail --calendar ecoles --calendar agenda --calendar CGT calw --military' +# alias gcm='gcalcli --calendar Weather agenda' +# alias gca='gcalcli agenda --military' +# alias gcall='gcalcli --calendar travail --calendar ecoles --calendar agenda --calendar CGT calw --military' + +# mpv +alias vmpv='vim ~/.config/mpv/mpv.conf' +alias vmpvi='vim ~/.config/mpv/input.conf' + +# systemctl user +alias sd='sudo systemctl' +alias sdu='systemctl --user' + +# kubectl +alias k=kubectl +alias ka='kubectl api-resources' +alias kaf='kubectl apply -f' +alias kg='kubectl get' +alias kgn='kubectl get no' +alias kgp='kubectl get po' +alias kgd='kubectl get deploy' +alias kgs='kubectl get svc' + +alias v=vagrant +alias vu='vagrant up' +alias vd='vagrant destroy' + + +# ssh +alias leger='ssh leger' + +alias vs='vim ~/.ssh/config' +# alias chagall='ssh root@chagall' +# alias dhcpd='ssh root@dhcpd' +# alias heyward='ssh root@heyward' +# alias heywood='ssh root@heywood' +# alias manet='ssh root@manet' +# alias modemeca='ssh root@modemeca' +# alias poisson='ssh root@poisson' +# alias saturne='ssh root@saturne' +# alias uranus='ssh root@uranus' +# alias vauban='ssh root@vauban' + +# alias americo='ssh root@americo' +# alias ivo='ssh root@ivo' +# alias mabe='ssh root@chagall' + +# alias proxy='ssh root@proxy' + +# tools +alias ccze='ccze -A' + +alias youtube-dl=yt-dlp + +# starship.rs +alias vss='vi ~/.config/starship.toml' + +# go +alias gt="go test | _gotestcolored" +alias gtv="go test -v | _gotestcolored" + +# go buffalo +# alias bt='buffalo test | _gotestcolored' +# alias btv='buffalo test -v | _gotestcolored | less' +# force no caching in test with -count=1 +alias bt="go test -p 1 -tags test subscribe subscribe/actions subscribe/grifts subscribe/mailers" +alias btv='bt -v | _gotestcolored | less ' + +alias pm='sudo pacman' # end .bash_aliases diff --git a/.bash_profile b/.bash_profile index f9ff5db..92b876f 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,24 +1,72 @@ echo ">> .bash_profile" +# PATH must be in .bash_profile +# but I put all in .bashrc + ## rust cargo -test -d HOME/.cargo/bin && PATH="$HOME/.cargo/bin:$PATH" +# test -d $HOME/.cargo/bin && PATH="$HOME/.cargo/bin:$PATH" ## nodejs -test -d ~/.local_node/bin && PATH="$HOME/.local_node/bin:$PATH" +# test -d $HOME/.local_node/bin && PATH="$HOME/.local_node/bin:$PATH" -# golang env -export GOPATH=/home/patrick/devel/golang -PATH="$GOPATH/bin:$PATH" ## bin installed from `go install` -PATH="/home/patrick/src/golang/go/bin:$PATH" ## install from binaries +# # golang env +# export PATH=$PATH:$HOME/go/bin +# export GOPATH=/home/patrick/devel/golang +# PATH="$GOPATH/bin:$PATH" ## bin installed from `go install` +# PATH="/home/patrick/src/golang/go/bin:$PATH" ## install from binaries # rvm #[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* # nix -if [ -e /home/patrick/.nix-profile/etc/profile.d/nix.sh ]; then . /home/patrick/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer +# if [ -e /home/patrick/.nix-profile/etc/profile.d/nix.sh ]; then . /home/patrick/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer -test -s $HOME/.bashrc && source $HOME/.bashrc +# ssh agent +# use one agent for all connection +# https://unix.stackexchange.com/questions/132065/how-do-i-get-ssh-agent-to-work-in-all-terminals +# FIXME: interfer w/ ssh -A -export PATH=".:$HOME/bin:$HOME/.local/bin:$PATH" +# echo " .bash_profile: play with ssh-agent" +# if test "x$SSH_AUTH_SOCK" = x +# then +# echo "SSH_AUTH_SOCK no set" + # export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock + # + # export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$HOSTNAME.~/.ssh/ssh_auth_sock + # ssh-add -l 2>/dev/null >/dev/null + # err=$? + # if [ $err -ge 2 ]; then + # echo " .bash_profile ssh-add with error: $err" + # test -f "$SSH_AUTH_SOCK" && rm -f "$SSH_AUTH_SOCK" + # ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null + # fi + # unset err +# else + # echo "SSH_AUTH_SOCK already set !!" + # echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" +# fi + + +# test ssh-agent +# echo " .bash_profile: play with ssh-agent" +# export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$HOSTNAME.sock +# ssh-add -l 2>/dev/null >/dev/null +# err=$? +# if [ $err -ge 2 ]; then +# echo " .bash_profile ssh-add with error: $err" +# test -f "$SSH_AUTH_SOCK" && rm -f "$SSH_AUTH_SOCK" +# ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null +# else +# echo " all ok" +# fi +# unset err + +# enable PATH in system-user context +#systemctl --user import-environment PATH + +# test -f "$HOME/.bash_aliases" && source "$HOME/.bash_aliases" + +# no .bashrc here +test -e "$HOME/.bashrc" && source "$HOME/.bashrc" echo "<< .bash_profile" diff --git a/.bash_prompt b/.bash_prompt index ef42bdc..2a9eb14 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -74,7 +74,7 @@ function nix_func() { function prompt_func() { previous_return_value=$?; - ## BASH : enable shared history + ## BASH : enable shared history ## DONT DO THAT : DANGEROUS #history -a; history -c; history -r @@ -84,8 +84,12 @@ function prompt_func() { #The lowercase w is the full current working directory # prompt="${TITLEBAR}${BLUE}[${RED}\w${GREEN}$(_my_parse_git_branch)${BLUE}]${COLOR_NONE}" + # newgrp terraform + local psnewgrp='' + test "`id -ng`" != "`id -nu`" && psnewgrp="${LIGHT_GREEN}(`id -ng`)" + # [user$host] - prompt="${prompt}${COLOR_NONE}[${YELLOW}\u${COLOR_NONE}@${WHITE}\h${COLOR_NONE}]" + prompt="${prompt}${COLOR_NONE}[${YELLOW}\u${psnewgrp}${COLOR_NONE}@${WHITE}\h${COLOR_NONE}]" # python virtualenv test -n "$VIRTUAL_ENV" && prompt="${prompt} (env:${BLUE}$(basename $VIRTUAL_ENV)${COLOR_NONE})" @@ -111,13 +115,6 @@ function prompt_func() { # prompt="${prompt} \w" prompt="${prompt} $(short_path "$PWD")" - # if test $previous_return_value -eq 0 - # then - # PS1="${prompt} ${GREEN}\$${COLOR_NONE} " - # else - # PS1="${prompt} ${RED}(err=${previous_return_value}) \$${COLOR_NONE} " - # fi - # test right align FIXME # PS1=$(printf "%${COLUMNS}s \r%s" "${prompt}" "${GREEN}\$${COLOR_NONE} ") diff --git a/.bashrc b/.bashrc index 79bf270..798ede5 100755 --- a/.bashrc +++ b/.bashrc @@ -1,15 +1,14 @@ +#!/bin/bash +# shellcheck disable=SC1090 # .bashrc bash start script -# (c) Pcht 2007-2018 - +# (c) Pcht 2007-2020 +# may work on multiple hosts with different OS (Debian, Arch) +# # If not running interactively, don't do anything [ -z "$PS1" ] && return echo ">> .bashrc" -# autocheck local mail -export MAIL=/var/mail/$USER -export MAILCHECK=30 - -export LANG=fr_FR.UTF-8 +export LANG=en_US.UTF-8 # history : don't put duplicate lines in the history. Ignore line begin with space export HISTCONTROL=ignoredups:ignorespace @@ -30,93 +29,524 @@ shopt -s autocd # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" -# from http://thesmithfam.org/blog/2009/01/06/best-bash-prompt-ever/#comments -# color change with $? result -BLACK="\[\033[0;30m\]" -DARK_GRAY="\[\033[1;30m\]" -LIGHT_GRAY="\[\033[0;37m\]" -BLUE="\[\033[0;34m\]" -LIGHT_BLUE="\[\033[1;34m\]" -GREEN="\[\033[0;32m\]" -LIGHT_GREEN="\[\033[1;32m\]" -CYAN="\[\033[0;36m\]" -LIGHT_CYAN="\[\033[1;36m\]" -RED="\[\033[0;31m\]" -LIGHT_RED="\[\033[1;31m\]" -PURPLE="\[\033[0;35m\]" -LIGHT_PURPLE="\[\033[1;35m\]" -BROWN="\[\033[0;33m\]" -YELLOW="\[\033[1;33m\]" -WHITE="\[\033[1;37m\]" -DEFAULT_COLOR="\[\033[00m\]" +# LESS options +export LESS="-FRX" # very basic prompt -- more in .bash_prompt PROMPT_COMMAND='PS1="[\u@\h] -- \w "; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' # I love google-chrome :) # export BROWSER=google-chrome +# FIXME just do it once +# xdg-settings set default-web-browser google-chrome.desktop # but w3m is lighter export BROWSER=w3m -# ... and vim +# ... and vim is the Best export EDITOR=vim # very min bash aliases alias ls='ls -F --color' alias l='ls -l' alias ll='ls -al' +alias wa='ssh warhol' -### dotfiles stuff -test -f ~/dotfiles/.bash_aliases && source ~/dotfiles/.bash_aliases -test -f ~/dotfiles/.bash_prompt && source ~/dotfiles/.bash_prompt +# +# bash stuff +# +test -f ~/.bash_aliases && source ~/.bash_aliases +test -f ~/.bash_prompt && source ~/.bash_prompt +# shellcheck disable=SC2046 +test -f ~/.dircolors && eval $(dircolors ~/.dircolors) test -d ~/dotfiles/bash_completion && { - for f in ~/dotfiles/bash_completion/*.bash; - do source $f; - done; + for f in ~/dotfiles/bash_completion/*.bash; + do + # echo "BASH completion $f" + source "$f" + done; } -# To create the file: dircolors -p -test -f ~/dotfiles/.dircolors && eval "`dircolors ~/dotfiles/.dircolors`" + +# startship +# https://starship.rs/ +type -t starship >/dev/null && { + eval "$(starship init bash)" + eval "$(starship completions bash)" +} + + +#==-- archlinux --==# +# command not find +# shellcheck disable=SC1091 +test -f /usr/share/doc/pkgfile/command-not-found.bash && source /usr/share/doc/pkgfile/command-not-found.bash ### .local stuffs # manpath export MANPATH=$HOME/.local/share/man: +# path for updatedn / locate +# export LOCATE_PATH=$HOME/.local/share/locate +# test -d "$LOCATE_PATH" || mkdir -p "$LOCATE_PATH" # added by Nix installer # od it in .bash_profile if [ -e /home/patrick/.nix-profile/etc/profile.d/nix.sh ]; then . /home/patrick/.nix-profile/etc/profile.d/nix.sh; fi -# autolaunch tmux -# https://wiki.archlinux.org/index.php/Tmux#Bash -# test $- != *i* && return -# test -z "$TMUX" -a "$TERM" == "st-256color" && { -# test -n "$(tmux ls 2>/dev/null)" && exec tmux attach || exec tmux -# } +# tmux dirty hack : TERM and SSH_AGENT_PID +test -n "$TMUX" && export TERM="xterm-256color" # use gpg-agent for gpg # from gpg-agent(1) - if [ -f "~/.gnupg/.gpg-agent-info" ]; then - . "~/.gnupg/.gpg-agent-info" - export GPG_AGENT_INFO - # export SSH_AUTH_SOCK - fi -GPG_TTY=$(tty) -export GPG_TTY +# if [ -f "~/.gnupg/.gpg-agent-info" ]; then +# . "~/.gnupg/.gpg-agent-info" +# export GPG_AGENT_INFO +# # export SSH_AUTH_SOCK +# fi +# GPG_TTY=$(tty) +# export GPG_TTY # fuzzyFinder FIXME bloque la completion -# [ -f ~/.fzf.bash ] && source ~/.fzf.bash +[ -f ~/.fzf.bash ] && source ~/.fzf.bash ### tuir / fork of rtv : reddit terminal Viewer export TUIR_BROWSER=urlportal.sh export TUIR_URLVIEWER=urlview +# XDG +export XDG_MUSIC_DIR=~/perso/Musique/ + ### PATH ################################################## +# see ~/devel/dotfiles/bashrc_func + +# _append_path [ -r ] +# return +# 0: ok +# 1: error +# ?: dir already in path +function _append_path() { + local append_infront=0 + if test "$1" = '-r' + then + append_infront=1 + shift + fi + local path="$1" + local str="$2" + test -n "$str" || { echo "$path"; return 0; } + test -z "$path" && + { + echo "$str" + return 0 + } + if echo "$path" | grep -q "$str" + then + echo "$path" + else + if test $append_infront = 1 + then + echo "$str:$path" + else + echo "$path:$str" + fi + fi + return 0 +} + +# _prepend_path +function _prepend_path() { _append_path -r "$1" "$2"; } + ### rust -test -d $HOME/.cargo/bin && PATH="$HOME/.cargo/bin:$PATH" +test -d "$HOME/.cargo/bin" && PATH=$(_prepend_path "$PATH" "$HOME/.cargo/bin") + +### nodejs +test -d "$HOME/download/nodejs/latest/bin" && PATH=$(_prepend_path "$PATH" "$HOME/download/nodejs/latest/bin") +test -d "$HOME/src/node/current/bin" && PATH=$(_prepend_path "$PATH" "$HOME/src/node/current/bin") + +### npm in user mode +# test -d "${HOME}/.npm-packages" || mkdir "${HOME}/.npm-packages" +# export NPM_PACKAGES="${HOME}/.npm-packages" +# PATH=$(_prepend_path "$PATH" "$NPM_PACKAGES/bin") +# MANPATH=$(_append_path "$MANPATH" "$NPM_PACKAGES/share/man") + +### yarn +test -d "$HOME/src/yarn/latest/bin" && PATH=$(_prepend_path "$PATH" "$HOME/src/yarn/latest/bin") ### golang - default is $HOME/go/bin -test -d $HOME/go/bin && PATH="$HOME/go/bin:$PATH" +export GOPATH="$HOME/go" +test -d "$HOME"/go/bin && PATH=$(_prepend_path "$PATH" "$HOME/go/bin") -export PATH=.:$HOME/bin:$PATH -# export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +# host specific bash +test -r "$HOME/.bashrc-${HOSTNAME}" && source "$HOME/.bashrc-${HOSTNAME}" +# and in front, my scripts +PATH=$(_prepend_path "$PATH" ".:$HOME/bin:$HOME/.local/bin") + +# ruby gem PATH +PATH=$(_append_path "$PATH" /home/patrick/.gem/ruby/3.0.0/bin) + +# dont modify PATH below +export PATH + +# TERM +# echo " TERM=$TERM ($(tput colors) colors)" +# echo " DISPLAY=$DISPLAY" + +# +# SSH +# +# ssh-add +# from https://www.revsys.com/tidbits/ssh_auth_sock-tmux-and-you/ +function _check_ssh_agent() { + ssh-add -l +} + +# function set_ssh_agent() { +# declare -g SSH_AUTH_SOCK +# echo "-> play with ssh-add" + +# local SAS=${SSH_AUTH_SOCK} +# echo " export SSH_AUTH_SOCK=$SAS" +# export SSH_AUTH_SOCK=$SAS + +# if _check_ssh_agent +# then +# echo " ssh-agent OK : set SSH_AUTH_SOCK" +# SSH_AUTH_SOCK=${HOME}/.ssh/ssh_auth_sock +# fi +# if ! _check_ssh_agent +# then +# echo " ssh-agent KO : link to $SAS" + +# ln -sf "${SAS}" "$HOME"/.ssh/ssh_auth_sock +# fi +# } +# set_ssh_agent + +# find le last ssh-agent and export as SSH_AUTH_SOCK +# /!\ Dont launch at login +function _ssh_agent2 () { + local pid f + pid=$(pgrep --newest ssh-[a]gent) + test $? = 0 || { echo " Cant find process ssh-[a]gent";return 1; } + # echo "[D] pid=$pid" + f=$(sudo lsof -F n -p "$pid" -a -U | grep ^n | head -1) + test $? = 0 || { echo "Cant find lsof ssh-agent [pid=$pid]";return 1; } + # echo "[D] lsof=$f" + f=${f:1} + f=$(awk '{print $1}' <<<"$f") + # echo "[D] lsof|awk =$f" + # f=$(sudo lsof -p "$pid" | grep 'unix.*type=STREAM' | awk '{print $9}') + test -S "$f" || { echo "Cant find unix socket $f of ssh-agent [pid=$pid]"; return 1; } + export SSH_AUTH_SOCK="$f" + # echo " (new) export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" +} + + +function u () { + local o="$SSH_AUTH_SOCK" + echo " export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" + _ssh_agent2 + test "$o" = "$SSH_AUTH_SOCK" || echo " (new) export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" +} + +# +# SSH_ASKPASS +# +# if test -f /usr/lib/ssh/x11-ssh-askpass +# then +# export SSH_ASKPASS=/usr/lib/ssh/x11-ssh-askpass +# echo "-> play with SSH_ASKPASS" +# elif test -f /usr/lib/openssh/x11-ssh-askpass +# then +# export SSH_ASKPASS=/usr/lib/openssh/x11-ssh-askpass +# echo "-> play with SSH_ASKPASS" +# fi + +# mkcd +function mkcd { + test "x$1" = x && return 1 + if test -d "$1" + then + echo "dir '$1' already exists" + cd "$1" || { echo "Cant cd to $1"; return 1; } + elif test -f "$1" + then + echo "file '$1' already exists" + else + mkdir -p "$1" + cd "$1" || { echo "Cant cd to $1"; return 1; } + fi +} + +function mkdev () { + test -n "$1" || { echo Missing argument; return 1; } + test -f "$HOME/devel/$1" && { echo "file $HOME/devel/$1 already exists"; return 1; } + test -d "$HOME/devel/$1" || mkdir "$HOME/devel/$1" + cd "$HOME/devel/$1" || { echo "Cant cd to $HOME/devel/$1"; return 1; } +} + +function cdev () { + cd "$HOME/devel/$1" || { echo "Cant cd to $HOME/devel/$1"; return 1; } +} + +function clean_comment () { + local opts + test "$1" -eq "-i" && { opts='-i';shift; } + test -n "$1" || { echo Missing argument; return 1; } + sed $opts '/^#/d;s/#.*$//;/^ *$/d' "$1" +} + +function faint () { +# echo as faint + test -n "$1" || return 0 + echo -e "\e[2m$*\e[m" +} + +# +# openssl +# +# https://www.sslshopper.com/article-most-common-openssl-commands.html + + +# chech all cert/key/csr +function openssl_check_all { + local file="$1" + test -n "${file}" || { echo "Usage: $(basename "$0") "; return 1; } + test -f "${file}.csr" && openssl_check_csr "${file}.csr" + test -f "${file}.cert" && openssl_check_cert "${file}.cert" + test -f "${file}.cer" && openssl_check_cert "${file}.cer" + test -f "${file}.crt" && openssl_check_cert "${file}.crt" + test -f "${file}.pem" && openssl_check_cert "${file}.pem" + test -f "${file}.key" && openssl_check_key "${file}.key" + local file2;file2=$(sed 's/\./_/g' <<<"$file") + test "$file" = "$file2" && return 0 + file="$file2" + test -f "${file}.csr" && openssl_check_csr "${file}.csr" + test -f "${file}.cert" && openssl_check_cert "${file}.cert" + test -f "${file}.cer" && openssl_check_cert "${file}.cer" + test -f "${file}.crt" && openssl_check_cert "${file}.crt" + test -f "${file}.pem" && openssl_check_cert "${file}.pem" + test -f "${file}.key" && openssl_check_key "${file}.key" +} + + +# check Certificate Signing Request file +function openssl_check_csr { + test -f "$1" || { echo "Usage: $(basename "$0") "; return 1; } + faint "# openssl req -noout -text -verify -in $1" + openssl req -noout -text -verify -in "$1" | grep Subject: + faint "# openssl req -noout -modulus -in $1 | openssl md5 " + openssl req -noout -modulus -in "$1" | openssl md5 +} + +# check certificate file +function openssl_check_cert { + test -f "$1" || { echo "Usage: $(basename "$0") "; return 1; } + faint "# openssl x509 -noout -dates -in $1" + openssl x509 -noout -dates -in "$1" + faint "# openssl x509 -noout -modulus -in $1 | openssl md5" + openssl x509 -noout -modulus -in "$1" | openssl md5 +} + +# check private key file +function openssl_check_key { + test -f "$1" || { echo "Usage: $(basename "$0") "; return 1; } + faint "# openssl rsa -modulus -noout -in $1 | openssl md5" + openssl rsa -modulus -noout -in "$1" | openssl md5 +} + +# check https site +function openssl_check_https { + test -n "$1" || { echo "Usage: $(basename "$0") mon.site.example.com"; return 1; } + faint "# openssl s_client -servername $1 -connect $1:443 " + openssl s_client -servername "$1" -connect "$1:443" < /dev/null +} + +# check ssl/tls site +function openssl_check_protocol { + test -n "$1" || { echo "Usage: $(basename "$0") mon.site.example.com"; return 1; } + faint "# openssl s_client -servername $1 -connect $1 | egrep 'Protocol|Cipher'" + openssl s_client -servername "$1" -connect "$1" <> /dev/null | egrep 'Protocol|Cipher' +} +# check certificat file dates +function openssl_check_cert_validity { + test -n "$1" || { echo "Usage: $(basename "$0") mon.site.example.com:443"; return 1; } + faint "# openssl s_client -servername ${1%:*} -connect '$1' < /dev/null 2>/dev/null | openssl x509 -noout -dates" + openssl s_client -servername "${1%:*}" -connect "$1" < /dev/null 2>/dev/null | openssl x509 -noout -dates + + # + # validation de OCSP + # see https://github.com/yasharne/OCSP_Checker/blob/master/ocsp_checker.sh + # see https://raymii.org/s/articles/OpenSSL_manually_verify_a_certificate_against_a_CRL.html + # https://medium.com/@yasharne/how-to-check-if-a-certificate-is-revoked-using-a-bash-script-393f14ee7cd5 + + local ocsp;ocsp="$(openssl s_client -servername "${1%:*}" -connect "$1" < /dev/null 2>/dev/null | openssl x509 -noout -ocsp_uri)" + + # le certificat + local dest_cert;dest_cert=$(mktemp) + (openssl s_client -connect "$1" < /dev/null 2>&1 | sed -n '/-----BEGIN/,/-----END/p') > "$dest_cert" + # la chaine de certificat + local chain_cert;chain_cert=$(mktemp) + # openssl s_client -showcerts -connect $1 < /dev/null 2>&1 | sed -n '/-----BEGIN/,/-----END/p' | sed -E '/^---/d' > $chain_cert + openssl s_client -showcerts -connect "$1" < /dev/null 2>&1 | sed -n '/-----BEGIN/,/-----END/p' > "$chain_cert" + # la chaine sans le certificat + local onlychain_cert;onlychain_cert=$(mktemp) + awk 'NR==FNR{a[$0]--;next} (++a[$0] > 0)' "$dest_cert" "$chain_cert" > "$onlychain_cert" + # local grep_cert=$(mktemp) + # sed -e '/^---/d' "$dest_cert" > $grep_cert + # grep -Fvxf "$grep_cert" "$chain_cert" | sed -e '1s/^/-----BEGIN CERTIFICATE-----\n/' -e "\$a-----END CERTIFICATE-----"> $onlychain_cert + + # faint "dest_cert = $dest_cert chain_cert = $chain_cert onlychain_cert = $onlychain_cert" + + faint "# openssl ocsp -issuer $onlychain_cert -cert $dest_cert -text -url $ocsp" + openssl ocsp -issuer "$onlychain_cert" -cert "$dest_cert" -url "$ocsp" -text 2>/dev/null | grep "$dest_cert" 2>/dev/null | awk -F " " '{print $2}' + +} + +function curl_check_https { + test -n "$1" || { echo "Usage: $(basename "$0") mon.site.example.com"; return 1; } + faint "# curl -vIk https://$1" + test -n "$1" && curl -vIk https://"$1" +} + +# fzf functions +function vf { + if test -n "$1" + then + edit "$(fzf --preview="cat {}" -q "$1")" + else + edit "$(fzf --preview="cat {}")" + fi +} + +function vfb { + pushd ~/bin > /dev/null + if test -n "$1" + then + edit "$(fzf --multi --preview="cat {}" -q "$1")" + else + edit "$(fzf --multi --preview="cat {}" )" + fi + popd > /dev/null +} + +function of { + if test -n "$1" + then + see "$(fzf --preview="cat {}" -q "$1")" + else + see "$(fzf --preview="cat {}")" + fi +} + +function odoc { + pushd ~/docs > /dev/null + if test -n "$1" + then + see "$(fzf --preview="cat {}" -q "$1")" + else + see "$(fzf --preview="cat {}")" + fi + popd > /dev/null +} + +# Lorem ipsum +function lorem_ipsum { + cat <&1 | egrep 'Stream|Duration' +} +function videomakefilm { + # from https://trac.ffmpeg.org/wiki/Encode/H.264 + # video = h264 crf=$crf + # audio acc 128k + test -f "$1" || return 127 + test -z "$2" && return 127 + local crf=25 + # video size https://ffmpeg.org/ffmpeg-utils.html#Video-size + # ntsc 720x480 + # pal 720x576 + # hd720 1280x720 + # hd1080 2048x1080 + # 4k 4096x2160 + local vsize=pal # = 720x576 + # video rate https://ffmpeg.org/ffmpeg-utils.html#Video-rate + # ntsc 30000/1001 + # pal 25/1 + # film 24/1 + # local vrate=film # = 24 fps + echo ffmpeg -i "$1" -c:v libx264 -preset slow -tune film -crf $crf -c:a aac -b:a 128k -s $vsize "$2" + ffmpeg -i "$1" -c:v libx264 -preset slow -tune film -crf $crf -c:a aac -b:a 128k -s $vsize "$2" +} + +function lastfile () { + if test "$1" = '-l' + then /bin/ls -1ltr | /usr/bin/tail -1 + else /bin/ls -1tr | /usr/bin/tail -1 + fi +} + +function newpasswd() { + date +%s | sha256sum | base64 | head -c 32 ; echo + + # autre + # openssl rand -hex 32 +} + +## llm https://rez0.blog/hacking/2023/09/18/vim-llm-hacks.html +comment () { + local system='Add comments to this code. Respond with the code and comments. Do not alter the functional aspect of the code, but still return it. Be sure and include the code in the response. Do not respond in a markdown code block. Just respond with the code and comments. Do not preamble or say anything before or after the code. for example: If the user sent "print(1)\nprint(2)", you would reply "# Prints 1\nprint(1)\n# Prints 2\nprint(2)"' + + if test -t 0 + then + echo "$*" | llm -m starcoderbase-7b-ggml -s "$system" + else + cat | llm -m starcoderbase-7b-ggml -s "$system" + fi +} + +# terraform env +test -r /home/terraform/.terraform_pipelinerc && source /home/terraform/.terraform_pipelinerc + +# echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" +# ls -l ~/.ssh/ssh_auth_sock +# ssh-add -l + +# x11 forwarding FIXME +# echo "DISPLAY=$DISPLAY" +# xauth list + +#to launch app with radeon use PRIME +# DRI_PRIME=1 + + +# cpan config +if test -d /home/patrick/perl5 +then + PATH="/home/patrick/perl5/bin${PATH:+:${PATH}}"; export PATH; + PERL5LIB="/home/patrick/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; + PERL_LOCAL_LIB_ROOT="/home/patrick/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; + PERL_MB_OPT="--install_base \"/home/patrick/perl5\""; export PERL_MB_OPT; +fi + +# pyenv +if test -n "$(type -p pyenv)" +then + export PYENV_ROOT="$HOME/.pyenv" + command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init -)" + # pyenv-virtualenv + # eval "$(pyenv virtualenv-init -)" +fi + +#_ shellcheck +export SHELLCHECK_OPTS="-x" echo "<< .bashrc" # end .bashrc + diff --git a/.dircolors b/.dircolors index 1270019..b7b84d7 100644 --- a/.dircolors +++ b/.dircolors @@ -71,82 +71,100 @@ TERM xterm-debian # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white # Background color codes: # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white -#NORMAL 00 # no color code at all -#FILE 00 # regular file: use no color at all + +NORMAL 0 # no color code at all +FILE 0 # regular file: use no color at all RESET 0 # reset to "normal" color -DIR 01;34 # directory +DIR 1;34 # directory LINK 01;36 # symbolic link. (If you set this to 'target' instead of a - # numerical value, the color is as for the file pointed to.) -MULTIHARDLINK 00 # regular file with more than one link + # numerical value, the color is as for the file pointed to.) +ORPHAN 1;41;36 # symlink to nonexistent file, or non-stat'able file FIFO 40;33 # pipe SOCK 01;35 # socket -DOOR 01;35 # door +DOOR 04;35 # door BLK 40;33;01 # block device driver CHR 40;33;01 # character device driver -ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file -SETUID 37;41 # file that is setuid (u+s) -SETGID 30;43 # file that is setgid (g+s) +SETUID 31;43 # file that is setuid (u+s) +SETGID 34;43 # file that is setgid (g+s) CAPABILITY 30;41 # file with capability STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable # This is for files with execute permission: EXEC 01;32 -# List any file extensions like '.gz' or '.tar' that you would like ls -# to colorize below. Put the extension, a space, and the color init string. -# (and any comments you want to add after a '#') -# If you use DOS-style suffixes, you may want to uncomment the following: -#.cmd 01;32 # executables (bright green) -#.exe 01;32 -#.com 01;32 -#.btm 01;32 -#.bat 01;32 +MULTIHARDLINK 1;4 # regular file with more than one link + +# executables win +.cmd 01;32;41 +.exe 01;32;41 +.com 01;32;41 +.btm 01;32;41 +.bat 01;32;41 # Or if you want to colorize scripts even if they do not have the # executable bit actually set. #.sh 01;32 #.csh 01;32 - # archives or compressed (bright red) -.tar 01;31 -.tgz 01;31 -.arc 01;31 -.arj 01;31 -.taz 01;31 -.lha 01;31 -.lz4 01;31 -.lzh 01;31 -.lzma 01;31 -.tlz 01;31 -.txz 01;31 -.tzo 01;31 -.t7z 01;31 -.zip 01;31 -.z 01;31 -.Z 01;31 -.dz 01;31 -.gz 01;31 -.lrz 01;31 -.lz 01;31 -.lzo 01;31 -.xz 01;31 -.bz2 01;31 -.bz 01;31 -.tbz 01;31 -.tbz2 01;31 -.tz 01;31 -.deb 01;31 -.rpm 01;31 -.jar 01;31 -.war 01;31 -.ear 01;31 -.sar 01;31 -.rar 01;31 -.alz 01;31 -.ace 01;31 -.zoo 01;31 -.cpio 01;31 -.7z 01;31 -.rz 01;31 -.cab 01;31 + + # archives (bold + italic) +.tar 3;4;32 +.tgz 3;4;32 +.arc 3;4;32 +.arj 3;4;32 +.taz 3;4;32 +.lha 3;4;32 +.lz4 3;4;32 +.lzh 3;4;32 +.lzma 3;4;32 +.tlz 3;4;32 +.txz 3;4;32 +.tzo 3;4;32 +.t7z 3;4;32 +.zip 3;4;32 +.z 3;4;32 +.Z 3;4;32 +.dz 3;4;32 +.gz 3;4;32 +.lrz 3;4;32 +.lz 3;4;32 +.lzo 3;4;32 +.xz 3;4;32 +.bz2 3;4;32 +.bz 3;4;32 +.tbz 3;4;32 +.tbz2 3;4;32 +.tz 3;4;32 +.deb 3;4;32 +.rpm 3;4;32 +.jar 3;4;32 +.war 3;4;32 +.ear 3;4;32 +.sar 3;4;32 +.rar 3;4;32 +.alz 3;4;32 +.ace 3;4;32 +.zoo 3;4;32 +.cpio 3;4;32 +.7z 3;4;32 +.rz 3;4;32 +.cab 3;4;32 + +# documents +.pdf 3;35 +.ps 3;35 +.dvi 3;35 + +# documents office +.odp 35 +.ods 35 +.odt 35 +.doc 35 +.docx 35 +.xls 35 +.xlsx 35 +.ppt 35 +.pptx 35 + + # image formats .jpg 01;35 .jpeg 01;35 @@ -165,27 +183,6 @@ EXEC 01;32 .svgz 01;35 .mng 01;35 .pcx 01;35 -.mov 01;35 -.mpg 01;35 -.mpeg 01;35 -.m2v 01;35 -.mkv 01;35 -.webm 01;35 -.ogm 01;35 -.mp4 01;35 -.m4v 01;35 -.mp4v 01;35 -.vob 01;35 -.qt 01;35 -.nuv 01;35 -.wmv 01;35 -.asf 01;35 -.rm 01;35 -.rmvb 01;35 -.flc 01;35 -.avi 01;35 -.fli 01;35 -.flv 01;35 .gl 01;35 .dl 01;35 .xcf 01;35 @@ -193,11 +190,13 @@ EXEC 01;32 .yuv 01;35 .cgm 01;35 .emf 01;35 +.ico 01;35 # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions .axv 01;35 .anx 01;35 .ogv 01;35 .ogx 01;35 + # audio formats .aac 00;36 .au 00;36 @@ -216,13 +215,35 @@ EXEC 01;32 .oga 00;36 .spx 00;36 .xspf 00;36 + # video -.avi 00;33 -.mov 00;33 -.mp4 00;33 -.mpg 00;33 -.mpeg 00;33 -.wmv 00;33 -.flv 00;33 -.webm 00;33 +.mov 1;33 +.mpg 1;33 +.mpeg 1;33 +.m2v 1;33 +.mkv 1;33 +.webm 1;33 +.ogm 1;33 +.mp4 1;33 +.m4v 1;33 +.mp4v 1;33 +.vob 1;33 +.qt 1;33 +.nuv 1;33 +.wmv 1;33 +.asf 1;33 +.rm 1;33 +.rmvb 1;33 +.flc 1;33 +.avi 1;33 +.fli 1;33 +.flv 1;33 +.avi 1;33 +.mov 1;33 +.mp4 1;33 +.mpg 1;33 +.mpeg 1;33 +.wmv 1;33 +.flv 1;33 +.webm 1;33 # end .dircolors diff --git a/.gitconfig b/.gitconfig index 705dbe5..aaefbaa 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,19 +1,24 @@ [alias] + l = log --graph --decorate --oneline --all + ll = log --graph --decorate --pretty=format:'%C(yellow)%h %C(blue)%GK %Creset%ad %Creset%<(20,trunc)%an %C(auto)%d %C(auto)%s' --date=short --all lol = log --graph --decorate --oneline --all lola = log --graph --decorate --pretty=oneline --abbrev-commit --all st = status --short --branch - d = diff - dn = diff --name-status - ds = diff --stat - l = log --graph --decorate --oneline --all - s = status --short --branch - ll = log --graph --decorate --pretty=format:'%C(yellow)%h %Cred%ad %Cgreen%d %Creset%s' --date=short --all - dw = diff -w + d = diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+' + dn = diff --name-status --ignore-all-space --histogram + ds = diff --stat --ignore-all-space --histogram + f = commit --fixup=HEAD + s = status --short --branch --untracked-files=no + r = rebase -i c = commit ch = checkout + su = status --short --branch [color] ui = true [user] name = Patrick Cao Huu Thien - email = patrick.cao_huu_thien@upmc.fr + email = patrick.cao_huu_thien@sorbonne-universite.fr + signingkey = A8F721C80E43073F40DF8F21B57DBE40C72FBCF4 +[commit] + gpgsign = true diff --git a/.mutt/mutt_ldap.sh b/.mutt/mutt_ldap.sh deleted file mode 100755 index 00f0216..0000000 --- a/.mutt/mutt_ldap.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -function usage { - echo $0: no search string given - exit 1 -} - -test -z "$1" && usage -search="$1" - -resu="" -do_search(){ - - local LDAPURI="$1" - local LDAPBASE="$2" - local search="$3" - ldapsearch -x -LLL -H $LDAPURI -b $LDAPBASE "(|(uid=~$search)(cn~=$search)(mail~=$search))" mail cn 2>/dev/null | - awk 'BEGIN { n1=1; cn=""; mail="" } /^cn:/ { cn = $2 " " $3 " " $4 " " $5 " " $6 } /^mail:/ { mail = $2 } /^$/ { resu[n1] = mail "\t" cn; mail=""; cn=""; n1++ } END { for (v in resu) print resu[v] } ' | - sed '/^$/d' -} - -# search in labo ldap + in university -resu="$(do_search ldap://ldap.dalembert.upmc.fr o=ijlrda "$search") -$(do_search ldap://ldap.upmc.fr ou=People,dc=upmc,dc=fr "$search")" - -echo $(echo "$resu" | wc -l) "address(es) found:" -echo "$resu" - - - diff --git a/.mutt/muttrc b/.mutt/muttrc deleted file mode 100644 index d88cbb2..0000000 --- a/.mutt/muttrc +++ /dev/null @@ -1,205 +0,0 @@ -# mutt config -# -# from https://github.com/Nelyah/dotfiles/blob/master/.mutt/settings - -# -# define realname, from, hostname and alternates -source ~/.mutt/muttrc-me - -set use_envelope_from=yes - -set reverse_name -set reverse_realname - - -# -# paths -# -# set folder = ~/.mail # mailbox location -- set in accounts files -set alias_file = ~/.mutt/alias # where to store aliases -set header_cache = ~/.mutt/cache/headers # where to store headers -set message_cachedir = ~/.mutt/cache/bodies # where to store bodies -set certificate_file = ~/.mutt/certificates # where to store certs -set tmpdir = ~/.mutt/temp # where to keep temp files -set print_command = lp -set ispell = "aspell check" - -# -# general -# - -set mail_check=90 # check mail every (s) -set timeout=15 # wait only (s) max -set editor='vim "+set spelllang=fr"' -set nowait_key - -# text/html .... -alternative_order text/plain text/html -auto_view text/html - - -# status format -# default is = "-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---" -set status_format = "-%r-%v@%h: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---" -# -# pager format -# default is "-%Z- %C/%m: %-20.20n %s%* -- (%P)" -set pager_format = "-%Z- %C/%m: from <%n> « %s »%* -- (%P)" - -# -# index -# -# index format dynamic change -# from https://muttmua.gitlab.io/mutt/manual-dev.html#index-format-hook -set index_format="%4C %Z %?H?[%H]? %-10@date@ %-30.30L (%?l?%4l&%4c?) %s" -index-format-hook date "~d<1d" "%[%H:%M]" -index-format-hook date "~d<2d" "hier %[%H:%M]" -index-format-hook date "~d<5d" "%[%a %H:%M]" -index-format-hook date "~d<1m" "%[%a %d]" -index-format-hook date "~d<1y" "%[%d %b]" -index-format-hook date "~A" "%[%m/%Y]" - -set sort = threads # default sorting -set sort_aux = last-date-received # second sorting - - -# -# aliases -# -source ~/.mutt/alias - -# -# keybinding -# -bind index '"' what-key # print key code -- ctrl+g to quit -bind index G imap-fetch-mail # force fetch new email -bind index K previous-unread -bind index J next-unread -bind pager half-up -bind pager half-down - - -# -# Macros -# - -# save messages -macro index >S =SPAM 'save to SPAM' -macro index >V =VLAN 'save to VLAN' -macro index >D =diffusion 'save to diffusion' -macro index >C =CSSI 'save to CSSI' -macro index >I =IMPRIMANTES 'save to IMPRIMANTES' -macro index >L =logwatchs 'save to logwatchs' - -# urlview -# macro index,pager \cb "|urlview\n" "urlview to extract URLs" -macro index,pager \cb "urlscan" "open URL in BROWSER" - -# limit to new/old/flag messages -macro index ,n "(~N|~O|~F)" "view new/flag" -macro index ,a "~A" "view all" - -# get new messages by default -folder-hook . push ,n - -# urlscan -# macro index,pager \cb "urlscan" "urlscan to extract URLs" -# macro attach,compose \cb "urlscan" "urlscan to extract URLs" -# macro index,pager \cc "urlscanchrome" "urlscan to extract URLs (chrome)" -# macro attach,compose \cc "urlscanchrome" "call urlscan to extract URLs out of a message" - -# identities -macro compose \cf "^Umoi\_" "Select from" - -# -# notmoch-mutt from debian -# from /etc/Muttrc.d/notmuch-mutt.rc -# -macro index \ -"set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\ -notmuch-mutt -r --prompt search\ -`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`\ -set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \ - "notmuch: search mail" - -macro index \ -"set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\ -notmuch-mutt -r thread\ -`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`\ -set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \ - "notmuch: reconstruct thread" - -macro index \ -"set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\ -notmuch-mutt tag -- -inbox\ -set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \ - "notmuch: remove message from inbox" - -# -# spam detection - champs %H -# -spam "X-j-chkmail-Status: Spam (.*)" "ju/%1" -spam "X-Spam-Status: Yes" "sa" -spam "X-Amavis-Spam-Status: Yes" "am" -spam "X-Renater-SpamScore: ([1-9][0-9]*)" "re/%1" -set spam_separator="|" - -# -# Messages -# -set rfc2047_parameters # decoded some -set send_charset = "us-ascii:utf-8" # UTF stuff -set assumed_charset = "utf-8" -set charset = "utf-8" -set date_format = "%d %b %Y a %H:%M:%S %Z" -set attribution_locale = "fr_FR.UTF-7" -set attribution="Le %d, %n a écrit :" - -# -# headers -# -ignore * -unignore from date subject to cc User-Agent Content-Length -unignore organization organisation x-mailer: x-newsreader: x-mailing-list: -unignore posted-to: List-Id: -unignore X-j-chkmail-Status: X-Spam-Status: X-Amavis-Spam-Status: X-Renater-SpamScore: -# reset header order -unhdr_order * -hdr_order Date: Subject: From: From To: Cc: User-Agent: x-mailer: posted-to: List-Id: x-mailing-list: Content-Length: X-*: - -# pager -set pager_stop # dont exit at the end of the message with - -# -# Listes -# - -subscribe .*@listes.upmc.fr -subscribe .*@lists.debian.org -subscribe .*@pmichaud.com -subscribe .*@services.cnrs.fr -subscribe .*@listes.fercsup-cgt.org - -# -# Colors -# -source $HOME/.mutt/muttrc-colors - -# -# from https://github.com/Nelyah/dotfiles/blob/master/.mutt/settings -# use to change -macro generic \Cx| "source" -macro generic \Cx& "macro index \\t \"\\Cx" -macro index "\Cx1" -# macro generic \Cx0 "\Cx| ~/.mutt/accounts/archive\"\n\Cx&1\"!" - -# define accounts and Fx links -# +smtp_url, sll_force_tls, ssl_starttls -source $HOME/.mutt/muttrc-accounts - -# -# Query : ldap -# -# Use with Ctrl+t -set query_command = "$HOME/.mutt/mutt_ldap.sh %s" - diff --git a/.mutt/muttrc-colors b/.mutt/muttrc-colors deleted file mode 100644 index 8000748..0000000 --- a/.mutt/muttrc-colors +++ /dev/null @@ -1,74 +0,0 @@ -# vim: filetype=muttrc -# from https://github.com/LukeSmithxyz/mutt-wizard/blob/master/etc/muttcol -# -# Header colors: -# color ( header | body ) -color header brightwhite color236 "^Subject" -color header color124 color236 "^From" -color header color11 color236 "^From:" -color header color10 color236 "^To" -color header color40 color236 "^(CC|BCC)" -color header color9 color240 "^(X-j-chkmail-Status|X-Spam-Status|X-Amavis-Spam-Status|X-Renater-SpamScore)" - -color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses -color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL -color body green default "\`[^\`]*\`" # Green text between ` and ` -color body brightblue default "^# \.*" # Headings as bold blue -color body brightcyan default "^## \.*" # Subheadings as bold cyan -color body brightgreen default "^### \.*" # Subsubheadings as bold green -color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow -color body brightcyan default "[;:][-o][)/(|]" # emoticons -color body brightcyan default "[;:][)(|]" # emoticons -color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? -color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? -color body red default "(BAD signature)" -color body cyan default "(Good signature)" -color body brightblack default "^gpg: Good signature .*" -color body brightyellow default "^gpg: " -color body brightyellow red "^gpg: BAD signature from.*" -color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" - -# color index -# color index default default '.*' # default -color index default default '~u' # list messages -color index green default '~P' # from me -color index brightgreen color0 '~p' # for me -color index brightyellow color0 "~N" # new messages -color index yellow color0 "~O" # ols messages -color index red color0 '~T' # tagged messages -color index red default '~H ..*' # spam messages -color index cyan blue '~D' # deleted messages -color index magenta default 'ray|lesaec|mackagny|popinet|info' -color index color202 default '~f netdata ~s "needs attention"' - -# color -color normal default default -color indicator brightblack white -color normal brightyellow default -color error red default -color tilde black default -color message cyan default -color markers red white -color attachment white default -color search brightmagenta default -color status brightyellow blue -color hdrdefault color248 color236 -color quoted green default -color quoted1 blue default -color quoted2 cyan default -color quoted3 yellow default -color quoted4 red default -color quoted5 brightred default -color signature brightgreen default -color bold black default -color underline black default -color normal default default - -# mono - -mono bold bold -mono underline underline -mono indicator reverse -mono error bold -mono body bold "^gpg: Good signature" -mono body bold "^gpg: BAD signature from.*" diff --git a/.tmux.conf b/.tmux.conf deleted file mode 100644 index 2f31d6d..0000000 --- a/.tmux.conf +++ /dev/null @@ -1,37 +0,0 @@ -## pcht tmux configurarion -# (c) 2018 - -# change prefix to ctrl+a and -# use "C-a a"to send C-a to shell -unbind C-b -set -g prefix C-a -bind a send-prefix - -# disable login-shell on tmux -# https://wiki.archlinux.org/index.php/Tmux#Start_a_non-login_shell -set -g default-command "${SHELL}" - -# set default term to 256 colors -#set -g default-terminal "tmux-255color" -set -g default-terminal "screen" - -# open pane/window in same directory -# https://unix.stackexchange.com/questions/12032/create-new-window-with-current-directory-in-tmux -bind '"' split-window -c "#{pane_current_path}" -bind s split-window -c "#{pane_current_path}" -bind % split-window -h -c "#{pane_current_path}" -bind '|' split-window -h -c "#{pane_current_path}" -bind c new-window -c "#{pane_current_path}" - -# last window like in screen -bind C-a last-window - -# reload this file -bind r source-file /home/patrick/.tmux.conf \; display-message ".tmux.conf reloaded" - -# automatic update env for ssh-agent -# https://stackoverflow.com/questions/21378569/how-to-auto-update-ssh-agent-environment-variables-when-attaching-to-existing-tm -set-option -g update-environment SSH_AUTH_SOCK - -# urlview in term -run-shell ~/src/tmux-urlview/urlview.tmux diff --git a/.vimrc_vundle b/.vimrc_vundle index 502f754..9c0c8a0 100755 --- a/.vimrc_vundle +++ b/.vimrc_vundle @@ -26,7 +26,6 @@ filetype off " required " <~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> " (_) (_) " - " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() @@ -36,14 +35,12 @@ Plugin 'VundleVim/Vundle.vim' " git Plugin 'tpope/vim-fugitive' - " commentary Plugin 'tpope/vim-commentary' xmap \\ Commentary nmap \\ Commentary nmap \\\ CommentaryLine nmap \\u CommentaryUndo - " Plugin 'Syntastic' " set statusline+=%#warningmsg# " set statusline+=%{SyntasticStatuslineFlag()} @@ -323,11 +320,9 @@ au FileType sh compiler shellcheck au FileType sh nmap m :ShellCheck! au FileType sh imap m :ShellCheck!i - " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required - " _\|/_ " (o o) " <~~~~~~oOO-{_}-OOo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> @@ -366,7 +361,6 @@ set backspace=2 set statusline=%F%m%r%h%w\ %{fugitive#statusline()}%=[BUF=%n][FORMAT=%{&ff}][TYPE=%Y][ASCII=%03.3b][LINE=%03l][COL=%03v][%p%%] set laststatus=2 - """"""""""""""""""" " affiche les touches en mode commande set showcmd @@ -479,20 +473,19 @@ set foldlevel=3 " | | " <~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> " (_) (_) - " tabe créer un onglet -" function! MoveTab(direction) -" if (a:direction == 'left') -" let tabnum = tabpagenr()-2 -" if (tabnum < 0) -" let tabnum = 0 -" endif -" execute 'tabm '.tabnum -" else -" let tabnum = tabpagenr() -" execute 'tabm '.tabnum -" endif -" endfunction +"function! MoveTab(direction) +" if (a:direction == 'left') +" let tabnum = tabpagenr()-2 +" if (tabnum < 0) +" let tabnum = 0 +" endif +" execute 'tabm '.tabnum +" else +" let tabnum = tabpagenr() +" execute 'tabm '.tabnum +" endif +"endfunction highlight TabLine term=none cterm=none highlight TabLineSel ctermbg=darkblue " raccourcis @@ -634,7 +627,6 @@ set scrolloff=999 " | | " <~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> " (_) (_) - " no arrows keys no more nmap nmap @@ -660,7 +652,6 @@ nmap gf :e " increase / decrease :nnoremap :nnoremap - " speed up " edit .vimrc nmap v :vs ~/.vimrc @@ -692,4 +683,3 @@ nmap ; : - diff --git a/.xinitrc b/.xinitrc deleted file mode 100644 index 631bdc0..0000000 --- a/.xinitrc +++ /dev/null @@ -1,32 +0,0 @@ -# hiDPI -test -f $HOME/.Xresources && xrdb -merge $HOME/.Xresources - -# my keyboards -setxkbmap -layout us,us -variant ,intl -option grp:rctrl_rshift_toggle - -# my monitors -xrandr --output DVI-D-1 --primary --mode 1920x1080 --scale 1x1 -xrandr --output HDMI-0 --mode 3840x2160 --scale 1x1 --right-of DVI-D-1 - -# background -feh --bg-scale /home/patrick/perso/wallpapers/20190303_les_filles.jpg - - -# tools -# status -slstatus & - -eval $(ssh-agent) - -## restart with Alt-Shift-Q -## (only in debug process because make dwm slow not using exec) -# while true -# do -# dwm 2> $HOME/.dwm.log -# done - -## or do a simple exec -# eval $(gpg-agent --daemon) #DONT NEED TO LAUNCH IT -exec dwm 2> $HOME/.dwm.log - - diff --git a/.xinitrc-keyboard b/.xinitrc-keyboard deleted file mode 100755 index a48c4b4..0000000 --- a/.xinitrc-keyboard +++ /dev/null @@ -1 +0,0 @@ -setxkbmap -layout us,us -variant ,intl -option grp:rctrl_rshift_toggle diff --git a/.xinitrc-xrandr b/.xinitrc-xrandr deleted file mode 100755 index c3f3d7a..0000000 --- a/.xinitrc-xrandr +++ /dev/null @@ -1,2 +0,0 @@ -xrandr --output DVI-D-1 --primary --mode 1920x1080 --scale 1x1 -xrandr --output HDMI-0 --mode 3840x2160 --scale 1x1 --right-of DVI-D-1