Compare commits

...

7 Commits

Author SHA1 Message Date
masterzu 68121c4aab
update ssh-agent et GPG_TTY 2025-03-03 18:47:55 +01:00
masterzu 41057419f9
clean bashrc 2025-03-03 17:55:30 +01:00
masterzu e90821e960
bashrc less 2025-03-03 17:51:11 +01:00
masterzu ea035fd050
alias bd 2025-03-03 17:43:30 +01:00
masterzu e8c7386429
git push: followTags 2025-03-03 17:43:29 +01:00
masterzu 347389dbf0
mutt update 2025-03-03 17:43:29 +01:00
masterzu 6f01967b90
newsboat urls update 2025-03-03 17:43:29 +01:00
6 changed files with 132 additions and 139 deletions

View File

@ -68,7 +68,7 @@ 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'
# urlscan
alias vurl='vim ~/.config/urlscan/config.json'
@ -147,6 +147,9 @@ alias vss='vi ~/.config/starship.toml'
alias gt="go test | _gotestcolored"
alias gtv="go test -v | _gotestcolored"
# gobuffalo
alias bd='buffalo dev'
alias pm='sudo pacman'
# end .bash_aliases

240
.bashrc
View File

@ -26,8 +26,6 @@ shopt -s checkwinsize
## autocd
shopt -s autocd
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe.sh ] && eval "$(/usr/bin/lesspipe.sh)"
# LESS options
# colorize with vimcolor
@ -45,13 +43,11 @@ PROMPT_COMMAND='PS1="[\u@\h] -- \w "; echo -ne "\033]0;${USER}@${HOSTNAME}: ${P
export BROWSER=w3m
# ... and vim is the Best
export EDITOR=vim
export PAGER=less
# very min bash aliases
alias ls='ls -F --color'
alias ls='ls --color'
alias l='ls -l'
alias ll='ls -al'
alias wa='ssh warhol'
#
# bash stuff
@ -64,17 +60,31 @@ test -f ~/.dircolors && eval $(dircolors ~/.dircolors)
test -d ~/dotfiles/bash_completion && {
for f in ~/dotfiles/bash_completion/*.bash;
do
# echo "BASH completion $f"
source "$f"
done;
}
#
# man
#
export MANPATH=$HOME/.local/share/man:$MANPATH
export MANPAGER="less -R --use-color -Dsc -Dk+r -Dd+g -Du+c -DPgb -DEbR"
export MANROFFOPT="-P -c"
# startship
#
# less
#
if [ -x /usr/bin/lesspipe.sh ]
then
eval "$(lesspipe.sh)"
export LESSCOLORIZER=vimcolor
fi
export LESS="-FRX"
#
# startship
# https://starship.rs/
#
type -t starship >/dev/null && {
eval "$(starship init bash)"
eval "$(starship completions bash)"
@ -82,42 +92,20 @@ type -t starship >/dev/null && {
#==-- archlinux --==#
# command not find
# function command_not_found_handle ()
# 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"
#
# 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
# 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
# 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
# fuzzyFinder FIXME bloque la completion
#
# fuzzyFinder
#
[ -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
@ -131,8 +119,8 @@ function _append_path() {
local append_infront=0
if test "$1" = '-r'
then
append_infront=1
shift
append_infront=1
shift
fi
local path="$1"
local str="$2"
@ -144,14 +132,14 @@ function _append_path() {
}
if echo "$path" | grep -q "$str"
then
echo "$path"
echo "$path"
else
if test $append_infront = 1
then
echo "$str:$path"
else
echo "$path:$str"
fi
if test $append_infront = 1
then
echo "$str:$path"
else
echo "$path:$str"
fi
fi
return 0
}
@ -160,26 +148,48 @@ function _append_path() {
function _prepend_path() { _append_path -r "$1" "$2"; }
### rust
test -d "$HOME/.cargo/bin" && PATH=$(_prepend_path "$PATH" "$HOME/.cargo/bin")
PATH=$(_prepend_path "$PATH" "$HOME/.cargo/bin")
### golang - default is $HOME/go/bin
### nodejs
PATH=$(_prepend_path "$PATH" "$HOME/download/nodejs/latest/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
PATH=$(_prepend_path "$PATH" "$HOME/src/yarn/latest/bin")
#
# golang
# - default is $HOME/go/bin
#
export GOPATH="$HOME/go"
test -d "$HOME"/go/bin && PATH=$(_prepend_path "$PATH" "$HOME/go/bin")
type -t buffalo > /dev/null 2>&1 && eval "$(buffalo completion bash)"
PATH=$(_prepend_path "$PATH" "$HOME/go/bin")
function bt {
echo "bash bt $*"
local opt=
test "$#" -ne 0 && opt="-m ""$*"
# shellcheck disable=SC2086
buffalo test $opt | _gotestcolored | less -RF
}
function btv {
echo "bash btv $*"
local opt=
test "$#" -ne 0 && opt="-m ""$*"
# shellcheck disable=SC2086
buffalo test -v $opt | _gotestcolored | less -RF
#
# gobuffalo
#
type -t buffalo > /dev/null 2>&1 && {
eval "$(buffalo completion bash)"
function bt {
echo "bash bt $*"
local opt=
test "$#" -ne 0 && opt="-m ""$*"
# shellcheck disable=SC2086
buffalo test $opt | _gotestcolored | less -RF
}
function btv {
echo "bash btv $*"
local opt=
test "$#" -ne 0 && opt="-m ""$*"
# shellcheck disable=SC2086
buffalo test -v $opt | _gotestcolored | less -RF
}
}
# host specific bash
@ -194,70 +204,6 @@ 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
}
# from https://wiki.archlinux.org/title/SSH_keys#ssh-agent
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
echo " ssh-agent created"
fi
if [ ! -f "$SSH_AUTH_SOCK" ]; then
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
echo " ssh-agent loaded"
fi
# 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 -n "$1" || return 1
@ -292,8 +238,8 @@ function clean_comment () {
sed $opts '/^#/d;s/#.*$//;/^ *$/d' "$1"
}
function faint () {
# echo as faint
function faint () {
test -n "$1" || return 0
echo -e "\e[2m$*\e[m"
}
@ -512,10 +458,37 @@ comment () {
# shellcheck disable=SC1091
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
#
# ssh-agent
#
# from https://wiki.archlinux.org/title/SSH_keys#ssh-agent
# _ssh_agent handle existing ssh-agent / use $XDG_RUNTIME_DIR/ssh-agent.env to store current ssh-agent
function _ssh_agent() {
local timeout=1h
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t "$timeout" > "$XDG_RUNTIME_DIR/ssh-agent.env"
echo " ssh-agent not found; launch it"
fi
if [ ! -f "$XDG_RUNTIME_DIR/ssh-agent.env" ]; then
pkill -x ssh-agent
ssh-agent -t "$timeout" > "$XDG_RUNTIME_DIR/ssh-agent.env"
echo " ssh-agent found but not $XDG_RUNTIME_DIR/ssh-agent.env; kill and re-launch"
fi
if [ ! -f "$SSH_AUTH_SOCK" ]; then
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
echo " ssh-agent loaded"
fi
}
_ssh_agent
#
# gpg
#
export GPG_TTY=$(tty)
# x11 forwarding FIXME
# echo "DISPLAY=$DISPLAY"
# xauth list
@ -545,6 +518,9 @@ then
# eval "$(pyenv virtualenv-init -)"
fi
# export
export PATH
#_ shellcheck
export SHELLCHECK_OPTS="-x"

View File

@ -24,3 +24,5 @@
gpgsign = true
[merge]
tool = vimdiff1
[push]
followTags = true

8
muttrc
View File

@ -128,6 +128,14 @@ macro index >H <tag-prefix><save-message>=liste-hackesr<enter> "save to liste-ha
macro index /l "<limit>(~C @listes.sorbonne-universite.fr|~C @listes.upmc.fr|~C @services.cnrs.fr|~C @groupes.renater.fr|~C @pmichaud.com|~C @lists.debian.org)<Enter>" "Voir: Listes"
macro index /m "<limit>monit<Enter>" "Voir: monit"
# notmuch-mutt ???
macro index .n \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<shell-escape>notmuch-mutt -r --prompt search<enter>\
<change-folder-readonly>$HOME/.cache/notmuch/mutt/results<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
"notmuch search"
### automatic actions
# (push are executed AFTER all commands)
# (multiple push/exec will be exec in reverse order)

View File

@ -28,10 +28,12 @@ alias arnaud.antkowiak Arnaud Antkowiak <arnaud.antkowiak@upmc.fr>
alias fuster Daniel Fuster <fuster@dalembert.upmc.fr>
alias ASR ASR <asr@services.cnrs.fr>
alias dsi-certi dsi-certi@sorbonne-universite.fr
alias rssi RSSI de SU <rssi@sorbonne-universite.fr>
alias paulo.moradefreitas Paulo MORA DE FREITAS <paulo.moradefreitas@cnrs.fr>
alias paulo Paulo MORA DE FREITAS <paulo.moradefreitas@cnrs.fr>
alias dsi-certi dsi-certi@sorbonne-universite.fr
alias rssi RSSI de SU <rssi@sorbonne-universite.fr>
alias dupuy Sylvie Dupuy <sylvie.dupuy@sorbonne-universite.fr>
alias sylvie.dupuy Sylvie Dupuy <sylvie.dupuy@sorbonne-universite.fr>
alias stephanie Stephanie Deboeuf <sdeboeuf@dalembert.upmc.fr>
alias thierry Thierry Bastien <thierry.bastien@parisdescartes.fr>
@ -42,9 +44,6 @@ alias catherine Catherine Dejancourt <dejancourt@dalembert.upmc.fr>
alias sandrine Sandrine BANDEIRA <sandrine.bandeira@dalembert.upmc.fr>
alias olivier Olivier LABBEY <labbey@dalembert.upmc.fr>
alias alvaro Alvaro Veronique <veronique.alvaro@upmc.fr>
alias dupuy Sylvie Dupuy <sylvie.dupuy@sorbonne-universite.fr>
alias sylvie.dupuy Sylvie Dupuy <sylvie.dupuy@sorbonne-universite.fr>
# exterieur pro

7
urls
View File

@ -12,10 +12,15 @@ https://nvd.nist.gov/download/nvd-rss.xml "~CVE National Vulnerability Database"
---update-sysadmin---
http://nginx.org/index.rss release "~nginx releases"
http://freenginx.org/index.rss release "~freenginx releases"
https://github.com/dovecot/core/releases.atom "~dovecot releases" release
https://roundcube.net/feeds/atom.xml release "~roundcube releases"
https://github.com/MariaDB/server/releases.atom "~MariaDB releases" release
https://github.com/openldap/openldap/releases.atom "~openldap releases" release
https://www.isc.org/index.xml
# https://www.isc.org/bind/index.xml sysadmin
# https://www.isc.org/dhcp/index.xml sysadmin
https://roundcube.net/feeds/atom.xml release "~roundcube releases"
# no data https://www.isc.org/kea/index.xml "~kea releases" release
https://github.com/go-gitea/gitea/releases.atom "~gitea releases" release
https://forum.proxmox.com/forums/announcements.7/index.rss "~proxmox release" sysadmin proxmox release
https://github.com/Telmate/terraform-provider-proxmox/releases.atom "~Telmate terraform-proxmox release" release proxmox
---update-sysadmin-OS---