summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2021-06-20 16:50:57 +0200
committerMarc Vertes <mvertes@free.fr>2021-06-20 16:50:57 +0200
commitc54b5ef0f166a6454522686e6a2a5c1550505eb0 (patch)
treef438edbbf48edb1e9f7df645666936771d37d8c0
parentc151c4ee62bd7b045a98dbcf3f1d6537948ba0d0 (diff)
update
-rw-r--r--.Xresources9
-rw-r--r--.bashrc61
-rw-r--r--.gitconfig4
-rw-r--r--.i3status.conf1
-rw-r--r--.otp_accounts.json.gpg27
-rw-r--r--.profile4
-rw-r--r--.tmux.conf3
-rwxr-xr-x.vim/pack/mvertes/install.sh9
-rw-r--r--.vimrc9
-rw-r--r--.xinitrc24
-rwxr-xr-x.xsession24
-rwxr-xr-xbin/byo6
-rwxr-xr-xbin/gauth4
-rwxr-xr-xbin/icat40
-rwxr-xr-xbin/open11
-rwxr-xr-xbin/vimki33
-rwxr-xr-xbin/xt3
17 files changed, 145 insertions, 127 deletions
diff --git a/.Xresources b/.Xresources
index a653af4..28b8436 100644
--- a/.Xresources
+++ b/.Xresources
@@ -18,8 +18,13 @@ URxvt.keysym.C-Next: font-size:decrease
xterm*termName: xterm-256color
xterm*VT100.Translations: #override \
- Ctrl <Key> Next: smaller-vt-font() \n\
- Ctrl <Key> Prior: larger-vt-font() \n
+ Meta <Key> minus: smaller-vt-font() \n\
+ Meta <Key> equal: larger-vt-font() \n
+xterm*cursorColor: red
+!xterm*visualBell: true
+!xterm*geometry: 100x32
+!xterm*faceName: DejaVu Sans Mono
+!xterm*faceSize: 10
! xterm*font: 7x14
! Allow sixel graphics. (Try: "convert -colors 16 foo.jpg sixel:-").
xterm*decTerminalID: vt340
diff --git a/.bashrc b/.bashrc
index 2f6a357..b50da1b 100644
--- a/.bashrc
+++ b/.bashrc
@@ -40,35 +40,43 @@ alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date
export TERMINAL=xt
-alias cl='cf xft:Mono:size=12'
-alias cp='cp --reflink'
-alias ls='ls --color=auto -v'
-alias ll='ls -AlFhv'
+#alias cl='cf xft:Mono:size=12'
+#alias cp='cp --reflink'
+#alias ls='ls --color=auto -v'
+alias ls='ls -GF'
+alias ll='ls -AlGFhv'
alias vi='vim'
alias view='vim -R'
+alias ldd='otool -L'
+alias ibrew='arch -x86_64 /usr/local/bin/brew'
#alias op='xdg-open'
alias git='hub'
#alias go='go1.14.1'
-alias go11='go1.11.13'
-alias go12='go1.12.10'
-alias go13='go1.13.8'
-alias go14='go1.14.2'
+#alias go11='go1.11.13'
+#alias go12='go1.12.10'
+#alias go13='go1.13.8'
+#alias go14='go1.14.2'
alias gob='go build'
alias goh='p go help'
alias god='p go doc'
alias gtr='go test -v -run'
alias gtb='go test -v -cpuprofile cpu.out -memprofile mem.out -benchmem -bench'
-#alias vi='vim'
alias rvi='sudo vim'
alias rxt='sudo xt'
alias rxvi='sudo xvi'
alias ww='vi ~/Wiki/HomePage'
alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME'
-alias uc='systemctl --user'
-alias wpa='sudo wpa_gui -i wlan0'
+#alias uc='systemctl --user'
+#alias wpa='sudo wpa_gui -i wlan0'
-alias ifre='echo "ip link set wlo1 down; ip link set wlo1 up"|sudo sh'
+#alias ifre='echo "ip link set wlo1 down; ip link set wlo1 up"|sudo sh'
+
+# Some admin command
+#alias dmesg='sudo dmesg'
+#alias mount='sudo mount'
+#alias umount='sudo umount'
+#alias cryptsetup='sudo cryptsetup'
alias by='go build ./cmd/yaegi'
alias cy='cd ~/go/src/github.com/traefik/yaegi'
@@ -79,6 +87,9 @@ alias wai='~/go/src/github.co/traefik/whoami/whoami'
# yaegi debug
export YAEGI_DOT_CMD='dotty -'
+export YAEGI_UNSAFE=1
+export YAEGI_UNRESTRICTED=1
+export YAEGI_SYSCALL=1
mosht() { mosh "$@" -- tmux new -A; }
export -f mosht
@@ -101,18 +112,34 @@ export -f ws
wsd() (cd ~/Wiki && git add . && git diff --cached)
export -f wsd
+man() {
+ local width=''
+ [ $(tput cols) -gt 88 ] && width='MANWIDTH=88'
+ env $width man "$@"
+}
+
+meteo() {
+ local request="wttr.in/${1-Toulouse}?F&T"
+ [ "$(tput cols)" -lt 125 ] && request+='&n'
+ curl -H "Accept-Language: fr" --compressed "$request"
+}
+
#PS1='[\u@\h \W]\$ '
# fzf
+[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# Accomodate different base prefix on termux
-[ -d "$HOME/../usr" ] && base=..
-[ -f "$base/usr/share/fzf/completion.bash" ] && . "$base/usr/share/fzf/completion.bash"
-[ -f "$base/usr/share/fzf/key-bindings.bash" ] && . "$base/usr/share/fzf/key-bindings.bash"
-unset base
+#[ -d "$HOME/../usr" ] && base=..
+#[ -f "$base/usr/share/fzf/completion.bash" ] && . "$base/usr/share/fzf/completion.bash"
+#[ -f "$base/usr/share/fzf/key-bindings.bash" ] && . "$base/usr/share/fzf/key-bindings.bash"
+#unset base
# Arch: display package to install for missing commands
-[ -f '/usr/share/doc/pkgfile/command-not-found.bash' ] && . /usr/share/doc/pkgfile/command-not-found.bash
+#[ -f '/usr/share/doc/pkgfile/command-not-found.bash' ] && . /usr/share/doc/pkgfile/command-not-found.bash
# Display git status in prompt
. ~/.bash-powerline.sh
# export PS1='; '
+
+# load Nix config files (aka auto-completion etc.)
+#export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
diff --git a/.gitconfig b/.gitconfig
index eaefde0..11f0d14 100644
--- a/.gitconfig
+++ b/.gitconfig
@@ -13,3 +13,7 @@
name = Marc Vertes
[pull]
rebase = false
+[hub]
+ protocol = ssh
+[init]
+ defaultBranch = main
diff --git a/.i3status.conf b/.i3status.conf
index 229dfc1..87656f8 100644
--- a/.i3status.conf
+++ b/.i3status.conf
@@ -93,6 +93,7 @@ memory {
cpu_temperature 0 {
format = "🌡%degrees °C"
#path = "/sys/class/hwmon/hwmon0/temp1_input"
+ #path = "/sys/class/hwmon/hwmon7/temp1_input"
path = "/sys/class/hwmon/hwmon6/temp1_input"
}
diff --git a/.otp_accounts.json.gpg b/.otp_accounts.json.gpg
deleted file mode 100644
index bbf1956..0000000
--- a/.otp_accounts.json.gpg
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN PGP MESSAGE-----
-
-hQIMA+yVXrx81qjVAQ/8DgattaALSr1kOyqcTFdn43dNBwLSBD369Cs3zu7ez5xz
-DpBBecMNSuCVFPq0QfocNlDmz3BZxrkrttmAz3W7iK5rDKZeYTAG10ZT7NzI5K/C
-43WgEbf3W7FLxJGy6ASv2wRI/NRDZyjWe8yEEE5OF5ZTLawV57R/xW2UHemegI3l
-aAC4nU1hWHnmErdaubdxzgCva/hrd3SzroSVfmuQp+Cq1/AszDAe9LQltSAIo2oZ
-wwct6GIBNXoiA61YB3+m7oZfMfMa+1fNEobYReN/9E8iVMz01fWWOGsYRIue07yd
-0aAMj+ywQ1VU5G2SJ++B3pchbD+ViXvLEy1bnNF37PplKYnjN06db0MuflkfDM+A
-ICMTvhGlR58DwBueuLrWBh6dAbSOuz8tHQXzs5nlBI/Vvd2YUkw5Stcn+VBi7Bwg
-xvq2WiMhRT0nIvb1yuNGCpwWt2W1ckba79opBe4j1mvXYOq9vTT2VjJnAKe3k55B
-KWQBEkRe+T5FgcSfpRiMTogIvA8aOXTxkOltzjWjH5GXza65en4R9LNg7HB/lUd7
-zb3KVEg++XuPFVU08hFF8B4vb3zsLDy0Uf26Ilv63lNgvKR9TAC9VDEfY91qMXWl
-e1yeiGQCoAmU2BLm4MopwqBBEADjYSJETS1Kvz3hiR2AvcR5gMcpxp6C121723/S
-wWgBuVgsKQmnYVNMzkNhaKj5qWOak5jXq1py751jkGKkVUwSkVQwjMr99A06fNE+
-p0k1XjA36flRSzQgh3vcOTTutXaLe1TfEHC3TWOaXu30/S5ptkpcHFfBLSoVhZ3o
-2PN5/3WcRvHL30vvLW7noB5wH32l0AzSHVnZ5cFqlNH5M00HrlPOH+Uy5WfYy684
-V7zyOpg+J7DdJQNS7HBGjSNdK738HUdxWHkNuxaK2HEuzc9YyWy6fpPrefY1z9nH
-+H3pgmr4UxiUf0+LbYvL9xcaN265S1RIvx7QJJq7iTwZYtg/qc+SRfgVpvXUr40X
-W3bTEO1baPeVpydhLMWyqReN1i3tClTG3uaVNYX5adqaaqBCaKyXexiHrSFJzaIb
-mikACoQEFsh2acP+2cp8oCVGS5vdwEfkWfZSld4KfM/v37aDb4Mwq9Ap9/OAHwSt
-RWONXZFWftgfhHXnem/iUswob+O+SvF2CSCs7cCqcB5gS0RZTsV3eiRfPbZTSSQD
-xz95R4lZ2NIt99vDKi1NWrbIfTletCnYaOahKkC5bHqlzjZ10VKCOkYUBXyewSPy
-4d+RCxlF9T6Pya0NKLjKEJwUG67Nr79w9OR6mVWR0e8f+ppw41ApUih3a3sLTuWl
-DJFkJiYEL/EwBoAaAtfnMxqlPi6BXAJQXWngS8XMTmksr1PCVovFrr57e0tIyaLt
-X4pDpxmElysDbZqLtpDtFU7OU4pMimSmSmQ=
-=NBYN
------END PGP MESSAGE-----
diff --git a/.profile b/.profile
index acb8299..bbf3c42 100644
--- a/.profile
+++ b/.profile
@@ -1,6 +1,6 @@
# ~/.profile
-PATH=~/bin:$PATH:~/go/bin
+PATH=~/bin:/opt/homebrew/bin:$PATH:~/go/bin:~/.cargo/bin
[ "${SHELL##*/}" = bash ] && . ~/.bashrc
@@ -8,3 +8,5 @@ PATH=~/bin:$PATH:~/go/bin
#case $HOSTNAME in
#([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;;
#esac
+
+. "/opt/homebrew/etc/profile.d/bash_completion.sh"
diff --git a/.tmux.conf b/.tmux.conf
deleted file mode 100644
index 8d624a0..0000000
--- a/.tmux.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-set-option -g prefix ²
-unbind-key C-b
-bind-key ² send-prefix
diff --git a/.vim/pack/mvertes/install.sh b/.vim/pack/mvertes/install.sh
index 36cf414..48d5950 100755
--- a/.vim/pack/mvertes/install.sh
+++ b/.vim/pack/mvertes/install.sh
@@ -1,7 +1,12 @@
#!/bin/sh -e
-plugins='https://github.com/mvertes/vimki https://github.com/fatih/vim-go'
-ht='vim -c "helptags doc" -c "q"'
+plugins='
+git@github.com:mvertes/vimki
+git@github.com:fatih/vim-go
+git@github.com:othree/xml.vim
+git@github.com:junegunn/fzf.vim
+'
+ht='test -d doc && vim -c "helptags doc" -c "q"'
mkdir -p start
cd start
diff --git a/.vimrc b/.vimrc
index c051d6c..1e9f8a1 100644
--- a/.vimrc
+++ b/.vimrc
@@ -8,17 +8,22 @@ filetype plugin on
filetype plugin indent on
let mapleader = ","
+set rtp+=/opt/homebrew/opt/fzf
+let g:fzf_preview = 'cat {}'
+
" vimki plugin
autocmd filetype vimki syntax on
autocmd filetype vimki set autowrite
-"autocmd filetype vimki setlocal spell spelllang=fr
+" autocmd filetype vimki setlocal spell spelllang=fr
autocmd filetype vimki nmap <leader>z :FZF ~/Wiki<CR>
" vim-go plugin
let g:go_def_mode = "gopls"
let g:go_info_mode = "gopls"
let g:go_list_type = "quickfix"
-let g:go_fmt_command = "goimports"
+" let g:go_fmt_command = "goimports"
+let g:go_fmt_command = "gopls"
+let g:go_gopls_gofumpt = 1
let g:go_metalinter_command = "golangci-lint"
autocmd FileType go syntax on
autocmd FileType go nmap <leader>b <Plug>(go-build)
diff --git a/.xinitrc b/.xinitrc
deleted file mode 100644
index f982ca7..0000000
--- a/.xinitrc
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# start pulseaudio on crux only. Should be handled by systemd on arch
-#pulseaudio --start --exit-idle-time=-1 --log-target=syslog &
-
-# enable tapping and natural scrolling on touchpad
-# see xinput --list[-props] for ids
-xinput --set-prop 'SYNA7DAB:00 06CB:CD40 Touchpad' 'libinput Tapping Enabled' 1
-xinput --set-prop 'SYNA7DAB:00 06CB:CD40 Touchpad' 'libinput Natural Scrolling Enabled' 1
-
-# Better use /etc/X11/xorg.conf.d/10-keyboard.conf to handle hot plugged keyboards
-#setxkbmap fr
-#xk
-hdmi
-
-xrdb ~/.Xresources
-#xsetroot -solid rgb:3/4/5
-xsetroot -solid rgb:1/3/4
-#feh --bg-fill ~/Downloads/Alaska_Range.jpg
-#conky
-#slock
-
-# Start window manager
-#exec fvwm
-exec i3
diff --git a/.xsession b/.xsession
deleted file mode 100755
index f982ca7..0000000
--- a/.xsession
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# start pulseaudio on crux only. Should be handled by systemd on arch
-#pulseaudio --start --exit-idle-time=-1 --log-target=syslog &
-
-# enable tapping and natural scrolling on touchpad
-# see xinput --list[-props] for ids
-xinput --set-prop 'SYNA7DAB:00 06CB:CD40 Touchpad' 'libinput Tapping Enabled' 1
-xinput --set-prop 'SYNA7DAB:00 06CB:CD40 Touchpad' 'libinput Natural Scrolling Enabled' 1
-
-# Better use /etc/X11/xorg.conf.d/10-keyboard.conf to handle hot plugged keyboards
-#setxkbmap fr
-#xk
-hdmi
-
-xrdb ~/.Xresources
-#xsetroot -solid rgb:3/4/5
-xsetroot -solid rgb:1/3/4
-#feh --bg-fill ~/Downloads/Alaska_Range.jpg
-#conky
-#slock
-
-# Start window manager
-#exec fvwm
-exec i3
diff --git a/bin/byo b/bin/byo
index 389e112..bc09fb8 100755
--- a/bin/byo
+++ b/bin/byo
@@ -2,7 +2,7 @@
# Backup to yoda
[ "$USER" = root ] || exec sudo "$0" "$@"
-usage='Usage: byo [-cdk]
+usage='Usage: byo [-cdk] [/dev/sda2]
Backup local disk to yoda external disk.
Options:
@@ -19,10 +19,12 @@ while getopts :Ccdk opt; do
done
shift $((OPTIND - 1))
+dev=$1
yoda_uuid='8c463221-6bb7-414e-9060-c9570bb3a6bb'
+[ "$dev" ] || dev=$(blkid --uuid "$yoda_uuid")
dest=/mnt/backup/$(hostname)
-[ -b /dev/mapper/yoda ] && noclose=1 || cryptsetup open "$(blkid --uuid "$yoda_uuid")" yoda
+[ -b /dev/mapper/yoda ] && noclose=1 || cryptsetup open "$dev" yoda
findmnt /dev/mapper/yoda /mnt >/dev/null && noumount=1 || mount /dev/mapper/yoda /mnt
time backup -v -d "$dest"
[ ! "$optC" ] || backup -v -d "$dest" clean
diff --git a/bin/gauth b/bin/gauth
index 575d6fc..699cd84 100755
--- a/bin/gauth
+++ b/bin/gauth
@@ -1,7 +1,9 @@
#!/bin/sh
# Use backup from andOTP
-gpg -qd ~/.otp_accounts.json.gpg |
+#gpg -qd ~/otp_accounts.json.gpg.pgp |
+#gpg -qd ~/.otp_accounts.json.gpg |
+cat ~/otp_accounts.json |
jq -r '.[] | "\(.label) \(.secret)"' |
while read -r l s; do
echo "$l $(oathtool --totp -b "$s")"
diff --git a/bin/icat b/bin/icat
index 702d648..d363e09 100755
--- a/bin/icat
+++ b/bin/icat
@@ -1,10 +1,12 @@
#!/bin/sh -e
# Display images directly in terminal.
-# Tested with xterm v361
+# Tested with xterm v361. Depends on imagemagick convert(1).
+
+[ "$LC_TERMINAL" = iTerm2 ] && [ -x "$HOME/.iterm2/imgcat" ] && exec "$HOME/.iterm2/imgcat" "$@"
# maxsize prints the geomtry size of terminal window, with
# a maximum value of 1000 pixels for width and height, or
-# 640x480 if size can not be probed.
+# 640x480 if terminal size can not be probed.
maxsize() {
[ "$WINDOWID" ] || { echo "640x480>"; return; }
xwininfo -id "$WINDOWID" | {
@@ -19,10 +21,42 @@ maxsize() {
}
}
+clearline() { printf "\r \r"; }
+
+ms=$(maxsize)
+
# Use convert(1) from imagemagick to output sixel format.
# -flatten uses the terminal background color as transparent layer
# -resize use the terminal size as bounding box, with a limit of 1000 pixels
# image is not resized if smaller than limit
#exec convert -resize "$(maxsize)>" -transparent-color white -flatten -- ${1:--} sixel:-
# color #rrrrggggbbbb
-exec convert -resize "$(maxsize)>" -- ${1:--} sixel:${2:--}
+#exec convert -resize "$(maxsize)>" -- ${1:--} sixel:${2:--}
+
+put=:
+while getopts :cpv opt; do
+ case $opt in
+ (c) clear=1 ;;
+ (p) pause=1 put=printf ;;
+ (v) put=printf ;;
+ (*) echo "Usage: icat [-cpv] [image_file ...]"; exit 1 ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+[ "$#" = 0 -o "$#" = 1 -a "$1" = - ] && {
+ convert -resize "$ms>" - sixel:-
+ exit
+}
+
+for f; do
+ $put "Next: %s" "$f"
+ [ "$pause" ] && {
+ read -sr
+ [ "$REPLY" = s ] && clearline && continue
+ }
+ [ "$clear" ] && clear
+ clearline
+ $put "%s\n" "$f"
+ convert -resize "$ms>" -- "$f" sixel:-
+done
diff --git a/bin/open b/bin/open
deleted file mode 100755
index 0fa97a7..0000000
--- a/bin/open
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-exec >/tmp/open.out 2>&1
-set -x
-
-cmd=xdg-open
-case $1 in
-(*.mkv|*.mp4) cmd=vlc;;
-esac
-
-exec $cmd "$@"
diff --git a/bin/vimki b/bin/vimki
index af5c58c..e3e0f4d 100755
--- a/bin/vimki
+++ b/bin/vimki
@@ -4,14 +4,33 @@
# rename changes the link name and propagates the change in the wiki
rename1() {
+ [ "$(head -c 8 "$3")" = VimCrypt ] && return
gawk -v old="$1" -v new="$2" -v IGNORECASE=1 '
{
gsub("[[]" old "[]]", "[" new "]")
print
}
- ' "$3"
+ ' "$3" > "$3.$$" && mv "$3.$$" "$3"
}
+link2rx() {
+ gawk -v rx="$1" -v IGNORECASE=1 '
+ BEGIN {
+ gsub(/_/, "\\W+", rx)
+ gsub(/a/, "[aåäáàâã]", rx)
+ gsub(/c/, "[cç]", rx)
+ gsub(/e/, "[eéèêë]", rx)
+ gsub(/i/, "[iîíìï]", rx)
+ gsub(/o/, "[oôöóõò]", rx)
+ gsub(/u/, "[uùûüú]", rx)
+ gsub(/y/, "[yÿ]", rx)
+ gsub(/n/, "[nñ]", rx)
+ print rx
+ }'
+}
+
+#shellcheck disable=SC2020
+
linkfile() {
echo "$1" |
tr '[:upper:]' '[:lower:]' |
@@ -20,11 +39,11 @@ linkfile() {
}
rename() {
- for f in *; do
- rename1 "$1" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f"
- done
- oldf="$(linkfile "$1")"
- [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2")"
+ rx=$(link2rx "$1")
+ # Parallelize renaming
+ echo *.md | xargs -n 1 -P 8 "$0" rename1 "$rx" "$2"
+ oldf="$(linkfile "$1").md"
+ [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2").md"
}
fixfiles() {
@@ -33,5 +52,5 @@ fixfiles() {
done
}
-cd ~/Wiki
+cd ~/Wiki || exit
"$@"
diff --git a/bin/xt b/bin/xt
index 71b92d3..9395b3e 100755
--- a/bin/xt
+++ b/bin/xt
@@ -1,4 +1,5 @@
#!/bin/sh
-exec xterm -sl 500 -j -cr red "$@" &
+#exec xterm -sl 500 -j -cr red "$@" &
+exec xterm "$@" &
#cmd="urxvtc ${@:--T $HOSTNAME}"
#eval "$cmd" || { [ $? = 2 ] && urxvtd -q -o -f && eval "$cmd"; }