From 1aa518b6ec9a261a83d291ff48607c2ce4c7b143 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 9 Jun 2020 01:10:47 +0200 Subject: diffdir --- bin/diffdir | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 bin/diffdir diff --git a/bin/diffdir b/bin/diffdir new file mode 100755 index 0000000..57997ed --- /dev/null +++ b/bin/diffdir @@ -0,0 +1,43 @@ +#!/bin/sh + +Version='diffdir-0.1' + +diffdir() { + [ -f "/etc/backup/ignore" ] && xf=--exclude-from=/etc/backup/ignore || xf= + rsync -aDSniv $xf --delete $Optx "$2/" "$1" | + awk -v OptF="${OptF#./}" -v prefix=$prefix ' + NF == 0 {exit} + NR < 2 || /\/*\.dv$/ || /\/$/ {next} + # Match an itemized status for all versions of rsync -i + $1 !~ /^[<>ch.*][fdLDS+][.+?cstpoguaxz]+$/ {next} + {key = $1; file = substr($0, length(key) + 2)} + OptF && OptF != file {next} + key == "*deleting" {print "deleted " prefix file; next} + substr(key, 3, 7) == "+++++++" {print "created " prefix file; next} + { # Avoid false positive if only mtime is changed. + of = "'$1'/" file; gsub("'\''", "'\'\\\\\'\''", of) + nf = "'$2'/" file; gsub("'\''", "'\'\\\\\'\''", nf) + if (substr(key, 2, 1) == "L") { # Symlink + src = target = file + sub(/.* -> /, "", target); + sub(/ -> .*/, "", src); + "readlink '$2'/" src | getline otarget + if (target != otarget) + print "changed " src + } else if (system("cmp -s '\''" of "'\'\ \''" nf "'\''")) + print "changed " file + }' + # Or: scan key for file/link size, checksum or permission change + # rsync -c is required + #key ~ /[cps]/ { print "changed " prefix file }' +} + +while getopts :V opt; do + case $opt in + (V) echo "$Version"; exit ;; + (*) echo "Usage: $0 [-V]"; exit 1 ;; + esac +done +shift $((OPTIND - 1)) + +diffdir "$1" "$2" -- cgit v1.2.3 From 581ea31ab2a9f88b611080fe646d858c140ed7ca Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 9 Jun 2020 10:06:11 +0200 Subject: update --- bin/backup | 13 +++++++++++-- bin/bgc | 2 +- bin/gauth | 2 +- bin/yoda | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/backup b/bin/backup index 2ee6b83..cc98d63 100755 --- a/bin/backup +++ b/bin/backup @@ -6,7 +6,16 @@ die() { echo "$0: fatal: $@" >&2; exit 1; } [ "$(id -u)" = 0 ] || die must run as root -dest=${1:-bip:/home/backup}/$(hostname) +while getopts :v opt; do + case $opt in + (v) optv=v ;; + (*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;; + esac +done +shift $((OPTIND - 1)) + +#dest=${1:-/backup/$(hostname)} +dest=${1:-/.history} date=$(date +%Y%m%d_%H%M%S) last=$(rsync --list-only $dest/ 2>/dev/null | cut -b 47- | tail -1) @@ -15,4 +24,4 @@ case $last in (*) opt_link=;; esac -rsync -DSHxav --exclude-from=/etc/backup/ignore $opt_link / /boot /home $dest/$date +rsync -DSHxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date diff --git a/bin/bgc b/bin/bgc index 6ff6874..514b9ab 100755 --- a/bin/bgc +++ b/bin/bgc @@ -46,7 +46,7 @@ retention_delay() { } # sorted list of backups, most recent first -lbu=$(ssh bip ls /home/backup/swift | sort -r) +lbu=$(ssh bip ls -rv /home/backup/swift) for d in $lbu; do tsc=$(date2ts $d) if ! [ "$tsp" ]; then diff --git a/bin/gauth b/bin/gauth index 6c00e1e..575d6fc 100755 --- a/bin/gauth +++ b/bin/gauth @@ -1,7 +1,7 @@ #!/bin/sh # Use backup from andOTP -gpg -qd ~/otp_accounts.json.gpg | +gpg -qd ~/.otp_accounts.json.gpg | jq -r '.[] | "\(.label) \(.secret)"' | while read -r l s; do echo "$l $(oathtool --totp -b "$s")" diff --git a/bin/yoda b/bin/yoda index 4aa1667..4a2e0f9 100755 --- a/bin/yoda +++ b/bin/yoda @@ -1,7 +1,7 @@ #!/bin/sh # Setup an archlinux system to a media -version='yoda-0.1' +version='yoda-0.2' help() { echo 'usage: yoda [-CV] [-u user] dev -- cgit v1.2.3 From 371dc62b59b531303b067524497ad37763db2e8d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 10 Jun 2020 08:36:21 +0200 Subject: update --- bin/g5 | 3 +++ bin/note2 | 3 +++ 2 files changed, 6 insertions(+) create mode 100755 bin/g5 create mode 100755 bin/note2 diff --git a/bin/g5 b/bin/g5 new file mode 100755 index 0000000..ef8caff --- /dev/null +++ b/bin/g5 @@ -0,0 +1,3 @@ +#!/bin/sh +adb forward tcp:8022 tcp:8022 +ssh ssh://u0_a126@localhost:8022 diff --git a/bin/note2 b/bin/note2 new file mode 100755 index 0000000..e6d0142 --- /dev/null +++ b/bin/note2 @@ -0,0 +1,3 @@ +#!/bin/sh +adb forward tcp:8122 tcp:8022 +ssh ssh://u0_a79@localhost:8122 -- cgit v1.2.3 From b78cfb6b9bb2b7abecab605406f341dff8227bc3 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 10 Jun 2020 22:22:22 +0200 Subject: update --- bin/backup | 5 +++-- bin/backup-clean | 40 ++++++++++++++++++++++++---------------- bin/diffdir | 12 ++++++------ 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/bin/backup b/bin/backup index cc98d63..3f1d586 100755 --- a/bin/backup +++ b/bin/backup @@ -1,10 +1,12 @@ #!/bin/sh +[ "$USER" = root ] || exec sudo "$0" "$@" + # incremental backup using rsync(1) die() { echo "$0: fatal: $@" >&2; exit 1; } -[ "$(id -u)" = 0 ] || die must run as root +#[ "$(id -u)" = 0 ] || die must run as root while getopts :v opt; do case $opt in @@ -14,7 +16,6 @@ while getopts :v opt; do done shift $((OPTIND - 1)) -#dest=${1:-/backup/$(hostname)} dest=${1:-/.history} date=$(date +%Y%m%d_%H%M%S) last=$(rsync --list-only $dest/ 2>/dev/null | cut -b 47- | tail -1) diff --git a/bin/backup-clean b/bin/backup-clean index 5034c44..fba4279 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -1,32 +1,40 @@ #!/bin/sh # backup garbage collector -# keep: -# 1 backup per year the previous years -hd=3600 # hour duration: 60s * 60 -h12=43200 # 12h -dd=86400 # day duration: hd * 24 -wd=604800 # week duration: dd * 7 -md=2592000 # month duration: dd * 30 -yd=31557600 # year duration: dd * 365.25 +[ "$USER" = root ] || exec sudo "$0" "$@" + +# Durations, in number of seconds. +hd=3600 # hour duration: 60s * 60 +h12=43200 # 12h: hd * 12 +dd=86400 # day duration: hd * 24 +wd=604800 # week duration: dd * 7 +md=2592000 # month duration: dd * 30 +yd=31557600 # year duration: dd * 365.25 now=$(date +'%Y%m%d_%H%M%S') +# The following works only for busybox date, not coreutils +# Kept for reference only. #date2ts() { d=${1%_*} t=${1#*_}; date -d "$d${t%??}" +%s; } + +# Convert date to timestamp, using date from GNU coreutils, +# works also with busybox date. date2ts() { - t=$1; r=${t#????}; Y=${t%$r} - t=$r; r=${t#??}; m=${t%$r} - t=$r; r=${t#??}; d=${t%$r} - t=${r#_}; r=${t#??}; H=${t%$r} - t=$r; r=${t#??}; M=${t%$r} - S=${t#??} + t=$1; r=${t#????}; Y=${t%$r} # Year (with century) + t=$r; r=${t#??}; m=${t%$r} # Month + t=$r; r=${t#??}; d=${t%$r} # Day + t=${r#_}; r=${t#??}; H=${t%$r} # Hour + t=$r; r=${t#??}; M=${t%$r} # Minute + S=${t#??} # Second date -d "$Y-$m-$d $H:$M:$S" +%s + #date -jf "%Y-%m-%d %H:%M:%S" "$Y-$m-$d $H:$M:$S" +%s # BSD, MacOSX } ts2date() { date -d "@$1" +'%Y%m%d_%H%M%S'; } tsn=$(date2ts "$now") -# minimal retention delay, according to backup age +# Minimal retention delay in seconds, according to backup age, +# implemented using POSIX shell arithmetic. retention_delay() { d=$((tsn - $1)) if [ $((d < h12)) = 1 ]; then @@ -54,7 +62,7 @@ while getopts :nv opt; do done shift $((OPTIND - 1)) -# sorted list of backups, most recent first +# Sorted list of backups, most recent first dest=${1:-/.history} lbu=$(ls -rv "$dest") for d in $lbu; do diff --git a/bin/diffdir b/bin/diffdir index 57997ed..d1a8ae2 100755 --- a/bin/diffdir +++ b/bin/diffdir @@ -4,8 +4,8 @@ Version='diffdir-0.1' diffdir() { [ -f "/etc/backup/ignore" ] && xf=--exclude-from=/etc/backup/ignore || xf= - rsync -aDSniv $xf --delete $Optx "$2/" "$1" | - awk -v OptF="${OptF#./}" -v prefix=$prefix ' + rsync -aDSnivx "$xf" --delete "$2/" "$1" | + awk -v OptF="${OptF#./}" -v prefix="$prefix" ' NF == 0 {exit} NR < 2 || /\/*\.dv$/ || /\/$/ {next} # Match an itemized status for all versions of rsync -i @@ -15,13 +15,13 @@ diffdir() { key == "*deleting" {print "deleted " prefix file; next} substr(key, 3, 7) == "+++++++" {print "created " prefix file; next} { # Avoid false positive if only mtime is changed. - of = "'$1'/" file; gsub("'\''", "'\'\\\\\'\''", of) - nf = "'$2'/" file; gsub("'\''", "'\'\\\\\'\''", nf) + of = "'"$1"'/" file; gsub("'\''", "'\'\\\\\'\''", of) + nf = "'"$2"'/" file; gsub("'\''", "'\'\\\\\'\''", nf) if (substr(key, 2, 1) == "L") { # Symlink src = target = file sub(/.* -> /, "", target); sub(/ -> .*/, "", src); - "readlink '$2'/" src | getline otarget + "readlink '"$2"'/" src | getline otarget if (target != otarget) print "changed " src } else if (system("cmp -s '\''" of "'\'\ \''" nf "'\''")) @@ -35,7 +35,7 @@ diffdir() { while getopts :V opt; do case $opt in (V) echo "$Version"; exit ;; - (*) echo "Usage: $0 [-V]"; exit 1 ;; + (*) echo "Usage: $0 [-V] old new"; exit 1 ;; esac done shift $((OPTIND - 1)) -- cgit v1.2.3 From a07956c688c2aab48ab0f8e39e4ce57c13a7a93e Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 10 Jun 2020 23:47:15 +0200 Subject: update --- bin/backup-clean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/backup-clean b/bin/backup-clean index fba4279..054ffbc 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -62,7 +62,7 @@ while getopts :nv opt; do done shift $((OPTIND - 1)) -# Sorted list of backups, most recent first +# Sorted list of backups, most recent first. dest=${1:-/.history} lbu=$(ls -rv "$dest") for d in $lbu; do -- cgit v1.2.3 From d746e010b0e5636b38eec22caa2ff9df43d09b95 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 13 Jun 2020 10:12:49 +0200 Subject: update --- bin/yoda | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/yoda b/bin/yoda index 4a2e0f9..8ff9e81 100755 --- a/bin/yoda +++ b/bin/yoda @@ -1,7 +1,9 @@ #!/bin/sh # Setup an archlinux system to a media -version='yoda-0.2' +[ "$USER" = root ] || exec sudo "$0" "$@" + +version='yoda-0.3' help() { echo 'usage: yoda [-CV] [-u user] dev @@ -38,7 +40,7 @@ skip() { # return 1 if any of the required commands is missing prereq() { ok='ok' - for cmd in cryptsetup dd fdisk mkfs.fat mkfs.ext4 mount pacstrap genfstab arch-chroot + for cmd in cryptsetup dd fdisk mkfs.fat mkfs.ext4 mkfs.xfs mount pacstrap genfstab arch-chroot do command -v "$cmd" >/dev/null || { ok=''; echo "$cmd not found"; } done @@ -81,7 +83,7 @@ step2() { # Step 3: Format partitions. step3() { mkfs.fat -F32 "${dev}${ppref}1" - yes | mkfs.ext4 "$rootpart" + mkfs.xfs "$rootpart" } # Step 4: Mount partitions. @@ -172,7 +174,7 @@ DNSSEC=no EOT packages="linux linux-firmware intel-ucode amd-ucode sof-firmware \ - dosfstools sudo vi wireless_tools wpa_supplicant openssh arch-install-scripts" + xfsprogs dosfstools sudo vi wireless_tools wpa_supplicant openssh arch-install-scripts" arch-chroot /mnt << EOT locale-gen @@ -237,8 +239,8 @@ while getopts :CFH:S:u:V opt; do done shift $((OPTIND - 1)) -[ "$(id -u)" = 0 ] || die "not root" [ "$1" ] && dev=$1 || die 'no device' + par=${dev##*/}root case $dev in (*nvme*) ppref='p';; esac rootpart="${dev}${ppref}2" -- cgit v1.2.3 From 71767b52cae787217b9e18dbd214f28a7b5b1c9a Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 15 Jun 2020 15:47:00 +0200 Subject: update --- .bashrc | 1 + bin/backup | 17 +++++++---------- bin/byo | 34 ++++++++++++++++++++++++++++++++++ bin/yoda | 12 +++++++----- 4 files changed, 49 insertions(+), 15 deletions(-) create mode 100755 bin/byo diff --git a/.bashrc b/.bashrc index 771c00e..14c87b7 100644 --- a/.bashrc +++ b/.bashrc @@ -38,6 +38,7 @@ 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 vi='vim' diff --git a/bin/backup b/bin/backup index 3f1d586..059f2dc 100755 --- a/bin/backup +++ b/bin/backup @@ -1,17 +1,12 @@ #!/bin/sh +# Incremental backup using rsync(1). [ "$USER" = root ] || exec sudo "$0" "$@" -# incremental backup using rsync(1) - -die() { echo "$0: fatal: $@" >&2; exit 1; } - -#[ "$(id -u)" = 0 ] || die must run as root - -while getopts :v opt; do +while getopts :Fv opt; do case $opt in - (v) optv=v ;; - (*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;; + (F|v) eval "opt$opt=$opt" ;; + (*) echo "Usage: $0 [-Fv] [[host:]dir]"; exit 1 ;; esac done shift $((OPTIND - 1)) @@ -25,4 +20,6 @@ case $last in (*) opt_link=;; esac -rsync -DSHxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date +[ "$optF" ] && fsfreeze -f / && trap 'fsfreeze -u /' EXIT + +rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date diff --git a/bin/byo b/bin/byo new file mode 100755 index 0000000..173c2a7 --- /dev/null +++ b/bin/byo @@ -0,0 +1,34 @@ +#!/bin/sh -e +# Backup to yoda +[ "$USER" = root ] || exec sudo "$0" "$@" + +usage='Usage: byo [-cdk] +Backup local disk to yoda external disk. + +Options: + -c close and umount yoda + -d dedupe yoda + -k do not umount and close yoda +' + +while getopts :cdk opt; do + case $opt in + (c|d|k) eval "opt$opt=$opt" ;; + (*) printf %s "$usage"; exit 1 ;; + esac +done +shift $((OPTIND - 1)) + +yoda_uuid='8c463221-6bb7-414e-9060-c9570bb3a6bb' + +dest=/mnt/backup/$(hostname) +[ -b /dev/mapper/yoda ] && noclose=1 || cryptsetup open "$(blkid --uuid "$yoda_uuid")" yoda +findmnt /dev/mapper/yoda /mnt >/dev/null && noumount=1 || mount /dev/mapper/yoda /mnt +time backup -Fv "$dest" +backup-clean -v "$dest" +[ ! "$optd" ] || time duperemove -drh --hashfile="$dest/.hashfile" "$dest" +[ ! "$optk" ] || noumount=1 noclose=1 +[ ! "$optc" ] || noumount='' noclose='' +[ "$noumount" ] || umount /mnt +[ "$noclose" ] || cryptsetup close yoda +echo "bye" diff --git a/bin/yoda b/bin/yoda index 4a2e0f9..8ff9e81 100755 --- a/bin/yoda +++ b/bin/yoda @@ -1,7 +1,9 @@ #!/bin/sh # Setup an archlinux system to a media -version='yoda-0.2' +[ "$USER" = root ] || exec sudo "$0" "$@" + +version='yoda-0.3' help() { echo 'usage: yoda [-CV] [-u user] dev @@ -38,7 +40,7 @@ skip() { # return 1 if any of the required commands is missing prereq() { ok='ok' - for cmd in cryptsetup dd fdisk mkfs.fat mkfs.ext4 mount pacstrap genfstab arch-chroot + for cmd in cryptsetup dd fdisk mkfs.fat mkfs.ext4 mkfs.xfs mount pacstrap genfstab arch-chroot do command -v "$cmd" >/dev/null || { ok=''; echo "$cmd not found"; } done @@ -81,7 +83,7 @@ step2() { # Step 3: Format partitions. step3() { mkfs.fat -F32 "${dev}${ppref}1" - yes | mkfs.ext4 "$rootpart" + mkfs.xfs "$rootpart" } # Step 4: Mount partitions. @@ -172,7 +174,7 @@ DNSSEC=no EOT packages="linux linux-firmware intel-ucode amd-ucode sof-firmware \ - dosfstools sudo vi wireless_tools wpa_supplicant openssh arch-install-scripts" + xfsprogs dosfstools sudo vi wireless_tools wpa_supplicant openssh arch-install-scripts" arch-chroot /mnt << EOT locale-gen @@ -237,8 +239,8 @@ while getopts :CFH:S:u:V opt; do done shift $((OPTIND - 1)) -[ "$(id -u)" = 0 ] || die "not root" [ "$1" ] && dev=$1 || die 'no device' + par=${dev##*/}root case $dev in (*nvme*) ppref='p';; esac rootpart="${dev}${ppref}2" -- cgit v1.2.3 From ad7f45231cb867990a03830ec09e0cd41959f539 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 24 Jun 2020 14:29:51 +0200 Subject: update --- .config/chromium-flags.conf | 6 ------ bin/backup | 14 ++++++-------- bin/byo | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 .config/chromium-flags.conf diff --git a/.config/chromium-flags.conf b/.config/chromium-flags.conf deleted file mode 100644 index a5ef947..0000000 --- a/.config/chromium-flags.conf +++ /dev/null @@ -1,6 +0,0 @@ ---disk-cache-dir=/tmp/cache ---enable-dom-distiller ---ignore-gpu-blacklist ---enable-gpu-rasterization ---enable-native-gpu-memory-buffers ---enable-zero-copy diff --git a/bin/backup b/bin/backup index 059f2dc..4ef83be 100755 --- a/bin/backup +++ b/bin/backup @@ -3,23 +3,21 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -while getopts :Fv opt; do +while getopts :v opt; do case $opt in - (F|v) eval "opt$opt=$opt" ;; - (*) echo "Usage: $0 [-Fv] [[host:]dir]"; exit 1 ;; + (v) eval "opt$opt=$opt" ;; + (*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;; esac done shift $((OPTIND - 1)) dest=${1:-/.history} date=$(date +%Y%m%d_%H%M%S) -last=$(rsync --list-only $dest/ 2>/dev/null | cut -b 47- | tail -1) +last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) case $last in -(2*) opt_link=--link-dest=../$last;; +([12]*) opt_link=--link-dest=../$last;; (*) opt_link=;; esac -[ "$optF" ] && fsfreeze -f / && trap 'fsfreeze -u /' EXIT - -rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date +rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot "$dest/$date" diff --git a/bin/byo b/bin/byo index 173c2a7..71b7578 100755 --- a/bin/byo +++ b/bin/byo @@ -24,7 +24,7 @@ yoda_uuid='8c463221-6bb7-414e-9060-c9570bb3a6bb' dest=/mnt/backup/$(hostname) [ -b /dev/mapper/yoda ] && noclose=1 || cryptsetup open "$(blkid --uuid "$yoda_uuid")" yoda findmnt /dev/mapper/yoda /mnt >/dev/null && noumount=1 || mount /dev/mapper/yoda /mnt -time backup -Fv "$dest" +time backup -v "$dest" backup-clean -v "$dest" [ ! "$optd" ] || time duperemove -drh --hashfile="$dest/.hashfile" "$dest" [ ! "$optk" ] || noumount=1 noclose=1 -- cgit v1.2.3 From 737ca59089a60edd0447db39775a97ec7fb96268 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 29 Jul 2020 16:31:28 +0200 Subject: update --- .bashrc | 5 ++++- .config/i3/config | 1 + bin/backup | 37 +++++++++++++++++++++++++------------ bin/backup-clean | 9 +++++---- bin/byo | 5 +++-- bin/diffdir | 21 ++++++++++++++++++++- 6 files changed, 58 insertions(+), 20 deletions(-) diff --git a/.bashrc b/.bashrc index 14c87b7..5427224 100644 --- a/.bashrc +++ b/.bashrc @@ -32,6 +32,9 @@ fixab() { printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 "$1"; } #export LESS_TERMCAP_us=$(tput setaf 5) # underline (magenta) #export LESS_TERMCAP_ue=$'\E[0m' # end underline +# bat +export BAT_THEME='github' + # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' @@ -67,7 +70,7 @@ alias wpa='sudo wpa_gui -i wlan0' alias ifre='echo "ip link set wlo1 down; ip link set wlo1 up"|sudo sh' -alias by='go build cmd/yaegi/yaegi.go' +alias by='go build ./cmd/yaegi' alias cy='cd ~/go/src/github.com/containous/yaegi' #alias ty='go test -v -short ./interp' alias ya='rlwrap -pblue ./yaegi' diff --git a/.config/i3/config b/.config/i3/config index 757e202..677dc90 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -61,6 +61,7 @@ for_window [class="Gpicview"] floating enable for_window [class="Ghb"] floating enable for_window [class="Gitk"] floating enable for_window [class="gnuplot_qt"] floating enable +for_window [instance="gxditview"] floating enable for_window [class="Keybase"] floating enable for_window [class="libreoffice"] floating enable for_window [class="llpp"] floating enable diff --git a/bin/backup b/bin/backup index 4ef83be..d56ee7f 100755 --- a/bin/backup +++ b/bin/backup @@ -3,21 +3,34 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -while getopts :v opt; do +backup() { + date=$(date +%Y%m%d_%H%M%S) + last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) + + case $last in + ([12]*) opt_link=--link-dest=../$last;; + (*) opt_link=;; + esac + + rsync -HSxa$optv --exclude-from=$ignore $opt_link / /boot "$dest/$date" +} + +dest=/.history +ignore=/etc/backup/ignore + +while getopts :d:i:nv opt; do case $opt in - (v) eval "opt$opt=$opt" ;; - (*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;; + (d) dest="$OPTARG" ;; + (i) ignore="$OPTARG" ;; + (n|v) optv="$opt$optv" ;; + (*) echo "Usage: $0 [-nv] [-d [host:]dir] [clean|diff]"; exit 1 ;; esac done shift $((OPTIND - 1)) -dest=${1:-/.history} -date=$(date +%Y%m%d_%H%M%S) -last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) - -case $last in -([12]*) opt_link=--link-dest=../$last;; -(*) opt_link=;; +[ "$1" ] && cmd=$1 && shift || cmd="" +case $cmd in +(""|save) backup ;; +(clean) exec backup-clean ${optv+-$optv} "$@" "$dest";; +(diff) exec diffdir "$@";; esac - -rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot "$dest/$date" diff --git a/bin/backup-clean b/bin/backup-clean index 054ffbc..d12159d 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -26,7 +26,7 @@ date2ts() { t=$r; r=${t#??}; M=${t%$r} # Minute S=${t#??} # Second date -d "$Y-$m-$d $H:$M:$S" +%s - #date -jf "%Y-%m-%d %H:%M:%S" "$Y-$m-$d $H:$M:$S" +%s # BSD, MacOSX + #date -jf "%Y-%m-%d %H:%M:%S" "$Y-$m-$d $H:$M:$S" +%s # BSD, MacOS (not tested) } ts2date() { date -d "@$1" +'%Y%m%d_%H%M%S'; } @@ -53,17 +53,18 @@ retention_delay() { echo $r } -while getopts :nv opt; do +dest=/.history +while getopts :nd:v opt; do case $opt in + (d) dest=$OPTARG ;; (n) optn=1 ;; (v) optv=1 ;; - (*) echo "Usage: $0 [-nv] [dir]"; exit 1; + (*) echo "Usage: $0 [-nv] [-d dir]"; exit 1; esac done shift $((OPTIND - 1)) # Sorted list of backups, most recent first. -dest=${1:-/.history} lbu=$(ls -rv "$dest") for d in $lbu; do tsc=$(date2ts "$d") diff --git a/bin/byo b/bin/byo index 71b7578..ecaba23 100755 --- a/bin/byo +++ b/bin/byo @@ -24,9 +24,10 @@ yoda_uuid='8c463221-6bb7-414e-9060-c9570bb3a6bb' dest=/mnt/backup/$(hostname) [ -b /dev/mapper/yoda ] && noclose=1 || cryptsetup open "$(blkid --uuid "$yoda_uuid")" yoda findmnt /dev/mapper/yoda /mnt >/dev/null && noumount=1 || mount /dev/mapper/yoda /mnt -time backup -v "$dest" -backup-clean -v "$dest" +time backup -v -d "$dest" +backup -v -d "$dest" clean [ ! "$optd" ] || time duperemove -drh --hashfile="$dest/.hashfile" "$dest" +df -h / "$dest" [ ! "$optk" ] || noumount=1 noclose=1 [ ! "$optc" ] || noumount='' noclose='' [ "$noumount" ] || umount /mnt diff --git a/bin/diffdir b/bin/diffdir index d1a8ae2..cbe03b7 100755 --- a/bin/diffdir +++ b/bin/diffdir @@ -32,6 +32,20 @@ diffdir() { #key ~ /[cps]/ { print "changed " prefix file }' } +last() { + i=0 m=0 + case $1 in + ([0-9]|[1-9][0-9]) m=$((m + $1)) ;; + ("") ;; + (*) echo "$1"; return ;; + esac + for l in $vlist; do + [ $i -ge $m ] && break + i=$((i + 1)) + done + echo "$dest/$l" +} + while getopts :V opt; do case $opt in (V) echo "$Version"; exit ;; @@ -40,4 +54,9 @@ while getopts :V opt; do done shift $((OPTIND - 1)) -diffdir "$1" "$2" +dest=/.history +vlist=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tac) + +old=$(last "$1") new=$(last "${2:-/}") +echo "diffdir" "$old" "$new" +diffdir "$old" "$new" -- cgit v1.2.3 From 7bac050e12201c40194d9df7bf711159f4acfa89 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 18 Sep 2020 15:21:29 +0200 Subject: update --- .bashrc | 6 +++--- .config/i3/config | 3 ++- bin/backup | 2 +- bin/backup-clean | 6 +++--- bin/hdmi | 1 + bin/stbip | 7 +++++++ 6 files changed, 17 insertions(+), 8 deletions(-) create mode 100755 bin/stbip diff --git a/.bashrc b/.bashrc index 5427224..821e08b 100644 --- a/.bashrc +++ b/.bashrc @@ -71,16 +71,16 @@ alias wpa='sudo wpa_gui -i wlan0' alias ifre='echo "ip link set wlo1 down; ip link set wlo1 up"|sudo sh' alias by='go build ./cmd/yaegi' -alias cy='cd ~/go/src/github.com/containous/yaegi' +alias cy='cd ~/go/src/github.com/traefik/yaegi' #alias ty='go test -v -short ./interp' alias ya='rlwrap -pblue ./yaegi' alias dya='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi' -alias wai='~/go/src/github.co/containous/whoami/whoami' +alias wai='~/go/src/github.co/traefik/whoami/whoami' # yaegi debug export YAEGI_DOT_CMD='dotty -' -tfk() { ~/go/src/github.com/containous/traefik/traefik "$@"; } +tfk() { ~/go/src/github.com/traefik/traefik/traefik "$@"; } export -f tfk ty() { go test -v -short ./interp; } diff --git a/.config/i3/config b/.config/i3/config index 677dc90..bf8a196 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -50,7 +50,8 @@ bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOU for_window [class="Arandr"] floating enable for_window [class="Brave-browser"] floating enable for_window [class="Chromium"] floating enable -for_window [instance="Task Manager - Chromium"] floating enable +for_window [title="Task Manager - Chromium"] floating enable +for_window [title="Gestionnaire de tâches – Chromium"] floating enable for_window [instance="DOTTY"] floating enable for_window [class="discord"] floating enable for_window [class="Display"] floating enable diff --git a/bin/backup b/bin/backup index d56ee7f..72c69c3 100755 --- a/bin/backup +++ b/bin/backup @@ -31,6 +31,6 @@ shift $((OPTIND - 1)) [ "$1" ] && cmd=$1 && shift || cmd="" case $cmd in (""|save) backup ;; -(clean) exec backup-clean ${optv+-$optv} "$@" "$dest";; +(clean) exec backup-clean ${optv+-$optv} "$dest";; (diff) exec diffdir "$@";; esac diff --git a/bin/backup-clean b/bin/backup-clean index d12159d..0c6e38a 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -54,15 +54,15 @@ retention_delay() { } dest=/.history -while getopts :nd:v opt; do +while getopts :nv opt; do case $opt in - (d) dest=$OPTARG ;; (n) optn=1 ;; (v) optv=1 ;; - (*) echo "Usage: $0 [-nv] [-d dir]"; exit 1; + (*) echo "Usage: $0 [-nv] [dir]"; exit 1; esac done shift $((OPTIND - 1)) +[ "$1" ] && dest=$1 # Sorted list of backups, most recent first. lbu=$(ls -rv "$dest") diff --git a/bin/hdmi b/bin/hdmi index f5f7b1f..75e6f37 100755 --- a/bin/hdmi +++ b/bin/hdmi @@ -2,6 +2,7 @@ # Toggle auxiliary HDMI screen on/off when connected/disconnected. opt="--auto --right-of eDP-1" +#opt="--auto --above eDP-1" # Also add the following rule to /etc/udev/rules.d/hdmi.rules # KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" diff --git a/bin/stbip b/bin/stbip new file mode 100755 index 0000000..e4a51a0 --- /dev/null +++ b/bin/stbip @@ -0,0 +1,7 @@ +#!/bin/sh + +# Check or establish a ssh tunnel for remote acess to syncthing GUI on bip. +netstat -t4ln | grep 9090 || + ssh -N -L 9090:127.0.0.1:8384 bip.im /dev/null 2>&1 & + +xdg-open http://127.0.0.1:9090 -- cgit v1.2.3 From 04746767a400dbdc03943b872f829732c4335e5f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 25 Sep 2020 15:57:37 +0200 Subject: update --- bin/backup-clean | 10 +++++++--- bin/byo | 7 ++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/backup-clean b/bin/backup-clean index 0c6e38a..30d25db 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -54,11 +54,12 @@ retention_delay() { } dest=/.history -while getopts :nv opt; do +while getopts :d:nv opt; do case $opt in + (d) tsn=$(date2ts "$OPTARG") ;; (n) optn=1 ;; (v) optv=1 ;; - (*) echo "Usage: $0 [-nv] [dir]"; exit 1; + (*) echo "Usage: $0 [-nv] [dir]"; exit 1 ;; esac done shift $((OPTIND - 1)) @@ -66,6 +67,8 @@ shift $((OPTIND - 1)) # Sorted list of backups, most recent first. lbu=$(ls -rv "$dest") +lasy=${lbu##* +} for d in $lbu; do tsc=$(date2ts "$d") if ! [ "$tsp" ]; then @@ -75,7 +78,8 @@ for d in $lbu; do fi mrd=$(retention_delay "$tsp") dp=$((tsp - tsc)) - if [ $((dp < mrd)) = 1 ]; then + #if [ $((dp < mrd)) = 1 ]; then + if [ "$d" != "last" -a $((dp < mrd)) = 1 ]; then [ "$optv" ] && echo "delete $dest/$d" [ "$optn" ] || rm -rf "${dest:?}/$d" else diff --git a/bin/byo b/bin/byo index ecaba23..389e112 100755 --- a/bin/byo +++ b/bin/byo @@ -11,9 +11,9 @@ Options: -k do not umount and close yoda ' -while getopts :cdk opt; do +while getopts :Ccdk opt; do case $opt in - (c|d|k) eval "opt$opt=$opt" ;; + (C|c|d|k) eval "opt$opt=$opt" ;; (*) printf %s "$usage"; exit 1 ;; esac done @@ -25,9 +25,10 @@ dest=/mnt/backup/$(hostname) [ -b /dev/mapper/yoda ] && noclose=1 || cryptsetup open "$(blkid --uuid "$yoda_uuid")" yoda findmnt /dev/mapper/yoda /mnt >/dev/null && noumount=1 || mount /dev/mapper/yoda /mnt time backup -v -d "$dest" -backup -v -d "$dest" clean +[ ! "$optC" ] || backup -v -d "$dest" clean [ ! "$optd" ] || time duperemove -drh --hashfile="$dest/.hashfile" "$dest" df -h / "$dest" +ls -v "$dest" [ ! "$optk" ] || noumount=1 noclose=1 [ ! "$optc" ] || noumount='' noclose='' [ "$noumount" ] || umount /mnt -- cgit v1.2.3 From 206192298984a30706243d5ec8ab767ca47fb5d5 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 1 Oct 2020 11:03:34 +0200 Subject: update --- .config/i3/config | 2 +- .gitconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/i3/config b/.config/i3/config index bf8a196..bc65b99 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -99,7 +99,7 @@ bindsym --release button2 kill #bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'" #bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'" bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -bindsym F1 exec --no-startup-id i3-dmenu-desktop +bindsym F1 exec --no-startup-id i3-dmenu-desktop -entry-type=command # Use playerctl to control media player from keyboard bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause diff --git a/.gitconfig b/.gitconfig index 3459f0e..eaefde0 100644 --- a/.gitconfig +++ b/.gitconfig @@ -7,6 +7,7 @@ do = diff origin/master ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%an]" --decorate st = status -s + undo = reset HEAD~ [user] email = mvertes@free.fr name = Marc Vertes -- cgit v1.2.3 From 42c709e21c6e7e4a2276128eee9743a43a174998 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 2 Oct 2020 12:57:47 +0200 Subject: update --- .Xresources | 5 +++++ .config/i3/config | 10 +++++++--- .i3status.conf | 24 +++++++++++++++++------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.Xresources b/.Xresources index 0a54cfc..a653af4 100644 --- a/.Xresources +++ b/.Xresources @@ -21,6 +21,11 @@ xterm*VT100.Translations: #override \ Ctrl Next: smaller-vt-font() \n\ Ctrl Prior: larger-vt-font() \n ! xterm*font: 7x14 +! Allow sixel graphics. (Try: "convert -colors 16 foo.jpg sixel:-"). +xterm*decTerminalID: vt340 +! Allow xterm to read the terminal window size (op #14) +xterm*allowWindowOps : False +xterm*disallowedWindowOps : 1,2,3,4,5,6,7,8,9,11,13,18,19,20,21,GetSelection,SetSelection,SetWinLines,SetXprop ! Black + DarkGrey *color0: #000000 diff --git a/.config/i3/config b/.config/i3/config index bc65b99..d22c3be 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -14,7 +14,9 @@ set $mod Mod4 # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. #font pango:monospace 8 -font fixed +#font fixed +# Same as above X11 fixed 6x13, but with icons +font pango:MiscFixedSC613 regular 9 #font pango:monospace 8, Noto sans 8 # This font is widely installed, provides lots of unicode glyphs, right-to-left @@ -99,7 +101,8 @@ bindsym --release button2 kill #bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'" #bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'" bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -bindsym F1 exec --no-startup-id i3-dmenu-desktop -entry-type=command +#bindsym F1 exec --no-startup-id i3-dmenu-desktop -entry-type=command +bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Fixed-12'" # Use playerctl to control media player from keyboard bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause @@ -246,6 +249,7 @@ bindsym $mod+less move workspace to output left # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) bar { - status_command LANG=fr_FR.UTF-8 i3status +# status_command LANG=fr_FR.UTF-8 i3status + status_command i3status tray_output primary } diff --git a/.i3status.conf b/.i3status.conf index ebd8243..e60903b 100644 --- a/.i3status.conf +++ b/.i3status.conf @@ -29,10 +29,12 @@ read_file hostname { path = "/etc/hostname" } +# ☠ wireless _first_ { -# format_up = "W: %essid %quality %ip" - format_up = "W: %essid %quality" - format_down = "W: down" + #format_up = "🌐 %essid %quality" + #format_up = "📶 %essid %quality" + format_up = "📡 %essid %quality" + format_down = "📡 down" } ethernet _first_ { @@ -40,10 +42,15 @@ ethernet _first_ { format_down = "E: down" } +# battery all { last_full_capacity = true integer_battery_capacity = true format = "%status %percentage %remaining" + status_chr = "⚡🔋" + status_bat = "🔋" + status_unk = "? UNK" + status_full = "⚡🔋" threshold_type = "percentage" low_threshold = 10 } @@ -60,7 +67,9 @@ battery all { #} disk "/" { - format = "/ %avail" + #format = "📀 %avail" + #format = "💽 %avail" + format = "/ %avail av." } disk "/boot" { @@ -68,7 +77,7 @@ disk "/boot" { } cpu_usage { - format = "CPU: %usage" + format = "CPU %usage" } load { @@ -76,17 +85,18 @@ load { } memory { - format = "RAM: %available" + format = "Mem %available av." threshold_degraded = "1G" format_degraded = "MEMORY < %available" } cpu_temperature 0 { - format = "T: %degrees °C" + format = "🌡%degrees °C" path = "/sys/class/hwmon/hwmon0/temp1_input" } tztime local { #format = "%Y-%m-%d %H:%M:%S" format = "%a %d %b %H:%M:%S" + #format = "📅 %a %d %b ⌚ %H:%M:%S" } -- cgit v1.2.3 From 60a71e503da5a93d6fc362a096ce12ff58124653 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 4 Oct 2020 11:19:09 +0200 Subject: update --- .bash-powerline.sh | 6 ++++-- .i3status.conf | 2 +- .profile | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.bash-powerline.sh b/.bash-powerline.sh index 8121f92..232d7a5 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -12,7 +12,8 @@ __powerline() { readonly COLOR_SUCCESS='\[\033[0;34m\]' # blue readonly COLOR_FAILURE='\[\033[0;31m\]' # red - readonly SYMBOL_GIT_BRANCH='⑂' + #readonly SYMBOL_GIT_BRANCH='⑂' + readonly SYMBOL_GIT_BRANCH='→' readonly SYMBOL_GIT_MODIFIED='*' readonly SYMBOL_GIT_PUSH='↑' readonly SYMBOL_GIT_PULL='↓' @@ -66,7 +67,7 @@ __powerline() { done < <($git_eng status --porcelain --branch 2>/dev/null) # note the space between the two < # print the git branch segment without a trailing newline - printf " $ref$marks" + printf "$ref$marks" } ps1() { @@ -98,6 +99,7 @@ __powerline() { fi } + PROMPT_DIRTRIM=2 PROMPT_COMMAND="ps1${PROMPT_COMMAND:+; $PROMPT_COMMAND}" } diff --git a/.i3status.conf b/.i3status.conf index e60903b..b3af3a3 100644 --- a/.i3status.conf +++ b/.i3status.conf @@ -5,6 +5,7 @@ # The following line should contain a sharp s: # ß # If the above line is not correctly displayed, fix your editor first! +# Some icon chars can be found at https://emojipedia.org/objects/ general { colors = true @@ -29,7 +30,6 @@ read_file hostname { path = "/etc/hostname" } -# ☠ wireless _first_ { #format_up = "🌐 %essid %quality" #format_up = "📶 %essid %quality" diff --git a/.profile b/.profile index 3a407f5..cb09e87 100644 --- a/.profile +++ b/.profile @@ -6,5 +6,5 @@ PATH=~/bin:$PATH:~/go/bin # Last action: auto start X11 when logged on first console case $HOSTNAME in -(swift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; +([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; esac -- cgit v1.2.3 From 57f1105837aaf407b3f0e2485e6666668ed2ef28 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 4 Oct 2020 16:07:51 +0200 Subject: add local fixed fonts --- .local/share/fonts/misc-fixed.ttf | Bin 0 -> 42468 bytes .local/share/fonts/miscfs.ttf | Bin 0 -> 23280 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 .local/share/fonts/misc-fixed.ttf create mode 100644 .local/share/fonts/miscfs.ttf diff --git a/.local/share/fonts/misc-fixed.ttf b/.local/share/fonts/misc-fixed.ttf new file mode 100644 index 0000000..cf1d11f Binary files /dev/null and b/.local/share/fonts/misc-fixed.ttf differ diff --git a/.local/share/fonts/miscfs.ttf b/.local/share/fonts/miscfs.ttf new file mode 100644 index 0000000..0a81111 Binary files /dev/null and b/.local/share/fonts/miscfs.ttf differ -- cgit v1.2.3 From ea39a38f64f0f2f752e1776038abb15332d98df1 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 4 Oct 2020 23:37:00 +0200 Subject: bash-powerline.sh: shorter prompt --- .bash-powerline.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bash-powerline.sh b/.bash-powerline.sh index 232d7a5..dffbf41 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -74,9 +74,9 @@ __powerline() { # Check the exit code of the previous command and display different # colors in the prompt accordingly. if [ $? -eq 0 ]; then - local symbol="$COLOR_SUCCESS $PS_SYMBOL $RESET" + local symbol="$COLOR_SUCCESS$PS_SYMBOL $RESET" else - local symbol="$COLOR_FAILURE $PS_SYMBOL $RESET" + local symbol="$COLOR_FAILURE$PS_SYMBOL $RESET" fi local cwd="$COLOR_CWD\w$RESET" -- cgit v1.2.3 From dc2b69508c58085ece7be617ae05ebaab5b7ecb2 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 5 Oct 2020 11:00:20 +0200 Subject: bash-powerline: space --- .bash-powerline.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bash-powerline.sh b/.bash-powerline.sh index dffbf41..047631c 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -58,8 +58,8 @@ __powerline() { # scan first two lines of output from `git status` while IFS= read -r line; do if [[ $line =~ ^## ]]; then # header line - [[ $line =~ ahead\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PUSH${BASH_REMATCH[1]}" - [[ $line =~ behind\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PULL${BASH_REMATCH[1]}" + [[ $line =~ ahead\ ([0-9]+) ]] && marks+="$SYMBOL_GIT_PUSH${BASH_REMATCH[1]}" + [[ $line =~ behind\ ([0-9]+) ]] && marks+="$SYMBOL_GIT_PULL${BASH_REMATCH[1]}" else # branch is modified if output contains more lines after the header line marks="$SYMBOL_GIT_MODIFIED$marks" break -- cgit v1.2.3 From d6f29a6f21fdc418d3ab5edb782bbb38afbf1f47 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 6 Oct 2020 13:19:05 +0200 Subject: bash-powerline: restore space before prompt char --- .bash-powerline.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bash-powerline.sh b/.bash-powerline.sh index 047631c..556391f 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -74,9 +74,9 @@ __powerline() { # Check the exit code of the previous command and display different # colors in the prompt accordingly. if [ $? -eq 0 ]; then - local symbol="$COLOR_SUCCESS$PS_SYMBOL $RESET" + local symbol="$COLOR_SUCCESS $PS_SYMBOL $RESET" else - local symbol="$COLOR_FAILURE$PS_SYMBOL $RESET" + local symbol="$COLOR_FAILURE $PS_SYMBOL $RESET" fi local cwd="$COLOR_CWD\w$RESET" -- cgit v1.2.3 From a5f4594b09d034c2302c37516aa4db0e33ef77d9 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 8 Oct 2020 11:25:04 +0200 Subject: add dunst --- .config/dunst/dunstrc | 434 ++++++++++++++++++++++++++++++++++++++++++++++++++ .config/i3/config | 3 + 2 files changed, 437 insertions(+) create mode 100644 .config/dunst/dunstrc diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc new file mode 100644 index 0000000..d5a7f1b --- /dev/null +++ b/.config/dunst/dunstrc @@ -0,0 +1,434 @@ +[global] + ### Display ### + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a window manager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern window managers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = mouse + + # The geometry of the window: + # [{width}]x{height}[+/-{x}+/-{y}] + # The geometry of the message window. + # The height is measured in number of notifications everything else + # in pixels. If the width is omitted but the height is given + # ("-geometry x2"), the message window expands over the whole screen + # (dmenu-like). If width is 0, the window expands to the longest + # message displayed. A positive x is measured from the left, a + # negative from the right side of the screen. Y is measured from + # the top and down respectively. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. + geometry = "300x5-30+20" + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = yes + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = no + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing window manager is + # present (e.g. xcompmgr, compiz, etc.). + transparency = 0 + + # The height of the entire notification. If the height is smaller + # than the font height and padding combined, it will be raised + # to the font height and padding. + notification_height = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 2 + + # Padding between text and separator. + padding = 8 + + # Horizontal padding. + horizontal_padding = 8 + + # Defines width in pixels of frame around the notification window. + # Set to 0 to disable. + frame_width = 3 + + # Defines color of the frame around the notification window. + frame_color = "#aaaaaa" + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Sort messages by urgency. + sort = yes + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + # A client can set the 'transient' hint to bypass this. See the rules + # section for how to disable this if necessary + idle_threshold = 120 + + ### Text ### + + font = Monospace 8 + + # The spacing between lines. If the height is smaller than the + # font height, it will get raised to the font height. + line_height = 0 + + # Possible values are: + # full: Allow a small subset of html markup in notifications: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # + # strip: This setting is provided for compatibility with some broken + # clients that send markup even though it's not enabled on the + # server. Dunst will try to strip the markup but the parsing is + # simplistic so using this option outside of matching rules for + # specific applications *IS GREATLY DISCOURAGED*. + # + # no: Disable markup parsing, incoming notifications will be treated as + # plain text. Dunst will not advertise that it has the body-markup + # capability if this is set as a global setting. + # + # It's important to note that markup inside the format option will be parsed + # regardless of what this is set to. + markup = full + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + # Markup is allowed + format = "%s\n%b" + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # Vertical alignment of message text and icon. + # Possible values are "top", "center" and "bottom". + vertical_alignment = center + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = yes + + # When word_wrap is set to no, specify where to make an ellipsis in long lines. + # Possible values are "start", "middle" and "end". + ellipsize = middle + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Stack together notifications with the same content + stack_duplicates = true + + # Hide the count of stacked notifications with the same content + hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + ### Icons ### + + # Align icons left/right/off + icon_position = left + + # Scale small icons up to this size, set to 0 to disable. Helpful + # for e.g. small files or high-dpi screens. In case of conflict, + # max_icon_size takes precedence over this. + min_icon_size = 0 + + # Scale larger icons down to this size, set to 0 to disable + max_icon_size = 32 + + # Paths to default icons. + icon_path = /usr/share/icons/Adwaita/24x24/status/:/usr/share/icons/Adwaita/24x24/legacy/:/usr/share/icons/Adwaita/24x24/devices/ + + ### History ### + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + ### Misc/Advanced ### + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + #browser = /usr/bin/firefox -new-tab + browser = /usr/bin/chromium + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = true + + # Define the title of the windows spawned by dunst + title = Dunst + + # Define the class of the windows spawned by dunst + class = Dunst + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = false + + # Manage dunst's desire for talking + # Can be one of the following values: + # crit: Critical features. Dunst aborts + # warn: Only non-fatal warnings + # mesg: Important Messages + # info: all unimportant stuff + # debug: all less than unimportant stuff + verbosity = mesg + + # Define the corner radius of the notification window + # in pixel size. If the radius is 0, you have no rounded + # corners. + # The radius will be automatically lowered if it exceeds half of the + # notification height to avoid clipping text and/or icons. + corner_radius = 0 + + # Ignore the dbus closeNotification message. + # Useful to enforce the timeout set by dunst configuration. Without this + # parameter, an application may close the notification sent before the + # user defined timeout. + ignore_dbusclose = false + + ### Legacy + + # Use the Xinerama extension instead of RandR for multi-monitor support. + # This setting is provided for compatibility with older nVidia drivers that + # do not support RandR and using it on systems that support RandR is highly + # discouraged. + # + # By enabling this setting dunst will not be able to detect when a monitor + # is connected or disconnected which might break follow mode if the screen + # layout changes. + force_xinerama = false + + ### mouse + + # Defines list of actions for each mouse event + # Possible values are: + # * none: Don't do anything. + # * do_action: If the notification has exactly one action, or one is marked as default, + # invoke it. If there are multiple and no default, open the context menu. + # * close_current: Close current notification. + # * close_all: Close all notifications. + # These values can be strung together for each mouse event, and + # will be executed in sequence. + mouse_left_click = close_current + mouse_middle_click = do_action, close_current + mouse_right_click = close_all + +# Experimental features that may or may not work correctly. Do not expect them +# to have a consistent behaviour across releases. +[experimental] + # Calculate the dpi to use on a per-monitor basis. + # If this setting is enabled the Xft.dpi value will be ignored and instead + # dunst will attempt to calculate an appropriate dpi value for each monitor + # using the resolution and physical size. This might be useful in setups + # where there are multiple screens with very different dpi values. + per_monitor_dpi = false + +[shortcuts] + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. + close = ctrl+space + + # Close all notifications. + close_all = ctrl+shift+space + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". Make sure this key actually exists on your keyboard layout, + # e.g. check output of 'xmodmap -pke' + #history = ctrl+grave + history = ctrl+exclam + + # Context menu. + #context = ctrl+colon + context = ctrl+shift+exclam + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + background = "#222222" + foreground = "#888888" + timeout = 10 + # Icon for notifications with low urgency, uncomment to enable + #icon = /path/to/icon + +[urgency_normal] + background = "#285577" + foreground = "#ffffff" + timeout = 10 + # Icon for notifications with normal urgency, uncomment to enable + #icon = /path/to/icon + +[urgency_critical] + background = "#900000" + foreground = "#ffffff" + frame_color = "#ff0000" + timeout = 0 + # Icon for notifications with critical urgency, uncomment to enable + #icon = /path/to/icon + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# +# Messages can be matched by +# appname (discouraged, see desktop_entry) +# body +# category +# desktop_entry +# icon +# match_transient +# msg_urgency +# stack_tag +# summary +# +# and you can override the +# background +# foreground +# format +# frame_color +# fullscreen +# new_icon +# set_stack_tag +# set_transient +# timeout +# urgency +# +# Shell-like globbing will get expanded. +# +# Instead of the appname filter, it's recommended to use the desktop_entry filter. +# GLib based applications export their desktop-entry name. In comparison to the appname, +# the desktop-entry won't get localized. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +# Disable the transient hint so that idle_threshold cannot be bypassed from the +# client +#[transient_disable] +# match_transient = yes +# set_transient = no +# +# Make the handling of transient notifications more strict by making them not +# be placed in history. +#[transient_history_ignore] +# match_transient = yes +# history_ignore = yes + +# fullscreen values +# show: show the notifications, regardless if there is a fullscreen window opened +# delay: displays the new notification, if there is no fullscreen window active +# If the notification is already drawn, it won't get undrawn. +# pushback: same as delay, but when switching into fullscreen, the notification will get +# withdrawn from screen again and will get delayed like a new notification +#[fullscreen_delay_everything] +# fullscreen = delay +#[fullscreen_show_critical] +# msg_urgency = critical +# fullscreen = show + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[history-ignore] +# # This notification will not be saved in history +# summary = "foobar" +# history_ignore = yes + +#[skip-display] +# # This notification will not be displayed, but will be included in the history +# summary = "foobar" +# skip_display = yes + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +#[stack-volumes] +# appname = "some_volume_notifiers" +# set_stack_tag = "volume" +# +# vim: ft=cfg diff --git a/.config/i3/config b/.config/i3/config index d22c3be..1b10cb1 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -35,6 +35,9 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 000000 --nofork #exec --no-startup-id nm-applet #exec --no-startup-id sudo wpa_gui -t -i wlo1 +# Notification daemon (see ~/.config/dunst/dunstrc for configuration) +exec --no-startup-id dunst + # pulse audio systray icon exec --no-startup-id pasystray -- cgit v1.2.3 From 5487201d526a5ceb42aa051a3c44afffe932d352 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 8 Oct 2020 13:35:59 +0200 Subject: update --- .bashrc | 2 +- .config/dunst/dunstrc | 7 +++---- .config/i3/config | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.bashrc b/.bashrc index 821e08b..861b390 100644 --- a/.bashrc +++ b/.bashrc @@ -73,7 +73,7 @@ alias ifre='echo "ip link set wlo1 down; ip link set wlo1 up"|sudo sh' alias by='go build ./cmd/yaegi' alias cy='cd ~/go/src/github.com/traefik/yaegi' #alias ty='go test -v -short ./interp' -alias ya='rlwrap -pblue ./yaegi' +alias ya='rlwrap -pblue yaegi' alias dya='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi' alias wai='~/go/src/github.co/traefik/whoami/whoami' diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index d5a7f1b..c670303 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -86,7 +86,7 @@ ### Text ### - font = Monospace 8 + font = Monospace 9 # The spacing between lines. If the height is smaller than the # font height, it will get raised to the font height. @@ -286,11 +286,10 @@ # of "1". Make sure this key actually exists on your keyboard layout, # e.g. check output of 'xmodmap -pke' #history = ctrl+grave - history = ctrl+exclam + history = ctrl+twosuperior # Context menu. - #context = ctrl+colon - context = ctrl+shift+exclam + context = ctrl+colon [urgency_low] # IMPORTANT: colors have to be defined in quotation marks. diff --git a/.config/i3/config b/.config/i3/config index 1b10cb1..441753d 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -37,6 +37,10 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 000000 --nofork # Notification daemon (see ~/.config/dunst/dunstrc for configuration) exec --no-startup-id dunst +bindsym $mod+a exec --no-startup-id dunstctl action +bindsym $mod+n exec --no-startup-id dunstctl close +bindsym $mod+twosuperior exec --no-startup-id dunstctl history-pop + # pulse audio systray icon exec --no-startup-id pasystray -- cgit v1.2.3 From afbf517309c9809516645e3b35cdc2be7852b884 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 14 Oct 2020 15:37:42 +0200 Subject: update --- .bash-powerline.sh | 31 ++++++++++++++++--------------- .config/dunst/dunstrc | 3 ++- .config/i3/config | 1 + 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.bash-powerline.sh b/.bash-powerline.sh index 556391f..d939f57 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -9,12 +9,12 @@ __powerline() { readonly COLOR_CWD='\[\033[0;34m\]' # blue readonly COLOR_GIT='\[\033[0;36m\]' # cyan #readonly COLOR_SUCCESS='\[\033[0;32m\]' # green - readonly COLOR_SUCCESS='\[\033[0;34m\]' # blue - readonly COLOR_FAILURE='\[\033[0;31m\]' # red + readonly COLOR_SUCCESS='\[\033[0;1;34m\]' # blue, bold + readonly COLOR_FAILURE='\[\033[0;1;31m\]' # red, bold #readonly SYMBOL_GIT_BRANCH='⑂' readonly SYMBOL_GIT_BRANCH='→' - readonly SYMBOL_GIT_MODIFIED='*' + readonly SYMBOL_GIT_MODIFIED='¤' readonly SYMBOL_GIT_PUSH='↑' readonly SYMBOL_GIT_PULL='↓' @@ -26,14 +26,15 @@ __powerline() { host=$(hostname) fi - if [[ -z "$PS_SYMBOL" ]]; then - case "$(uname)" in - # Darwin) PS_SYMBOL='';; - Darwin) PS_SYMBOL='$';; - Linux) PS_SYMBOL='$';; - *) PS_SYMBOL='%';; - esac - fi + [ "$PS_SYMBOL" ] || PS_SYMBOL=';' + #if [[ -z "$PS_SYMBOL" ]]; then + # case "$(uname)" in + # # Darwin) PS_SYMBOL='';; + # Darwin) PS_SYMBOL='$';; + # Linux) PS_SYMBOL='$';; + # *) PS_SYMBOL='%';; + # esac + #fi __git_info() { [[ $POWERLINE_GIT = 0 ]] && return # disabled @@ -74,9 +75,9 @@ __powerline() { # Check the exit code of the previous command and display different # colors in the prompt accordingly. if [ $? -eq 0 ]; then - local symbol="$COLOR_SUCCESS $PS_SYMBOL $RESET" + local symbol="$COLOR_SUCCESS$PS_SYMBOL $RESET" else - local symbol="$COLOR_FAILURE $PS_SYMBOL $RESET" + local symbol="$COLOR_FAILURE$PS_SYMBOL $RESET" fi local cwd="$COLOR_CWD\w$RESET" @@ -93,9 +94,9 @@ __powerline() { local git="$COLOR_GIT$(__git_info)$RESET" fi - PS1="$cwd$git$symbol" + PS1=": $cwd$git$symbol" if [ "$SSH_TTY" ]; then - PS1="$host:$PS1" + PS1=": $host:$PS1" fi } diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index c670303..245a60c 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -256,7 +256,8 @@ # will be executed in sequence. mouse_left_click = close_current mouse_middle_click = do_action, close_current - mouse_right_click = close_all + mouse_right_click = do_action, close_current + #mouse_right_click = close_all # Experimental features that may or may not work correctly. Do not expect them # to have a consistent behaviour across releases. diff --git a/.config/i3/config b/.config/i3/config index 441753d..22a61af 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -38,6 +38,7 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 000000 --nofork # Notification daemon (see ~/.config/dunst/dunstrc for configuration) exec --no-startup-id dunst bindsym $mod+a exec --no-startup-id dunstctl action +bindsym $mod+c exec --no-startup-id dunstctl context bindsym $mod+n exec --no-startup-id dunstctl close bindsym $mod+twosuperior exec --no-startup-id dunstctl history-pop -- cgit v1.2.3 From 57857f9382ccc0f2ce9bdff05bbbcce63da9f423 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 14 Oct 2020 15:46:55 +0200 Subject: update --- .bash-powerline.sh | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.bash-powerline.sh b/.bash-powerline.sh index d939f57..ccb7a5d 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -27,14 +27,6 @@ __powerline() { fi [ "$PS_SYMBOL" ] || PS_SYMBOL=';' - #if [[ -z "$PS_SYMBOL" ]]; then - # case "$(uname)" in - # # Darwin) PS_SYMBOL='';; - # Darwin) PS_SYMBOL='$';; - # Linux) PS_SYMBOL='$';; - # *) PS_SYMBOL='%';; - # esac - #fi __git_info() { [[ $POWERLINE_GIT = 0 ]] && return # disabled @@ -94,10 +86,7 @@ __powerline() { local git="$COLOR_GIT$(__git_info)$RESET" fi - PS1=": $cwd$git$symbol" - if [ "$SSH_TTY" ]; then - PS1=": $host:$PS1" - fi + [ "$SSH_TTY" ] && PS1=": $host:$cwd$git$symbol" || PS1=": $cwd$git$symbol" } PROMPT_DIRTRIM=2 -- cgit v1.2.3 From a896548d0a3c8adc98a9c76c09b3433724e196ab Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 15 Oct 2020 22:23:27 +0200 Subject: add sixel tools --- .bashrc | 4 + bin/icat | 2 + bin/idot | 2 + bin/lsix | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 347 insertions(+) create mode 100755 bin/icat create mode 100755 bin/idot create mode 100755 bin/lsix diff --git a/.bashrc b/.bashrc index 861b390..229f627 100644 --- a/.bashrc +++ b/.bashrc @@ -35,6 +35,10 @@ fixab() { printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 "$1"; } # bat export BAT_THEME='github' +# gnuplot display in terminal +export GNUTERM='sixelgd enhanced truecolor font "arial,9"' +#export GNUTERM='sixelgd enhanced truecolor small' + # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' diff --git a/bin/icat b/bin/icat new file mode 100755 index 0000000..b15a6d4 --- /dev/null +++ b/bin/icat @@ -0,0 +1,2 @@ +#!/bin/sh +exec convert -resize '800x480>' -flatten -- ${1:--} sixel:- diff --git a/bin/idot b/bin/idot new file mode 100755 index 0000000..d36d947 --- /dev/null +++ b/bin/idot @@ -0,0 +1,2 @@ +#!/bin/sh +dot -Tpng -Gsize=8 "${1:-}" | convert -- - sixel:- diff --git a/bin/lsix b/bin/lsix new file mode 100755 index 0000000..0f96b36 --- /dev/null +++ b/bin/lsix @@ -0,0 +1,339 @@ +#!/usr/bin/env bash + +# lsix: like ls, but for images. +# Shows thumbnails of images with titles directly in terminal. + +# Requirements: just ImageMagick (and a Sixel terminal, of course) + +# Version 1.6.2 +# B9 December 2018 + +# See end of file for USAGE. + + +# The following defaults may be overridden if autodetection succeeds. +numcolors=16 # Default number of colors in the palette. +background=white # Default montage background. +foreground=black # Default text color. +width=800 # Default width of screen in pixels. + +# Feel free to edit these defaults to your liking. +tilesize=120 # Width and height of each tile in the montage. +tilewidth=$tilesize # (or specify separately, if you prefer) +tileheight=$tilesize + +# If you get questionmarks for Unicode filenames, try using a different font. +# You can list fonts available using `convert -list font`. +#fontfamily=Droid-Sans-Fallback # Great Asian font coverage +#fontfamily=Dejavu-Sans # Wide coverage, comes with GNU/Linux +#fontfamily=Mincho # Wide coverage, comes with MS Windows + +# Default font size is based on width of each tile in montage. +#fontfamily=Monaco +fontfamily=MiscFixedSC613 +fontsize=$((tilewidth/10)) +fontsize=12 # (or set the point size directly, if you prefer) + +timeout=0.25 # How long to wait for terminal to respond + # to a control sequence (in seconds). + +# Sanity checks and compatibility +if [[ ${BASH_VERSINFO[0]} -eq 3 ]]; then + if bash --version | head -1 | grep -q "version 3"; then + cat <<-EOF >&2 + Error: The version of Bash is extremely out of date. + (2007, the same year Steve Jobs announced the iPhone!) + + This is almost always due to Apple's MacOS being silly. + Please let Apple know that their users expect current UNIX tools. + + In the meantime, try using "brew install bash". + EOF + exit 1 + else + exec bash "$0" "$@" || echo "Exec failed" >&2 + exit 1 + fi +fi + +if ! command -v montage >/dev/null; then + echo "Please install ImageMagick" >&2 + exit 1 +fi + +if command -v gsed >/dev/null; then + alias sed=gsed # Use GNU sed for MacOS & BSD +fi + +cleanup() { + echo -n $'\e\\' # Escape sequence to stop SIXEL. + stty echo # Reset terminal to show characters. + exit 0 +} +trap cleanup SIGINT SIGHUP SIGABRT EXIT + +autodetect() { + # Various terminal automatic configuration routines. + + # Don't show escape sequences the terminal doesn't understand. + stty -echo # Hush-a Mandara Ni Pari + + # IS TERMINAL SIXEL CAPABLE? # Send Device Attributes + IFS=";" read -a REPLY -s -t 1 -d "c" -p $'\e[c' >&2 + for code in "${REPLY[@]}"; do + if [[ $code == "4" ]]; then + hassixel=yup + break + fi + done + + # YAFT is vt102 compatible, cannot respond to vt220 escape sequence. + if [[ "$TERM" == yaft* ]]; then hassixel=yeah; fi + + if [[ -z "$hassixel" ]]; then + cat <<-EOF >&2 + Error: Your terminal does not report having sixel graphics support. + + Please use a sixel capable terminal, such as xterm -ti vt340, or + ask your terminal manufacturer to add sixel support. + + You may test your terminal by viewing a single image, like so: + + convert foo.jpg -geometry 800x480 sixel:- + + If your terminal actually does support sixel, please file a bug + report at http://github.com/hackerb9/lsix/issues + EOF + read -s -t 1 -d "c" -p $'\e[c' >&2 + if [[ "$REPLY" ]]; then + echo + cat -v <<< "(Please mention device attribute codes: ${REPLY}c)" + fi + + exit 1 + fi + + # ENABLE SIXEL SCROLLING so image will appear right after cursor. + if [[ $TERM != "mlterm" ]]; then + echo -ne $'\e[?80h' + else + # Except... mlterm (as of 3.5.0) has a bug that reverses the sense + echo -ne $'\e[?80l' + fi + + # TERMINAL COLOR AUTODETECTION. + # Find out how many color registers the terminal has + IFS=";" read -a REPLY -s -t ${timeout} -d "S" -p $'\e[?1;1;0S' >&2 + [[ ${REPLY[1]} == "0" ]] && numcolors=${REPLY[2]} + + # Bug workaround: mlterm does not report number of colors. + if [[ $TERM =~ mlterm ]]; then numcolors=1024; fi + # YAFT is vt102 compatible, cannot respond to vt220 escape sequence. + if [[ "$TERM" == yaft* ]]; then numcolors=256; fi + + # Increase colors, if needed + if [[ $numcolors -lt 256 ]]; then + # Attempt to set the number of colors to 256. + # This will work for xterm, but fail on a real vt340. + IFS=";" read -a REPLY -s -t ${timeout} -d "S" -p $'\e[?1;3;256S' >&2 + [[ ${REPLY[1]} == "0" ]] && numcolors=${REPLY[2]} + fi + + # Query the terminal background and foreground colors. + IFS=";:/" read -a REPLY -r -s -t ${timeout} -d "\\" -p $'\e]11;?\e\\' >&2 + if [[ ${REPLY[1]} =~ ^rgb ]]; then + # Return value format: $'\e]11;rgb:ffff/0000/ffff\e\\'. + # ImageMagick wants colors formatted as #ffff0000ffff. + background='#'${REPLY[2]}${REPLY[3]}${REPLY[4]%%$'\e'*} + IFS=";:/" read -a REPLY -r -s -t ${timeout} -d "\\" -p $'\e]10;?\e\\' >&2 + if [[ ${REPLY[1]} =~ ^rgb ]]; then + foreground='#'${REPLY[2]}${REPLY[3]}${REPLY[4]%%$'\e'*} + # Check for "Reverse Video" (DECSCNM screen mode). + IFS=";?$" read -a REPLY -s -t ${timeout} -d "y" -p $'\e[?5$p' + if [[ ${REPLY[2]} == 1 || ${REPLY[2]} == 3 ]]; then + temp=$foreground + foreground=$background + background=$temp + fi + fi + fi + # YAFT is vt102 compatible, cannot respond to vt220 escape sequence. + if [[ "$TERM" == yaft* ]]; then background=black; foreground=white; fi + + # Send control sequence to query the sixel graphics geometry to + # find out how large of a sixel image can be shown. + IFS=";" read -a REPLY -s -t ${timeout} -d "S" -p $'\e[?2;1;0S' >&2 + if [[ ${REPLY[2]} -gt 0 ]]; then + width=${REPLY[2]} + else + # Nope. Fall back to dtterm WindowOps to approximate sixel geometry. + IFS=";" read -a REPLY -s -t ${timeout} -d "t" -p $'\e[14t' >&2 + if [[ $? == 0 && ${REPLY[2]} -gt 0 ]]; then + width=${REPLY[2]} + fi + fi + + # BUG WORKAROUND: XTerm cannot show images wider than 1000px. + # Remove this hack once XTerm gets fixed. Last checked: XTerm(327) + if [[ $TERM =~ xterm && $width -ge 1000 ]]; then width=1000; fi + + # Space on either side of each tile is less than 0.5% of total screen width + tilexspace=$((width/201)) + tileyspace=$((tilexspace/2)) + # Figure out how many tiles we can fit per row. ("+ 1" is for -shadow). + numtiles=$((width/(tilewidth + 2*tilexspace + 1))) +} + +main() { + # Discover and setup the terminal + autodetect + + if [[ $# == 0 ]]; then + # No command line args? Use a sorted list of image files in CWD. + shopt -s nullglob nocaseglob nocasematch + set - *{jpg,jpeg,png,gif,tiff,tif,p?m,x[pb]m,bmp,ico,svg,eps} + [[ $# != 0 ]] || exit + readarray -t < <(printf "%s\n" "$@" | sort) + + # Only show first frame of animated GIFs if filename not specified. + for x in ${!MAPFILE[@]}; do + if [[ ${MAPFILE[$x]} =~ gif$ ]]; then + MAPFILE[$x]=":${MAPFILE[$x]}[0]" + fi + done + set - "${MAPFILE[@]}" + fi + + # Resize on load: Save memory by appending this suffix to every filename. + resize="[${tilewidth}x${tileheight}]" + + + imoptions="-tile ${numtiles}x1" # Each montage is 1 row x $numtiles columns + imoptions+=" -geometry ${tilewidth}x${tileheight}>+${tilexspace}+${tileyspace}" # Size of each tile and spacing + imoptions+=" -background $background -fill $foreground" # Use terminal's colors + imoptions+=" -auto-orient " # Properly rotate JPEGs from cameras + #if [[ $numcolors -gt 16 ]]; then + # imoptions+=" -shadow " # Just for fun :-) + #fi + + # See top of this file to change fontfamily and fontsize. + [[ "$fontfamily" ]] && imoptions+=" -font $fontfamily " + [[ "$fontsize" ]] && imoptions+=" -pointsize $fontsize " + + # Create and display montages one row at a time. + while [ $# -gt 0 ]; do + # While we still have images to process... + onerow=() + goal=$(($# - numtiles)) # How many tiles left after this row + while [ $# -gt 0 -a $# -gt $goal ]; do + len=${#onerow[@]} + onerow[len++]="-label" + onerow[len++]=$(processlabel "$1") + onerow[len++]="$1" + shift + done + montage "${onerow[@]}" $imoptions gif:- \ + | convert - -colors $numcolors sixel:- + done +} + +processlabel() { + # This routine is all about appeasing ImageMagick. + # 1. Remove silly [0] suffix and : prefix. + # 2. Quote percent backslash, and at sign. + # 3. Replace control characters with question marks. + # 4. If a filename is too long, remove extension (.jpg). + # 5. Split long filenames with newlines (recursively) + span=15 # filenames longer than span will be split + echo -n "$1" | + sed 's|^:||; s|\[0]$||;' | tr '[:cntrl:]' '?' | + awk -v span=$span -v ORS="" ' + function halve(s, l,h) { # l and h are locals + l=length(s); h=int(l/2); + if (l <= span) { return s; } + return halve(substr(s, 1, h)) "\n" halve(substr(s, h+1)); + } + { + if ( length($0) > span ) gsub(/\..?.?.?.?$/, ""); + print halve($0); + } + ' | + sed 's|%|%%|g; s|\\|\\\\|g; s|@|\\@|g;' +} + +#### + +main "$@" + +# Send an escape sequence and wait for a response from the terminal +# so that the program won't quit until images have finished transferring. +read -s -t 60 -d "c" -p $'\e[c' >&2 + + +###################################################################### +# NOTES: + +# Usage: lsix [ FILES ... ] + +# * FILES can be any image file that ImageMagick can handle. +# +# * If no FILES are specified the most common file extensions are tried. +# (For now, lsix only searches the current working directory.) +# +# * Non-bitmap graphics often work fine (.svg, .eps, .pdf, .xcf). +# +# * Files containing multiple images (e.g., animated GIFs) will show +# all the images if the filename is specified at the command line. +# Only the first frame will be shown if "lsix" is called with no +# arguments. +# +# * Because this uses escape sequences, it works seamlessly through ssh. +# +# * If your terminal supports reporting the background and foreground +# color, lsix will use those for the montage background and text fill. +# +# * If your terminal supports changing the number of color registers +# to improve the picture quality, lsix will do so. + +# * Only software needed is ImageMagick (e.g., apt-get install imagemagick). + +# Your terminal must support SIXEL graphics. E.g., +# +# xterm -ti vt340 + +# * To make vt340 be the default xterm type, set this in .Xresources: +# +# ! Allow sixel graphics. (Try: "convert -colors 16 foo.jpg sixel:-"). +# xterm*decTerminalID : vt340 + +# * Xterm does not support reporting the screen size in pixels unless +# you add this to your .Xresources: +# +# ! Allow xterm to read the terminal window size (op #14) +# xterm*allowWindowOps : False +# xterm*disallowedWindowOps : 1,2,3,4,5,6,7,8,9,11,13,18,19,20,21,GetSelection,SetSelection,SetWinLines,SetXprop + +# * Be cautious using lsix on videos (lsix *.avi) as ImageMagick will +# try to make a montage of every single frame and likely exhaust +# your memory and/or your patience. + +# BUGS + +# * Directories are not handled nicely. +# * ImageMagick's Montage doesn't handle long filenames nicely. +# * Some transparent images (many .eps files) presume a white background +# and will not show up if your terminal's background is black. +# * This file is getting awfully long for a one line kludge. :-) + +# LICENSE INFORMATION +# (AKA, You know your kludge has gotten out of hand when...) + +# Dual license: +# * You have all the freedoms permitted to you under the +# GNU GPL >=3. (See the included LICENSE file). + +# * Additionally, this program can be used under the terms of whatever +# license 'xterm' is using (now or in the future). This is primarily +# so that, if the xterm maintainer (currently Thomas E. Dickey) so +# wishes, this program may be included with xterm as a Sixel test. +# However, anyone who wishes to take advantage of this is free to do so. -- cgit v1.2.3 From aa1f45e33a957098615eca24d0b1b26c03b0eb57 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 18 Oct 2020 12:35:30 +0200 Subject: update --- .curlrc | 1 + bin/apac | 9 +++++++++ bin/vpac | 14 ++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 .curlrc create mode 100755 bin/apac create mode 100755 bin/vpac diff --git a/.curlrc b/.curlrc new file mode 100644 index 0000000..3e9b944 --- /dev/null +++ b/.curlrc @@ -0,0 +1 @@ +-L diff --git a/bin/apac b/bin/apac new file mode 100755 index 0000000..ed51734 --- /dev/null +++ b/bin/apac @@ -0,0 +1,9 @@ +#!/bin/sh +# pacman + fzf +#pacman -Slq | fzf --no-clear --multi --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S +yay -Slqa | +fzf --no-clear --multi \ + --bind=left:preview-page-up --bind=right:preview-page-down \ + --preview-window=right:66% \ + --preview 'yay -Qil {1} 2>/dev/null && echo && pactree {1} || yay -Si {1}' | +xargs yay -S diff --git a/bin/vpac b/bin/vpac new file mode 100755 index 0000000..3b8c25c --- /dev/null +++ b/bin/vpac @@ -0,0 +1,14 @@ +#!/bin/sh +# pacman + fzf +#pacman -Slq | fzf --no-clear --multi --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S + +# interactive select of package to remove +remove() { + pacman -Qqe | + fzf --no-clear --multi --bind=left:preview-page-up --bind=right:preview-page-down \ + --preview-window=right:66% \ + --preview 'cat <(yay -Si {1}) <(pacman -Fl {1} 2>/dev/null | awk "!/\/$/ {print $2}")' | + xargs -ro yay -Rns +} + +remove -- cgit v1.2.3 From 3bb7e9d0b1d7bc406bd2361f7484d4484eb483b1 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 1 Nov 2020 09:32:20 +0100 Subject: update --- .bash-powerline.sh | 2 +- .bashrc | 9 +++------ .config/i3/config | 3 +++ .vimrc | 5 ++++- bin/fpac | 8 +++++++- bin/hdmi | 3 ++- bin/icat | 30 ++++++++++++++++++++++++++++-- bin/idot | 4 +++- 8 files changed, 51 insertions(+), 13 deletions(-) diff --git a/.bash-powerline.sh b/.bash-powerline.sh index ccb7a5d..626157a 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -89,7 +89,7 @@ __powerline() { [ "$SSH_TTY" ] && PS1=": $host:$cwd$git$symbol" || PS1=": $cwd$git$symbol" } - PROMPT_DIRTRIM=2 + PROMPT_DIRTRIM=1 PROMPT_COMMAND="ps1${PROMPT_COMMAND:+; $PROMPT_COMMAND}" } diff --git a/.bashrc b/.bashrc index 229f627..a78d064 100644 --- a/.bashrc +++ b/.bashrc @@ -32,12 +32,8 @@ fixab() { printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 "$1"; } #export LESS_TERMCAP_us=$(tput setaf 5) # underline (magenta) #export LESS_TERMCAP_ue=$'\E[0m' # end underline -# bat -export BAT_THEME='github' - # gnuplot display in terminal export GNUTERM='sixelgd enhanced truecolor font "arial,9"' -#export GNUTERM='sixelgd enhanced truecolor small' # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' @@ -60,8 +56,8 @@ alias go14='go1.14.2' alias gob='go build' alias goh='p go help' alias god='p go doc' -alias gtr='go test -run' -alias gtb='go test -cpuprofile cpu.out -memprofile mem.out -benchmem -bench' +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' @@ -110,3 +106,4 @@ unset base # Display git status in prompt . ~/.bash-powerline.sh +# export PS1='; ' diff --git a/.config/i3/config b/.config/i3/config index 22a61af..9ef0672 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -122,6 +122,9 @@ bindsym $mod+End exec --no-startup-id playerctl stop bindsym $mod+Next exec --no-startup-id playerctl next bindsym $mod+Prior exec --no-startup-id playerctl previous +# Screen shot +bindSym --release Print exec --no-startup-id shot + # jump to urgent bindsym $mod+x [urgent=latest] focus diff --git a/.vimrc b/.vimrc index 79cd484..58841c0 100644 --- a/.vimrc +++ b/.vimrc @@ -1,7 +1,7 @@ " set background= set t_te= t_ti= laststatus=2 -syntax on +syntax off filetype on filetype plugin on filetype plugin indent on @@ -9,7 +9,9 @@ let mapleader = "," " vimki plugin let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" +autocmd filetype vimki syntax on autocmd filetype vimki set autowrite +autocmd filetype vimki setlocal spell spelllang=fr " vim-go plugin let g:go_def_mode = "gopls" @@ -17,6 +19,7 @@ let g:go_info_mode = "gopls" let g:go_list_type = "quickfix" let g:go_fmt_command = "goimports" let g:go_metalinter_command = "golangci-lint" +autocmd FileType go syntax on autocmd FileType go nmap b (go-build) autocmd FileType go nmap i (go-info) autocmd FileType go nmap r (go-run) diff --git a/bin/fpac b/bin/fpac index db30d36..6207191 100755 --- a/bin/fpac +++ b/bin/fpac @@ -1,3 +1,9 @@ #!/bin/sh # pacman + fzf -pacman -Slq | fzf --no-clear --multi --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S +#pacman -Slq | fzf --no-clear --multi --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S +pacman -Slq | +fzf --no-clear --multi \ + --bind=left:preview-page-up --bind=right:preview-page-down \ + --preview-window=right:66% \ + --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} 2>/dev/null | awk "! /\/$/ {print \$2}")' | +xargs -ro sudo pacman -S diff --git a/bin/hdmi b/bin/hdmi index 75e6f37..0b04531 100755 --- a/bin/hdmi +++ b/bin/hdmi @@ -1,7 +1,8 @@ #!/bin/sh # Toggle auxiliary HDMI screen on/off when connected/disconnected. -opt="--auto --right-of eDP-1" +opt="--auto --left-of eDP-1" +#opt="--auto --right-of eDP-1" #opt="--auto --above eDP-1" # Also add the following rule to /etc/udev/rules.d/hdmi.rules diff --git a/bin/icat b/bin/icat index b15a6d4..702d648 100755 --- a/bin/icat +++ b/bin/icat @@ -1,2 +1,28 @@ -#!/bin/sh -exec convert -resize '800x480>' -flatten -- ${1:--} sixel:- +#!/bin/sh -e +# Display images directly in terminal. +# Tested with xterm v361 + +# 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. +maxsize() { + [ "$WINDOWID" ] || { echo "640x480>"; return; } + xwininfo -id "$WINDOWID" | { + w=1000 h=1000 + while read -r a b; do + case $a in + (Width:) [ $((b < w)) = 1 ] && w=$b ;; + (Height:) [ $((b < h)) = 1 ] && h=$b ;; + esac + done + echo "${w}x$h" + } +} + +# 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:--} diff --git a/bin/idot b/bin/idot index d36d947..44387e8 100755 --- a/bin/idot +++ b/bin/idot @@ -1,2 +1,4 @@ #!/bin/sh -dot -Tpng -Gsize=8 "${1:-}" | convert -- - sixel:- +# dot -Gsize=9 -Nshape=box -Nstyle=rounded -Tsvg | convert -- - sixel:/dev/tty +# dot -Gsize=9 -Nfontname=Helvetica -Tsvg | convert -- - sixel:/-dev/tty +dot -Gsize=9 -Nfontname=Arial -Tpng | icat - /dev/tty -- cgit v1.2.3 From b44d13927d1296c6d4eecbf42448372948e74ad8 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 4 Jan 2021 09:16:43 +0100 Subject: update --- .bashrc | 9 +++++++++ .config/i3/config | 1 + .i3status.conf | 3 ++- .profile | 6 +++--- .tmux.conf | 3 +++ .vim/spell/fr.utf-8.add | 1 + .vimrc | 1 + .xinitrc | 1 + .xsession | 24 ++++++++++++++++++++++++ bin/hdmi | 9 ++++++--- bin/vr | 2 ++ 11 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 .tmux.conf create mode 100644 .vim/spell/fr.utf-8.add create mode 100755 .xsession create mode 100755 bin/vr diff --git a/.bashrc b/.bashrc index a78d064..2f6a357 100644 --- a/.bashrc +++ b/.bashrc @@ -80,6 +80,15 @@ alias wai='~/go/src/github.co/traefik/whoami/whoami' # yaegi debug export YAEGI_DOT_CMD='dotty -' +mosht() { mosh "$@" -- tmux new -A; } +export -f mosht + +ssht() { ssh -t "$@" -- tmux new -A; } +export -f ssht + +mpvx() { mpv --vo=sixel --profile=sw-fast --really-quiet "$@"; } +export -f mpvx + tfk() { ~/go/src/github.com/traefik/traefik/traefik "$@"; } export -f tfk diff --git a/.config/i3/config b/.config/i3/config index 9ef0672..48c461c 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -65,6 +65,7 @@ for_window [title="Gestionnaire de tâches – Chromium"] floating enable for_window [instance="DOTTY"] floating enable for_window [class="discord"] floating enable for_window [class="Display"] floating enable +for_window [class="Feedreader"] floating enable for_window [class="feh"] floating enable for_window [class="firefox"] floating enable for_window [class="Geeqie"] floating enable diff --git a/.i3status.conf b/.i3status.conf index b3af3a3..229dfc1 100644 --- a/.i3status.conf +++ b/.i3status.conf @@ -92,7 +92,8 @@ memory { cpu_temperature 0 { format = "🌡%degrees °C" - path = "/sys/class/hwmon/hwmon0/temp1_input" + #path = "/sys/class/hwmon/hwmon0/temp1_input" + path = "/sys/class/hwmon/hwmon6/temp1_input" } tztime local { diff --git a/.profile b/.profile index cb09e87..acb8299 100644 --- a/.profile +++ b/.profile @@ -5,6 +5,6 @@ PATH=~/bin:$PATH:~/go/bin [ "${SHELL##*/}" = bash ] && . ~/.bashrc # Last action: auto start X11 when logged on first console -case $HOSTNAME in -([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; -esac +#case $HOSTNAME in +#([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; +#esac diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..8d624a0 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,3 @@ +set-option -g prefix ² +unbind-key C-b +bind-key ² send-prefix diff --git a/.vim/spell/fr.utf-8.add b/.vim/spell/fr.utf-8.add new file mode 100644 index 0000000..8bd6403 --- /dev/null +++ b/.vim/spell/fr.utf-8.add @@ -0,0 +1 @@ +Flo diff --git a/.vimrc b/.vimrc index 58841c0..84c082d 100644 --- a/.vimrc +++ b/.vimrc @@ -12,6 +12,7 @@ let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" autocmd filetype vimki syntax on autocmd filetype vimki set autowrite autocmd filetype vimki setlocal spell spelllang=fr +autocmd filetype vimki nmap z :FZF ~/Wiki " vim-go plugin let g:go_def_mode = "gopls" diff --git a/.xinitrc b/.xinitrc index c0b8589..f982ca7 100644 --- a/.xinitrc +++ b/.xinitrc @@ -10,6 +10,7 @@ xinput --set-prop 'SYNA7DAB:00 06CB:CD40 Touchpad' 'libinput Natural Scrolling E # 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 diff --git a/.xsession b/.xsession new file mode 100755 index 0000000..f982ca7 --- /dev/null +++ b/.xsession @@ -0,0 +1,24 @@ +#!/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/hdmi b/bin/hdmi index 0b04531..d6f206a 100755 --- a/bin/hdmi +++ b/bin/hdmi @@ -1,12 +1,15 @@ #!/bin/sh # Toggle auxiliary HDMI screen on/off when connected/disconnected. -opt="--auto --left-of eDP-1" +opt="--auto --left-of eDP1" #opt="--auto --right-of eDP-1" #opt="--auto --above eDP-1" # Also add the following rule to /etc/udev/rules.d/hdmi.rules # KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" -xrandr | grep -q 'HDMI-1 connected' || opt="--off" -xrandr --output HDMI-1 $opt +# wait for the screen to settle +sleep 3 + +xrandr | grep -q 'HDMI1 connected' || opt="--off" +xrandr --output HDMI1 $opt diff --git a/bin/vr b/bin/vr new file mode 100755 index 0000000..189d83e --- /dev/null +++ b/bin/vr @@ -0,0 +1,2 @@ +#!/bin/sh +exec chromium --user-data-dir=/home/marc/vr --silent-debugger-extension-api -- cgit v1.2.3 From 5aaa36fd6bc42d127617e92bd1907816e82bfff0 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 22 Jan 2021 18:41:59 +0100 Subject: update --- .bashrc | 12 ++++ .i3status.conf | 1 + .vimrc | 5 ++ bin/icat | 38 +++++++++++- bin/rssg | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 242 insertions(+), 3 deletions(-) create mode 100755 bin/rssg diff --git a/.bashrc b/.bashrc index 2f6a357..90c903e 100644 --- a/.bashrc +++ b/.bashrc @@ -70,6 +70,12 @@ alias wpa='sudo wpa_gui -i wlan0' 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' #alias ty='go test -v -short ./interp' @@ -101,6 +107,12 @@ export -f ws wsd() (cd ~/Wiki && git add . && git diff --cached) export -f wsd +meteo() { + local request="wttr.in/${1-Toulouse}?F&T" + [ "$(tput cols)" -lt 125 ] && request+='&n' + curl -H "Accept-Language: ${LANG%_*}" --compressed "$request" +} + #PS1='[\u@\h \W]\$ ' # fzf 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/.vimrc b/.vimrc index 84c082d..f8fce87 100644 --- a/.vimrc +++ b/.vimrc @@ -7,6 +7,8 @@ filetype plugin on filetype plugin indent on let mapleader = "," +let g:fzf_preview = 'cat {}' + " vimki plugin let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" autocmd filetype vimki syntax on @@ -14,6 +16,9 @@ autocmd filetype vimki set autowrite autocmd filetype vimki setlocal spell spelllang=fr autocmd filetype vimki nmap z :FZF ~/Wiki +autocmd filetype vimki nnoremap = YpVr= +autocmd filetype vimki nnoremap - YpVr- + " vim-go plugin let g:go_def_mode = "gopls" let g:go_info_mode = "gopls" diff --git a/bin/icat b/bin/icat index 702d648..0170513 100755 --- a/bin/icat +++ b/bin/icat @@ -1,10 +1,10 @@ #!/bin/sh -e # Display images directly in terminal. -# Tested with xterm v361 +# Tested with xterm v361. Depends on imagemagick convert(1). # 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 +19,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/rssg b/bin/rssg new file mode 100755 index 0000000..52031e7 --- /dev/null +++ b/bin/rssg @@ -0,0 +1,189 @@ +#!/bin/sh +# +# https://www.romanzolotarev.com/bin/rssg +# Copyright 2018 Roman Zolotarev +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +set -e + + +main () { + test -n "$1" || usage + test -n "$2" || usage + test -f "$1" || no_file "$1" + + + index_file=$(readlink -f "$1") + test -z "${index_file##*html}" && html=$(cat "$index_file") + test -z "${index_file##*md}" && html=$(md_to_html "$index_file") + test -n "$html" || usage + + base="${index_file%/*}" + base_url="$(echo "$html" | get_url | sed 's#\(.*\)/[^/]*#\1#')" + + url=$( echo "$html" | get_url) + + title="$2" + + description=$( echo "$html" | get_description | + remove_tags | + remove_nbsp ) + + items=$( echo "$html" | get_items) + + rss=$( echo "$items" | + render_items "$base" "$base_url" | + render_feed "$url" "$title" "$description") + + >&2 echo "[rssg] ${index_file##$(pwd)/} $(echo "$rss" | grep -c '') items" + echo "$rss" +} + + +usage() { + echo "usage: ${0##*/} index.{html,md} title > rss.xml" >&2 + exit 1 +} + + +no_file() { + echo "${0##*/}: $1: No such file" >&2 + exit 2 +} + + +md_to_html() { + test -x "$(which lowdown)" || exit 3 + lowdown \ + -D html-skiphtml \ + -D smarty \ + -d metadata \ + -d autolink "$1" +} + + +get_title() { + awk 'tolower($0)~/^

]*>/,"",$0);print;exit}' +} + + +get_url() { + grep -i '\(.*\).*#\1 \2 \3#' +} + + +get_description() { + start='sub("^.*<"s"*"t"("s"[^>]*)?>","")' + stop='sub(".*","")&&x=1' + awk -v 's=[[:space:]]' -v 't=[Pp]' "$start,$stop;x{exit}" +} + +remove_tags() { + sed 's#<[^>]*>##g;s#]*>##g' +} + + +remove_nbsp() { + sed 's#\ # #g' +} + + +rel_to_abs_urls() { + site_url="$1" + base_url="$2" + + abs='s#(src|href)="/([^"]*)"#\1="'"$site_url"/'\2"#g' + rel='s#(src|href)="([^:/"]*)"#\1="'"$base_url"/'\2"#g' + sed -E "$abs;$rel" +} + + +date_rfc_822() { + date -j '+%a, %d %b %Y %H:%M:%S %z' \ + "$(echo "$1"| tr -cd '[:digit:]')0000" +} + + +render_items() { + while read -r i + do render_item "$1" "$2" "$i" + done +} + + +render_item() { + base="$1" + base_url="$2" + item="$3" + + site_url="$(echo "$base_url"| sed 's#\(.*//.*\)/.*#\1#')" + + date=$(echo "$item"|awk '{print$2}') + url=$(echo "$item"|awk '{print$1}') + + f="$base/$url" + test -f "$f" && html=$(cat "$f") + test -f "${f%\.html}.md" && html=$(md_to_html "${f%\.html}.md") + + description=$( + echo "$html" | + rel_to_abs_urls "$site_url" "$base_url" | + remove_nbsp + ) + title=$(echo "$description" | get_title) + guid="$base_url/$(echo "$url" | sed 's#^/##')" + + echo ' + +'"$guid"' +'"$guid"' +'"$(date_rfc_822 "$date")"' +'"$title"' + +' +} + + +render_feed() { + url="$1" + title=$(echo "$2" | remove_nbsp) + description="$3" + + base_url="$(echo "$url" | cut -d '/' -f1-3)" + + echo ' + + + +'"$title"' +'"$description"' +'"$base_url"'/ +'"$(date_rfc_822 date)"' +'"$(cat)"' +' +} + + +main "$@" -- cgit v1.2.3 From 9aa203f7d7a1899aac7bb7d8209cc2a394ffdbd8 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 7 Feb 2021 12:03:10 +0100 Subject: update --- .Xresources | 2 ++ .bashrc | 3 +++ bin/byo | 6 ++++-- bin/repairboot | 14 ++++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 bin/repairboot diff --git a/.Xresources b/.Xresources index a653af4..b1c3e3d 100644 --- a/.Xresources +++ b/.Xresources @@ -20,6 +20,8 @@ xterm*termName: xterm-256color xterm*VT100.Translations: #override \ Ctrl Next: smaller-vt-font() \n\ Ctrl Prior: larger-vt-font() \n +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 90c903e..c086d45 100644 --- a/.bashrc +++ b/.bashrc @@ -128,3 +128,6 @@ unset base # 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/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/repairboot b/bin/repairboot new file mode 100755 index 0000000..6cb9bb4 --- /dev/null +++ b/bin/repairboot @@ -0,0 +1,14 @@ +#!/bin/sh -ex + +# Repair boot from yoda (for acer swift5) + + +[ "$USER" = root ] || exec sudo "$0" "$@" + +cryptsetup open /dev/nvme0n1p2 swift +mount /dev/mapper/swift /mnt +mount /dev/nvme0n1p1 /mnt/boot + +arch-chroot /mnt << EOT +bootctl --path=/boot install +EOT -- cgit v1.2.3 From 3f71e5e47055550d187eb1b60d889f82bb1de28f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 14 Feb 2021 18:59:26 +0100 Subject: update --- .Xresources | 9 ++++--- .gitconfig | 2 ++ .vimrc | 2 +- .xinitrc | 24 ----------------- .xsession | 24 ----------------- .zsh-powerline.sh | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/open | 11 -------- 7 files changed, 88 insertions(+), 64 deletions(-) delete mode 100644 .xinitrc delete mode 100755 .xsession create mode 100644 .zsh-powerline.sh delete mode 100755 bin/open diff --git a/.Xresources b/.Xresources index b1c3e3d..be0e99f 100644 --- a/.Xresources +++ b/.Xresources @@ -18,10 +18,11 @@ URxvt.keysym.C-Next: font-size:decrease xterm*termName: xterm-256color xterm*VT100.Translations: #override \ - Ctrl Next: smaller-vt-font() \n\ - Ctrl Prior: larger-vt-font() \n -xterm*faceName: DejaVu Sans Mono -xterm*faceSize: 10 + Meta minus: smaller-vt-font() \n\ + Meta equal: larger-vt-font() \n +xterm*cursorColor: red +!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/.gitconfig b/.gitconfig index eaefde0..cefd5e5 100644 --- a/.gitconfig +++ b/.gitconfig @@ -13,3 +13,5 @@ name = Marc Vertes [pull] rebase = false +[hub] + protocol = ssh diff --git a/.vimrc b/.vimrc index f8fce87..671af49 100644 --- a/.vimrc +++ b/.vimrc @@ -13,7 +13,7 @@ let g:fzf_preview = 'cat {}' let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" 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 z :FZF ~/Wiki autocmd filetype vimki nnoremap = YpVr= 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/.zsh-powerline.sh b/.zsh-powerline.sh new file mode 100644 index 0000000..f0835a4 --- /dev/null +++ b/.zsh-powerline.sh @@ -0,0 +1,80 @@ +# Colorscheme +readonly COLOR_CWD='blue' +readonly COLOR_GIT='cyan' +readonly COLOR_SUCCESS='green' +readonly COLOR_FAILURE='red' +readonly COLOR_TIME='cyan' + +readonly SYMBOL_GIT_BRANCH='⑂' +readonly SYMBOL_GIT_MODIFIED='*' +readonly SYMBOL_GIT_PUSH='↑' +readonly SYMBOL_GIT_PULL='↓' +readonly PS_SYMBOL='$' + +_git_info() { + hash git 2>/dev/null || return # git not found + + # get current branch + local ref=$(git symbolic-ref --short HEAD 2>/dev/null) + + if [[ -n "$ref" ]]; then + # prepend branch symbol + ref=$SYMBOL_GIT_BRANCH$ref + else + # get most recent tag or abbreviated unique hash + ref=$(git describe --tags --always 2>/dev/null) + fi + + [[ -n "$ref" ]] || return # not a git repo + + local marks + + # scan first two lines of output from `git status` + while IFS= read -r line; do + if [[ $line =~ ^## ]]; then # header line + [[ $line =~ ahead\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PUSH$match[1]" + [[ $line =~ behind\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PULL$match[1]" + else # branch is modified if output contains more lines after the header line + marks="$SYMBOL_GIT_MODIFIED$marks" + break + fi + done < <(git status --porcelain --branch 2>/dev/null) # note the space between the two < + + # print without a trailing newline + printf " $ref$marks" +} + + +_config_prompt() { + # Color coding based on exit code of the previous command. Note this must + # be dealt with in the beginning of the function, otherwise the $? will not + # match the right command executed. + + if [[ $? -eq 0 ]]; then + local symbol="%F{$COLOR_SUCCESS}$PS_SYMBOL%f" + else + local symbol="%F{$COLOR_FAILURE}$PS_SYMBOL%f" + fi + + local cwd="%F{$COLOR_CWD}%~%f" + local git="%F{$COLOR_GIT}$(_git_info)%f" + local time="%F{$COLOR_TIME}%D{%H:%M:%S}%f" + + PROMPT="$cwd$git $symbol " + RPROMPT="$time" +} + + +# useful zsh hook functions + +precmd() { # run before each prompt + _config_prompt +} + + +preexec() { # run after user command is read and about to execute +} + + +chpwd() { # run when changing current working directory +} 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 "$@" -- cgit v1.2.3 From fdbb4f3bd7a651834904d0446303b10a76a6e349 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 14 Feb 2021 18:59:26 +0100 Subject: update --- .Xresources | 9 ++++--- .gitconfig | 2 ++ .vimrc | 2 +- .xinitrc | 24 ----------------- .xsession | 24 ----------------- .zsh-powerline.sh | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/open | 11 -------- 7 files changed, 88 insertions(+), 64 deletions(-) delete mode 100644 .xinitrc delete mode 100755 .xsession create mode 100644 .zsh-powerline.sh delete mode 100755 bin/open diff --git a/.Xresources b/.Xresources index b1c3e3d..be0e99f 100644 --- a/.Xresources +++ b/.Xresources @@ -18,10 +18,11 @@ URxvt.keysym.C-Next: font-size:decrease xterm*termName: xterm-256color xterm*VT100.Translations: #override \ - Ctrl Next: smaller-vt-font() \n\ - Ctrl Prior: larger-vt-font() \n -xterm*faceName: DejaVu Sans Mono -xterm*faceSize: 10 + Meta minus: smaller-vt-font() \n\ + Meta equal: larger-vt-font() \n +xterm*cursorColor: red +!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/.gitconfig b/.gitconfig index eaefde0..cefd5e5 100644 --- a/.gitconfig +++ b/.gitconfig @@ -13,3 +13,5 @@ name = Marc Vertes [pull] rebase = false +[hub] + protocol = ssh diff --git a/.vimrc b/.vimrc index f8fce87..671af49 100644 --- a/.vimrc +++ b/.vimrc @@ -13,7 +13,7 @@ let g:fzf_preview = 'cat {}' let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" 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 z :FZF ~/Wiki autocmd filetype vimki nnoremap = YpVr= 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/.zsh-powerline.sh b/.zsh-powerline.sh new file mode 100644 index 0000000..f0835a4 --- /dev/null +++ b/.zsh-powerline.sh @@ -0,0 +1,80 @@ +# Colorscheme +readonly COLOR_CWD='blue' +readonly COLOR_GIT='cyan' +readonly COLOR_SUCCESS='green' +readonly COLOR_FAILURE='red' +readonly COLOR_TIME='cyan' + +readonly SYMBOL_GIT_BRANCH='⑂' +readonly SYMBOL_GIT_MODIFIED='*' +readonly SYMBOL_GIT_PUSH='↑' +readonly SYMBOL_GIT_PULL='↓' +readonly PS_SYMBOL='$' + +_git_info() { + hash git 2>/dev/null || return # git not found + + # get current branch + local ref=$(git symbolic-ref --short HEAD 2>/dev/null) + + if [[ -n "$ref" ]]; then + # prepend branch symbol + ref=$SYMBOL_GIT_BRANCH$ref + else + # get most recent tag or abbreviated unique hash + ref=$(git describe --tags --always 2>/dev/null) + fi + + [[ -n "$ref" ]] || return # not a git repo + + local marks + + # scan first two lines of output from `git status` + while IFS= read -r line; do + if [[ $line =~ ^## ]]; then # header line + [[ $line =~ ahead\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PUSH$match[1]" + [[ $line =~ behind\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PULL$match[1]" + else # branch is modified if output contains more lines after the header line + marks="$SYMBOL_GIT_MODIFIED$marks" + break + fi + done < <(git status --porcelain --branch 2>/dev/null) # note the space between the two < + + # print without a trailing newline + printf " $ref$marks" +} + + +_config_prompt() { + # Color coding based on exit code of the previous command. Note this must + # be dealt with in the beginning of the function, otherwise the $? will not + # match the right command executed. + + if [[ $? -eq 0 ]]; then + local symbol="%F{$COLOR_SUCCESS}$PS_SYMBOL%f" + else + local symbol="%F{$COLOR_FAILURE}$PS_SYMBOL%f" + fi + + local cwd="%F{$COLOR_CWD}%~%f" + local git="%F{$COLOR_GIT}$(_git_info)%f" + local time="%F{$COLOR_TIME}%D{%H:%M:%S}%f" + + PROMPT="$cwd$git $symbol " + RPROMPT="$time" +} + + +# useful zsh hook functions + +precmd() { # run before each prompt + _config_prompt +} + + +preexec() { # run after user command is read and about to execute +} + + +chpwd() { # run when changing current working directory +} 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 "$@" -- cgit v1.2.3 From 90ec7bf2b039599f987066c4e16b5817743fafcf Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 15 Feb 2021 17:19:55 +0100 Subject: update --- .Xresources | 1 + .vimrc | 2 ++ .zsh-powerline.sh | 12 +++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.Xresources b/.Xresources index be0e99f..1514003 100644 --- a/.Xresources +++ b/.Xresources @@ -21,6 +21,7 @@ xterm*VT100.Translations: #override \ Meta minus: smaller-vt-font() \n\ Meta equal: larger-vt-font() \n xterm*cursorColor: red +xterm*visualBell: true !xterm*faceName: DejaVu Sans Mono !xterm*faceSize: 10 ! xterm*font: 7x14 diff --git a/.vimrc b/.vimrc index 671af49..9e45e2d 100644 --- a/.vimrc +++ b/.vimrc @@ -1,6 +1,8 @@ " set background= set t_te= t_ti= laststatus=2 +set rtp+=/opt/local/share/fzf/vim + syntax off filetype on filetype plugin on diff --git a/.zsh-powerline.sh b/.zsh-powerline.sh index f0835a4..e3f05f1 100644 --- a/.zsh-powerline.sh +++ b/.zsh-powerline.sh @@ -1,9 +1,10 @@ # Colorscheme readonly COLOR_CWD='blue' readonly COLOR_GIT='cyan' -readonly COLOR_SUCCESS='green' +#readonly COLOR_SUCCESS='green' +readonly COLOR_SUCCESS='blue' readonly COLOR_FAILURE='red' -readonly COLOR_TIME='cyan' +#readonly COLOR_TIME='cyan' readonly SYMBOL_GIT_BRANCH='⑂' readonly SYMBOL_GIT_MODIFIED='*' @@ -56,12 +57,13 @@ _config_prompt() { local symbol="%F{$COLOR_FAILURE}$PS_SYMBOL%f" fi - local cwd="%F{$COLOR_CWD}%~%f" + #local cwd="%F{$COLOR_CWD}%~%f" + local cwd="%F{$COLOR_CWD}%2~%f" local git="%F{$COLOR_GIT}$(_git_info)%f" - local time="%F{$COLOR_TIME}%D{%H:%M:%S}%f" + #local time="%F{$COLOR_TIME}%D{%H:%M:%S}%f" PROMPT="$cwd$git $symbol " - RPROMPT="$time" + #RPROMPT="$time" } -- cgit v1.2.3 From 4ae067058d3cef9e169869215dd29c7d3534d1d2 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 15 Feb 2021 17:19:55 +0100 Subject: update --- .Xresources | 1 + .vimrc | 2 ++ .zsh-powerline.sh | 12 +++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.Xresources b/.Xresources index be0e99f..1514003 100644 --- a/.Xresources +++ b/.Xresources @@ -21,6 +21,7 @@ xterm*VT100.Translations: #override \ Meta minus: smaller-vt-font() \n\ Meta equal: larger-vt-font() \n xterm*cursorColor: red +xterm*visualBell: true !xterm*faceName: DejaVu Sans Mono !xterm*faceSize: 10 ! xterm*font: 7x14 diff --git a/.vimrc b/.vimrc index 671af49..9e45e2d 100644 --- a/.vimrc +++ b/.vimrc @@ -1,6 +1,8 @@ " set background= set t_te= t_ti= laststatus=2 +set rtp+=/opt/local/share/fzf/vim + syntax off filetype on filetype plugin on diff --git a/.zsh-powerline.sh b/.zsh-powerline.sh index f0835a4..e3f05f1 100644 --- a/.zsh-powerline.sh +++ b/.zsh-powerline.sh @@ -1,9 +1,10 @@ # Colorscheme readonly COLOR_CWD='blue' readonly COLOR_GIT='cyan' -readonly COLOR_SUCCESS='green' +#readonly COLOR_SUCCESS='green' +readonly COLOR_SUCCESS='blue' readonly COLOR_FAILURE='red' -readonly COLOR_TIME='cyan' +#readonly COLOR_TIME='cyan' readonly SYMBOL_GIT_BRANCH='⑂' readonly SYMBOL_GIT_MODIFIED='*' @@ -56,12 +57,13 @@ _config_prompt() { local symbol="%F{$COLOR_FAILURE}$PS_SYMBOL%f" fi - local cwd="%F{$COLOR_CWD}%~%f" + #local cwd="%F{$COLOR_CWD}%~%f" + local cwd="%F{$COLOR_CWD}%2~%f" local git="%F{$COLOR_GIT}$(_git_info)%f" - local time="%F{$COLOR_TIME}%D{%H:%M:%S}%f" + #local time="%F{$COLOR_TIME}%D{%H:%M:%S}%f" PROMPT="$cwd$git $symbol " - RPROMPT="$time" + #RPROMPT="$time" } -- cgit v1.2.3 From 17b6d57450341896743f31ae67921d2abd8551bc Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 22 Feb 2021 17:10:51 +0100 Subject: updated --- .Xresources | 1 + .bashrc | 2 ++ .gitconfig | 2 ++ .vimrc | 3 +-- bin/gauth | 4 +++- bin/p4a | 3 +++ bin/xt | 3 ++- 7 files changed, 14 insertions(+), 4 deletions(-) create mode 100755 bin/p4a diff --git a/.Xresources b/.Xresources index 1514003..bdf02a3 100644 --- a/.Xresources +++ b/.Xresources @@ -22,6 +22,7 @@ xterm*VT100.Translations: #override \ Meta 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 diff --git a/.bashrc b/.bashrc index c086d45..95f2377 100644 --- a/.bashrc +++ b/.bashrc @@ -131,3 +131,5 @@ unset base # load Nix config files (aka auto-completion etc.) export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/.gitconfig b/.gitconfig index cefd5e5..11f0d14 100644 --- a/.gitconfig +++ b/.gitconfig @@ -15,3 +15,5 @@ rebase = false [hub] protocol = ssh +[init] + defaultBranch = main diff --git a/.vimrc b/.vimrc index 9e45e2d..5220bba 100644 --- a/.vimrc +++ b/.vimrc @@ -1,14 +1,13 @@ " set background= set t_te= t_ti= laststatus=2 -set rtp+=/opt/local/share/fzf/vim - syntax off filetype on filetype plugin on filetype plugin indent on let mapleader = "," +set rtp+=/opt/homebrew/opt/fzf let g:fzf_preview = 'cat {}' " vimki plugin 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/p4a b/bin/p4a new file mode 100755 index 0000000..30e54ff --- /dev/null +++ b/bin/p4a @@ -0,0 +1,3 @@ +#!/bin/sh +adb forward tcp:8222 tcp:8022 +ssh ssh://u0_a250@localhost:8222 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"; } -- cgit v1.2.3 From 98d3c3b82a8359d9cd1a8e5b3a6e1afe5fa56914 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 22 Feb 2021 17:10:51 +0100 Subject: updated --- .Xresources | 1 + .bashrc | 2 ++ .gitconfig | 2 ++ .vimrc | 3 +-- bin/gauth | 4 +++- bin/p4a | 3 +++ bin/xt | 3 ++- 7 files changed, 14 insertions(+), 4 deletions(-) create mode 100755 bin/p4a diff --git a/.Xresources b/.Xresources index 1514003..bdf02a3 100644 --- a/.Xresources +++ b/.Xresources @@ -22,6 +22,7 @@ xterm*VT100.Translations: #override \ Meta 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 diff --git a/.bashrc b/.bashrc index c086d45..95f2377 100644 --- a/.bashrc +++ b/.bashrc @@ -131,3 +131,5 @@ unset base # load Nix config files (aka auto-completion etc.) export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/.gitconfig b/.gitconfig index cefd5e5..11f0d14 100644 --- a/.gitconfig +++ b/.gitconfig @@ -15,3 +15,5 @@ rebase = false [hub] protocol = ssh +[init] + defaultBranch = main diff --git a/.vimrc b/.vimrc index 9e45e2d..5220bba 100644 --- a/.vimrc +++ b/.vimrc @@ -1,14 +1,13 @@ " set background= set t_te= t_ti= laststatus=2 -set rtp+=/opt/local/share/fzf/vim - syntax off filetype on filetype plugin on filetype plugin indent on let mapleader = "," +set rtp+=/opt/homebrew/opt/fzf let g:fzf_preview = 'cat {}' " vimki plugin 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/p4a b/bin/p4a new file mode 100755 index 0000000..30e54ff --- /dev/null +++ b/bin/p4a @@ -0,0 +1,3 @@ +#!/bin/sh +adb forward tcp:8222 tcp:8022 +ssh ssh://u0_a250@localhost:8222 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"; } -- cgit v1.2.3 From 45ecd3877ab52d73f4bec998ad456aa270ffddac Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 23 Feb 2021 14:52:10 +0100 Subject: update --- bin/update_hosts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/update_hosts diff --git a/bin/update_hosts b/bin/update_hosts new file mode 100755 index 0000000..6444550 --- /dev/null +++ b/bin/update_hosts @@ -0,0 +1,16 @@ +#!/bin/sh -ex + +# Update /etc/hosts with a well curated blacklist of malware, ads, porn, etc. +# Custom hosts are preserved. + +[ "$USER" = root ] || exec sudo "$0" "$@" +cd /etc +cp -p hosts hosts.old +hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) +curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | +awk 'BEGIN { hosts = ARGV[1]; ARGV[1] = "" } +/^# Custom host / { print hosts; next } +/^# End of custom host / { next } +{print}' "$hosts" > hosts.new +mv hosts.new hosts +[ "$(uname -s)" != Darwin ] || dscacheutil -flushcache -- cgit v1.2.3 From 29a52089c0ba2a78f5f7fa9b299f00ece9e6faf1 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 23 Feb 2021 14:52:10 +0100 Subject: update --- bin/update_hosts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/update_hosts diff --git a/bin/update_hosts b/bin/update_hosts new file mode 100755 index 0000000..6444550 --- /dev/null +++ b/bin/update_hosts @@ -0,0 +1,16 @@ +#!/bin/sh -ex + +# Update /etc/hosts with a well curated blacklist of malware, ads, porn, etc. +# Custom hosts are preserved. + +[ "$USER" = root ] || exec sudo "$0" "$@" +cd /etc +cp -p hosts hosts.old +hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) +curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | +awk 'BEGIN { hosts = ARGV[1]; ARGV[1] = "" } +/^# Custom host / { print hosts; next } +/^# End of custom host / { next } +{print}' "$hosts" > hosts.new +mv hosts.new hosts +[ "$(uname -s)" != Darwin ] || dscacheutil -flushcache -- cgit v1.2.3 From 9793ed6f2c0a89728d19a8b06d084c3c3fb102e5 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 24 Feb 2021 22:28:41 +0100 Subject: update --- .Xresources | 2 +- .vimrc | 2 +- bin/start_godoc | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100755 bin/start_godoc diff --git a/.Xresources b/.Xresources index bdf02a3..8aaf72c 100644 --- a/.Xresources +++ b/.Xresources @@ -22,7 +22,7 @@ xterm*VT100.Translations: #override \ Meta equal: larger-vt-font() \n xterm*cursorColor: red xterm*visualBell: true -xterm*geometry: 100x32 +!xterm*geometry: 100x32 !xterm*faceName: DejaVu Sans Mono !xterm*faceSize: 10 ! xterm*font: 7x14 diff --git a/.vimrc b/.vimrc index 5220bba..35fb5e1 100644 --- a/.vimrc +++ b/.vimrc @@ -14,7 +14,7 @@ let g:fzf_preview = 'cat {}' let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" 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 z :FZF ~/Wiki autocmd filetype vimki nnoremap = YpVr= diff --git a/bin/start_godoc b/bin/start_godoc new file mode 100755 index 0000000..15bb70a --- /dev/null +++ b/bin/start_godoc @@ -0,0 +1,3 @@ +#!/bin/sh + +/Users/marc/go/bin/godoc >/tmp/godoc.out 2>&1 & -- cgit v1.2.3 From 08c1e56c3905878b358546054ad2eff307a7ec42 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 24 Feb 2021 22:28:41 +0100 Subject: update --- .Xresources | 2 +- .vimrc | 2 +- bin/start_godoc | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100755 bin/start_godoc diff --git a/.Xresources b/.Xresources index bdf02a3..8aaf72c 100644 --- a/.Xresources +++ b/.Xresources @@ -22,7 +22,7 @@ xterm*VT100.Translations: #override \ Meta equal: larger-vt-font() \n xterm*cursorColor: red xterm*visualBell: true -xterm*geometry: 100x32 +!xterm*geometry: 100x32 !xterm*faceName: DejaVu Sans Mono !xterm*faceSize: 10 ! xterm*font: 7x14 diff --git a/.vimrc b/.vimrc index 5220bba..35fb5e1 100644 --- a/.vimrc +++ b/.vimrc @@ -14,7 +14,7 @@ let g:fzf_preview = 'cat {}' let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" 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 z :FZF ~/Wiki autocmd filetype vimki nnoremap = YpVr= diff --git a/bin/start_godoc b/bin/start_godoc new file mode 100755 index 0000000..15bb70a --- /dev/null +++ b/bin/start_godoc @@ -0,0 +1,3 @@ +#!/bin/sh + +/Users/marc/go/bin/godoc >/tmp/godoc.out 2>&1 & -- cgit v1.2.3 From a4f62573788d3d3d25c0bd1d9c443a8e56577a6f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 25 Feb 2021 22:10:02 +0100 Subject: update --- .otp_accounts.json.gpg | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .otp_accounts.json.gpg 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----- -- cgit v1.2.3 From 9e34d600e3d8f8e50b8b87779c76c62924f41d2f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 28 Feb 2021 14:05:43 +0100 Subject: update --- bin/vm | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 bin/vm diff --git a/bin/vm b/bin/vm new file mode 100755 index 0000000..22886d8 --- /dev/null +++ b/bin/vm @@ -0,0 +1,65 @@ +#!/bin/sh + +# vm is a tool to manage virtual machines. + +vm_version='vm-0.1' +unset CDPATH +export LC_ALL=C IFS=' +' + +add() { + usage 'add name' 'Add a new VM' && return + echo 'not implemented yet' +} + +del() { + usage 'del name' 'Delete a VM' && return + echo 'not implemented yet' +} + +die() { echo "$0: fatal: $@" >&2; exit 1; } + +help() { + usage 'help' 'Print this help text' && return + printf "$vm_version\nUsage: vm command [options] [args]\n" + Opth=1; for c in $Cmdlist; do $c; done +} + +info() { + usage 'info name' 'Print informations on a VM' && return + echo 'not implemented yet' +} + +list() { + usage 'list' 'list VMs' && return + echo 'not implemented yet' +} + +start() { + usage 'start name' 'Start a VM' && return + echo 'not implemented yet' +} + +stop() { + usage 'stop name' 'Stop a VM' && return + echo 'not implemented yet' +} + +usage() { [ "$Opth" ] && printf " %-34s %s\n" "$1" "$2"; } + +version() { + usage 'version' 'Print version' && return + echo "$vm_version" +} + +# Main starts here. +Cmdlist='add del info help list start stop version' +[ "$1" ] && C=$1 && shift 1 || { help; exit 1; } +for c in $Cmdlist +do + case $c in + ($C) cmd=$c; break;; + ($C*) [ "$cmd" ] && die "ambiguous command $C" || cmd=$c;; + esac +done +[ "$cmd" ] || die "no command \"$C\"" && $cmd "$@" -- cgit v1.2.3 From 737e83162766162be992f76e068386736abea71d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 28 Feb 2021 22:10:26 +0100 Subject: update --- .Xresources | 2 +- bin/rdate | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 bin/rdate diff --git a/.Xresources b/.Xresources index 8aaf72c..28b8436 100644 --- a/.Xresources +++ b/.Xresources @@ -21,7 +21,7 @@ xterm*VT100.Translations: #override \ Meta minus: smaller-vt-font() \n\ Meta equal: larger-vt-font() \n xterm*cursorColor: red -xterm*visualBell: true +!xterm*visualBell: true !xterm*geometry: 100x32 !xterm*faceName: DejaVu Sans Mono !xterm*faceSize: 10 diff --git a/bin/rdate b/bin/rdate new file mode 100755 index 0000000..a69d137 --- /dev/null +++ b/bin/rdate @@ -0,0 +1,11 @@ +#!/bin/sh + +# Set date on remote machine from local one. This version works +# from MacOS to AlpineLinux. It is intended to re-sync clock of a +# virtual machine after host wakeup. + +# TODO: option to display the time difference between host and remote. +# hint: use 'date +%s' to get timestamp in seconds since epoch. + +ssh "$1" "sudo date $(date +%m%d%H%M%Y.%S)" + -- cgit v1.2.3 From bcc866236cca05f6caf78a6c3d93a63c9bf19f7c Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 6 Mar 2021 12:31:59 +0100 Subject: add .zshrc, update .vimrc --- .zshrc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .zshrc diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..15ed2e8 --- /dev/null +++ b/.zshrc @@ -0,0 +1,48 @@ +# Environment +export YAEGI_DOT_CMD='dotty -' + +# gnuplot display in terminal +export GNUTERM='sixelgd enhanced truecolor font "arial,9"' + +# Auto completion +FPATH=/opt/homebrew/share/zsh-completions:/opt/homebrew/share/zsh/site-functions:$FPATH +autoload -Uz compinit && compinit + +setopt share_history + +# Aliases +alias pt='sudo port -v' +alias pu='pt selfupdate && pt upgrade outdated' + +alias by='go build ./cmd/yaegi' +alias cy='cd ~/go/src/github.com/traefik/yaegi' +alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' +#alias git='hub' +alias ll='ls -AFGl' +alias ls='ls -AG' +alias ya='rlwrap yaegi' + +export MANWIDTH=92 + +# Functions +man() { + local width=$(tput cols) + [ $width -gt $MANWIDTH ] && width=$MANWIDTH + env MANWIDTH=$width man "$@" +} + +meteo() { + local request="wttr.in/${1-Toulouse}?F&T" + [ "$(tput cols)" -lt 125 ] && request+='&n' + curl -H "Accept-Language: fr" --compressed "$request" +} + +p() { [ -f "$1" -a ! -x "$1" ] && less -XF $1 || "$@" 2>&1 | less -XF ; } + +ty() { go test -v -short ./interp; } + +# Prompt +source ~/.zsh-powerline.sh + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + -- cgit v1.2.3 From 9aa9c25a4d2ced1ea41d1d981b3fad9fe28a17a6 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 6 Mar 2021 16:58:38 +0100 Subject: update --- .vim/pack/mvertes/install.sh | 2 +- .vimrc | 3 ++- .zshrc | 8 +++----- bin/vm | 4 +++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.vim/pack/mvertes/install.sh b/.vim/pack/mvertes/install.sh index 36cf414..24a52f0 100755 --- a/.vim/pack/mvertes/install.sh +++ b/.vim/pack/mvertes/install.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -plugins='https://github.com/mvertes/vimki https://github.com/fatih/vim-go' +plugins='git@github.com:mvertes/vimki git@github.com:fatih/vim-go' ht='vim -c "helptags doc" -c "q"' mkdir -p start diff --git a/.vimrc b/.vimrc index 35fb5e1..9f5b410 100644 --- a/.vimrc +++ b/.vimrc @@ -1,5 +1,6 @@ " set background= -set t_te= t_ti= laststatus=2 +"set t_te= t_ti= laststatus=2 +set t_te= t_ti= ls=1 ruler syntax off filetype on diff --git a/.zshrc b/.zshrc index 15ed2e8..890bfe4 100644 --- a/.zshrc +++ b/.zshrc @@ -22,13 +22,11 @@ alias ll='ls -AFGl' alias ls='ls -AG' alias ya='rlwrap yaegi' -export MANWIDTH=92 - # Functions man() { - local width=$(tput cols) - [ $width -gt $MANWIDTH ] && width=$MANWIDTH - env MANWIDTH=$width man "$@" + local width='' + [ $(tput cols) -gt 88 ] && width='MANWIDTH=88' + env $width man "$@" } meteo() { diff --git a/bin/vm b/bin/vm index 22886d8..4b0e960 100755 --- a/bin/vm +++ b/bin/vm @@ -21,7 +21,9 @@ die() { echo "$0: fatal: $@" >&2; exit 1; } help() { usage 'help' 'Print this help text' && return - printf "$vm_version\nUsage: vm command [options] [args]\n" + echo "$vm_version +Manage virtual machines +Usage: vm command [options] [args]" Opth=1; for c in $Cmdlist; do $c; done } -- cgit v1.2.3 From 050afa8def0739b459122b9d4c7fcf854ae1ed2a Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 12 Mar 2021 12:31:20 +0100 Subject: added wol. Updated vm --- bin/vm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ bin/wol | 6 ++++++ 2 files changed, 68 insertions(+), 6 deletions(-) create mode 100755 bin/wol diff --git a/bin/vm b/bin/vm index 4b0e960..5a8ea8d 100755 --- a/bin/vm +++ b/bin/vm @@ -9,7 +9,10 @@ export LC_ALL=C IFS=' add() { usage 'add name' 'Add a new VM' && return - echo 'not implemented yet' + [ -d "$idir/$1" ] && die "vm $1 already exists in $idir/$1" + init_alpine || die "could not init alpine iso" + mkdir -p "$idir/$1" && cd "$idir/$1" || die "add $1 failed" + pwd } del() { @@ -32,9 +35,54 @@ info() { echo 'not implemented yet' } -list() { - usage 'list' 'list VMs' && return - echo 'not implemented yet' +init() { + : +} + +init_alpine() { + mkdir -p "$sdir/alpine" && cd "$sdir/alpine" || die "init alpine failed" + [ -f Makefile ] || cat << \EOT > Makefile +# Do no edit. This file is generated by vm. +# Install a run a native AlpineLinux VM in Apple silicon MacOS + +# Check https://alpinelinux.org/downloads for possible upgrades +iso_url = https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-virt-3.13.2-aarch64.iso +iso = $(notdir $(iso_url)) +isoinfo ?= /opt/homebrew/bin/isoinfo + +all: initrd vmlinux + +runiso: initrd vmlinux $(iso) + vftool -k vmlinux -i initrd -d hdd.img -c $(iso) + +initrd: $(iso) $(isoinfo) + isoinfo -i $(iso) -J -x /boot/initramfs-virt > $@ + +vmlinux: $(iso) $(isoinfo) + isoinfo -i $(iso) -J -x /boot/vmlinuz-virt | gunzip > $@ + +$(iso): + curl -LO $(iso_url) || { rm -f $@; false; } + +$(isoinfo): + brew install cdrtools +EOT + + make -s all +} + +ls() { + usage 'ls' 'list VMs' && return + [ -d "$idir" ] && cd "$idir" || return + for i in *; do + echo "$i" + done +} + +runiso() { + usage 'runiso [isoname]' 'run a cdrom iso' && return + init_alpine + make runiso } start() { @@ -55,7 +103,15 @@ version() { } # Main starts here. -Cmdlist='add del info help list start stop version' +pdir="$HOME/.vm" +sdir="$pdir/iso" +edir="$pdir/engine" +idir="$pdir/img" + +engines="vftool" # Todo: add qemu (when supported on m1) +isos="alpine" # Todo: add freebsd, openbsd, archlinux, debian, ubuntu, macOS, win10, etc... + +Cmdlist='add del info help ls runiso start stop version' [ "$1" ] && C=$1 && shift 1 || { help; exit 1; } for c in $Cmdlist do @@ -64,4 +120,4 @@ do ($C*) [ "$cmd" ] && die "ambiguous command $C" || cmd=$c;; esac done -[ "$cmd" ] || die "no command \"$C\"" && $cmd "$@" +[ "$cmd" ] || { help; exit 1; } && $cmd "$@" diff --git a/bin/wol b/bin/wol new file mode 100755 index 0000000..39bce0d --- /dev/null +++ b/bin/wol @@ -0,0 +1,6 @@ +#!/bin/sh -x +ip_plex=192.168.1.90 mac_plex=b0:83:fe:61:a7:aa +eval "mac=\$mac_$1 ip=\$ip_$1" +wakeonlan "$mac" +ping -o "$ip" +ssh "root@$ip" -- cgit v1.2.3 From 5c75618ff26969654a0572ae00b01f77d1898a71 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 12 Mar 2021 13:52:11 +0100 Subject: fix titles --- .zshrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.zshrc b/.zshrc index 890bfe4..9d3ebd2 100644 --- a/.zshrc +++ b/.zshrc @@ -39,6 +39,22 @@ p() { [ -f "$1" -a ! -x "$1" ] && less -XF $1 || "$@" 2>&1 | less -XF ; } ty() { go test -v -short ./interp; } +# Term title management +function set-term-title-precmd() { + emulate -L zsh + print -rn -- $'\e]0;'${(V%):-'%~'}$'\a' >$TTY +} + +function set-term-title-preexec() { + emulate -L zsh + print -rn -- $'\e]0;'${(V)1}$'\a' >$TTY +} + +autoload -Uz add-zsh-hook +add-zsh-hook preexec set-term-title-preexec +add-zsh-hook precmd set-term-title-precmd +set-term-title-precmd + # Prompt source ~/.zsh-powerline.sh -- cgit v1.2.3 From 556754fb516ff84965a510d0205f3c1d6cf64505 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 17 Mar 2021 16:17:42 +0100 Subject: improved vm --- bin/vm | 133 +++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 88 insertions(+), 45 deletions(-) diff --git a/bin/vm b/bin/vm index 5a8ea8d..e8f7684 100755 --- a/bin/vm +++ b/bin/vm @@ -1,32 +1,50 @@ #!/bin/sh -# vm is a tool to manage virtual machines. +# vm is a tool to manage and operate virtual machines. vm_version='vm-0.1' + +# TODO: +# - DONE: fetch, build and install vftool in .vm/vftool +# - setup a config file per VM +# - creation of hdd image +# - script install from CDROM iso: +# - setup system, including static IP address +# - setup user account from host +# - setup ssh from host +# - time synchronization from host +# + unset CDPATH export LC_ALL=C IFS=' ' add() { usage 'add name' 'Add a new VM' && return - [ -d "$idir/$1" ] && die "vm $1 already exists in $idir/$1" + [ -d "$dir/$1" ] && die "vm $1 already exists in $dir/$1" init_alpine || die "could not init alpine iso" - mkdir -p "$idir/$1" && cd "$idir/$1" || die "add $1 failed" + mkdir -p "$dir/$1" && cd "$dir/$1" || die "add $1 failed" pwd } +console() { + usage 'console name' 'Attach a console to a VM' && return + [ "$1" ] || die 'console: name is missing' + cd "$dir/$1" || die 'console $1 failed' + [ -f vftool.pid ] || die "vm $1 is not active" + screen -r "$1" +} + del() { usage 'del name' 'Delete a VM' && return echo 'not implemented yet' } -die() { echo "$0: fatal: $@" >&2; exit 1; } +die() { [ "$1" ] && echo "$@" >&2; exit 1; } help() { usage 'help' 'Print this help text' && return - echo "$vm_version -Manage virtual machines -Usage: vm command [options] [args]" + echo "$vm_version\nManage virtual machines\nUsage: vm command [options] [args]" Opth=1; for c in $Cmdlist; do $c; done } @@ -35,16 +53,9 @@ info() { echo 'not implemented yet' } -init() { - : -} - -init_alpine() { - mkdir -p "$sdir/alpine" && cd "$sdir/alpine" || die "init alpine failed" - [ -f Makefile ] || cat << \EOT > Makefile -# Do no edit. This file is generated by vm. -# Install a run a native AlpineLinux VM in Apple silicon MacOS +# CAUTION: be careful to preserve tabs in the following Makefile template string. +alpine_makefile='# Generated by "vm". DO NOT EDIT. # Check https://alpinelinux.org/downloads for possible upgrades iso_url = https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-virt-3.13.2-aarch64.iso iso = $(notdir $(iso_url)) @@ -52,9 +63,6 @@ isoinfo ?= /opt/homebrew/bin/isoinfo all: initrd vmlinux -runiso: initrd vmlinux $(iso) - vftool -k vmlinux -i initrd -d hdd.img -c $(iso) - initrd: $(iso) $(isoinfo) isoinfo -i $(iso) -J -x /boot/initramfs-virt > $@ @@ -63,36 +71,79 @@ vmlinux: $(iso) $(isoinfo) $(iso): curl -LO $(iso_url) || { rm -f $@; false; } + ln -sf $(iso) iso $(isoinfo): brew install cdrtools -EOT +' +init_alpine() { + mkdir -p "$dir/alpine-iso" && cd "$dir/alpine-iso" || die 'init alpine failed' + [ -f 'Makefile' ] || echo "$alpine_makefile" > Makefile make -s all } +init_vftool() { + [ -x "$dir/vftool" ] && return + cd '/tmp' && + git clone --depth=1 'https://github.com/evansm7/vftool' && + cd 'vftool' && + make && + cp 'build/vftool' "$dir/vftool" + rm -rf '/tmp/vftool' +} + +log() { + usage 'log name' 'print logs of a VM' && return + [ "$1" ] || die "log failed: name missing" + cd "$dir/$1" || die "log $1 failed" + cat vftool.log.old vftool.log 2>/dev/null +} + ls() { usage 'ls' 'list VMs' && return - [ -d "$idir" ] && cd "$idir" || return - for i in *; do - echo "$i" + [ -d "$dir" ] && cd "$dir" || return + for i in */; do + i=${i%/} + [ -f "$i/vftool.pid" ] && state=active || state=stopped + printf "%-20s %s\n" "$i" "$state" done } -runiso() { - usage 'runiso [isoname]' 'run a cdrom iso' && return - init_alpine - make runiso -} - start() { - usage 'start name' 'Start a VM' && return - echo 'not implemented yet' + usage 'start [-a][-c vm] name' 'Start a VM' && return + while getopts :ac: opt; do + case $opt in + (a) attach=1 ;; + (c) from=$OPTARG ;; + (*) Opth=1 start; exit;; + esac + done + shift $((OPTIND - 1)) + + [ "$1" ] || die "start failed: name missing" + init_vftool + cd "$dir/$1" || die "start $1 failed" + [ -f vftool.pid ] && die "Error: process $(cat vftool.pid) is active or $PWD/vftool.pid should be removed" + start_vm & } +start_vm() ( + trap 'rm -f vftool.pid' EXIT + [ -f vftool.log ] && cat vftool.log >> vftool.log.old + "$dir/vftool" -k vmlinux -i initrd -c iso >vftool.log 2>&1 & sleep 1 + exec 1>>vftool.log 2>&1 + echo "$!" >vftool.pid + screen -S "${PWD##*/}" -d -m "$(grep -om 1 '\/dev\/tty.*' vftool.log)" + wait +) + stop() { usage 'stop name' 'Stop a VM' && return - echo 'not implemented yet' + [ "$1" ] || die 'stop: name missing' + cd "$dir/$1" || die 'stop $1 failed' + [ -f vftool.pid ] || die "stop: vm $1 is not active" + kill $(cat vftool.pid) } usage() { [ "$Opth" ] && printf " %-34s %s\n" "$1" "$2"; } @@ -103,21 +154,13 @@ version() { } # Main starts here. -pdir="$HOME/.vm" -sdir="$pdir/iso" -edir="$pdir/engine" -idir="$pdir/img" - -engines="vftool" # Todo: add qemu (when supported on m1) -isos="alpine" # Todo: add freebsd, openbsd, archlinux, debian, ubuntu, macOS, win10, etc... - -Cmdlist='add del info help ls runiso start stop version' +dir="$HOME/.vm" +Cmdlist='add console del info help ls log start stop version' [ "$1" ] && C=$1 && shift 1 || { help; exit 1; } -for c in $Cmdlist -do +for c in $Cmdlist; do case $c in - ($C) cmd=$c; break;; - ($C*) [ "$cmd" ] && die "ambiguous command $C" || cmd=$c;; + ($C) cmd=$c; break ;; + ($C*) [ "$cmd" ] && die "ambiguous command $C" || cmd=$c ;; esac done [ "$cmd" ] || { help; exit 1; } && $cmd "$@" -- cgit v1.2.3 From d86227be78743b71c713a7ce6267cfcea73f6582 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 18 Mar 2021 16:28:30 +0100 Subject: update --- bin/vm | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/bin/vm b/bin/vm index e8f7684..83ce0ea 100755 --- a/bin/vm +++ b/bin/vm @@ -1,12 +1,12 @@ #!/bin/sh -# vm is a tool to manage and operate virtual machines. +# vm is a command line tool to manage and operate virtual machines. vm_version='vm-0.1' # TODO: # - DONE: fetch, build and install vftool in .vm/vftool -# - setup a config file per VM +# - DONE: setup a config file per VM # - creation of hdd image # - script install from CDROM iso: # - setup system, including static IP address @@ -61,7 +61,7 @@ iso_url = https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-vi iso = $(notdir $(iso_url)) isoinfo ?= /opt/homebrew/bin/isoinfo -all: initrd vmlinux +all: initrd vmlinux config initrd: $(iso) $(isoinfo) isoinfo -i $(iso) -J -x /boot/initramfs-virt > $@ @@ -69,9 +69,11 @@ initrd: $(iso) $(isoinfo) vmlinux: $(iso) $(isoinfo) isoinfo -i $(iso) -J -x /boot/vmlinuz-virt | gunzip > $@ +config: $(iso) + @echo "iso=$(iso)" >config + $(iso): curl -LO $(iso_url) || { rm -f $@; false; } - ln -sf $(iso) iso $(isoinfo): brew install cdrtools @@ -79,7 +81,7 @@ $(isoinfo): init_alpine() { mkdir -p "$dir/alpine-iso" && cd "$dir/alpine-iso" || die 'init alpine failed' - [ -f 'Makefile' ] || echo "$alpine_makefile" > Makefile + [ -f 'Makefile' ] || printf "%s" "$alpine_makefile" > Makefile make -s all } @@ -129,10 +131,21 @@ start() { } start_vm() ( - trap 'rm -f vftool.pid' EXIT [ -f vftool.log ] && cat vftool.log >> vftool.log.old - "$dir/vftool" -k vmlinux -i initrd -c iso >vftool.log 2>&1 & sleep 1 - exec 1>>vftool.log 2>&1 + exec 1>vftool.log 2>&1 + . config || die "vm: could not source $PWD/config" + trap 'rm -f vftool.pid' EXIT + + "$dir/vftool" \ + -k vmlinux \ + -i initrd \ + ${iso+-c "$iso"} \ + ${hdd+-d "$hdd"} \ + ${cpu+-p "$cpu"} \ + ${ram+-m "$ram"} \ + ${arg+-m "$arg"} \ + >>vftool.log 2>&1 & sleep 1 + echo "$!" >vftool.pid screen -S "${PWD##*/}" -d -m "$(grep -om 1 '\/dev\/tty.*' vftool.log)" wait -- cgit v1.2.3 From a8e3586e9b691c2a25b5f2e50a2761d5fcad18f8 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 19 Mar 2021 22:27:11 +0100 Subject: update --- .zshrc | 3 +++ bin/vm | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.zshrc b/.zshrc index 9d3ebd2..bd67270 100644 --- a/.zshrc +++ b/.zshrc @@ -4,6 +4,9 @@ export YAEGI_DOT_CMD='dotty -' # gnuplot display in terminal export GNUTERM='sixelgd enhanced truecolor font "arial,9"' +# Terraform-perf +export TFP=$HOME/src/github.com/traefik/terraform-perf + # Auto completion FPATH=/opt/homebrew/share/zsh-completions:/opt/homebrew/share/zsh/site-functions:$FPATH autoload -Uz compinit && compinit diff --git a/bin/vm b/bin/vm index 83ce0ea..0eaa921 100755 --- a/bin/vm +++ b/bin/vm @@ -8,6 +8,7 @@ vm_version='vm-0.1' # - DONE: fetch, build and install vftool in .vm/vftool # - DONE: setup a config file per VM # - creation of hdd image +# - import iso, kernel, initrd from existing vm # - script install from CDROM iso: # - setup system, including static IP address # - setup user account from host @@ -20,13 +21,31 @@ export LC_ALL=C IFS=' ' add() { - usage 'add name' 'Add a new VM' && return + usage 'add [Options] name' 'Add a new VM' && return + while getopts :c:p:s: opt; do + case $opt in + c|k|p|s) eval "$opt=$OPTARG";; + *) Opth=1 add; exit ;; + esac + done + shift $((OPTIND - 1)) + [ -d "$dir/$1" ] && die "vm $1 already exists in $dir/$1" init_alpine || die "could not init alpine iso" mkdir -p "$dir/$1" && cd "$dir/$1" || die "add $1 failed" - pwd + hdd=${p-$1.raw} + [ -f "$hdd" ] || dd if=/dev/zero of=$hdd bs=1 count=0 seek=${s-32g} 2>/dev/null + echo "hdd=\"$hdd\"" > config + [ "$c" ] && { + [ -d "../$c" ] || die "invalid directory: $dir/$c" + iso=$(getconf "$c" iso) + [ "$iso" ] && echo "iso=\"../$c/$iso\"" >> config + cp "../$c/vmlinux" "../$c/initrd" . + } } +getconf() { awk -F '=' -v k="$2" '$1 == k {print $2}' "$dir/$1/config"; } + console() { usage 'console name' 'Attach a console to a VM' && return [ "$1" ] || die 'console: name is missing' @@ -128,6 +147,7 @@ start() { cd "$dir/$1" || die "start $1 failed" [ -f vftool.pid ] && die "Error: process $(cat vftool.pid) is active or $PWD/vftool.pid should be removed" start_vm & + [ "$attach" ] && sleep 1 && vm console $1 } start_vm() ( @@ -139,8 +159,8 @@ start_vm() ( "$dir/vftool" \ -k vmlinux \ -i initrd \ - ${iso+-c "$iso"} \ ${hdd+-d "$hdd"} \ + ${iso+-c "$iso"} \ ${cpu+-p "$cpu"} \ ${ram+-m "$ram"} \ ${arg+-m "$arg"} \ -- cgit v1.2.3 From 262eb286cb7c8d7412160cacfb022247b1f09f00 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 22 Mar 2021 08:50:26 +0100 Subject: update --- bin/vm | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 17 deletions(-) diff --git a/bin/vm b/bin/vm index 0eaa921..11fed61 100755 --- a/bin/vm +++ b/bin/vm @@ -7,9 +7,12 @@ vm_version='vm-0.1' # TODO: # - DONE: fetch, build and install vftool in .vm/vftool # - DONE: setup a config file per VM -# - creation of hdd image -# - import iso, kernel, initrd from existing vm +# - DONE: creation of hdd image +# - DONE: delete a VM +# - DONE: import iso, kernel, initrd from existing vm +# - when no vm is specified, apply command to last one # - script install from CDROM iso: +# - patch alpine setup-disk # - setup system, including static IP address # - setup user account from host # - setup ssh from host @@ -22,9 +25,9 @@ export LC_ALL=C IFS=' add() { usage 'add [Options] name' 'Add a new VM' && return - while getopts :c:p:s: opt; do + while getopts :c:i:k:p:s: opt; do case $opt in - c|k|p|s) eval "$opt=$OPTARG";; + [cikps]) eval "$opt=$OPTARG";; *) Opth=1 add; exit ;; esac done @@ -32,6 +35,7 @@ add() { [ -d "$dir/$1" ] && die "vm $1 already exists in $dir/$1" init_alpine || die "could not init alpine iso" + [ "$1" = 'alpine-iso' ] && return mkdir -p "$dir/$1" && cd "$dir/$1" || die "add $1 failed" hdd=${p-$1.raw} [ -f "$hdd" ] || dd if=/dev/zero of=$hdd bs=1 count=0 seek=${s-32g} 2>/dev/null @@ -41,11 +45,11 @@ add() { iso=$(getconf "$c" iso) [ "$iso" ] && echo "iso=\"../$c/$iso\"" >> config cp "../$c/vmlinux" "../$c/initrd" . + echo "kernel=${k-vmlinux}" >> config + echo "initrd=initrd" >> config } } -getconf() { awk -F '=' -v k="$2" '$1 == k {print $2}' "$dir/$1/config"; } - console() { usage 'console name' 'Attach a console to a VM' && return [ "$1" ] || die 'console: name is missing' @@ -56,10 +60,39 @@ console() { del() { usage 'del name' 'Delete a VM' && return - echo 'not implemented yet' + case $1 in ''|*/*|.*) die "invalid VM name: $1" ;; esac + [ -d "$dir/$1" ] || die "$dir/$1 not found" + cd "$dir" && rm -r "$1" +} + +die() { [ "$1" ] && echo "$0: $@" >&2; exit 1; } + +edit() { + usage 'edit name' 'Edit a VM configuration' && return + [ -f "$dir/$1/config" ] || die "$dir/$1/config not found" + ${EDITOR-vi} "$dir/$1/config" +} + +exp() { + usage 'exp name' 'experiment on a VM' && return + cd "$dir/$1" || die "invalid VM: $1" + [ -f vftool.pid ] || die "vm $1 is not active" + + screen -X stuff 'root +' + screen -X stuff 'sed -i "s/die..Bootloader/;; #/" /sbin/setup-disk +' + screen -X stuff 'grep BOOTLOADER /sbin/setup-disk +' + } -die() { [ "$1" ] && echo "$@" >&2; exit 1; } +finalize() { + tty=$(vftool_tty) + echo "root\nuname -a" >> "$tty" +} + +getconf() { awk -F '=' -v k="$2" '$1 == k {print $2}' "$dir/$1/config"; } help() { usage 'help' 'Print this help text' && return @@ -90,6 +123,11 @@ vmlinux: $(iso) $(isoinfo) config: $(iso) @echo "iso=$(iso)" >config + @echo "initrd=initrd" >>config + @echo "kernel=vmlinux" >>config + @echo "cpu=1" >> config + @echo "ram=512" >> config + @echo "arg=\"console=hvc0\"" >> config $(iso): curl -LO $(iso_url) || { rm -f $@; false; } @@ -126,17 +164,19 @@ ls() { [ -d "$dir" ] && cd "$dir" || return for i in */; do i=${i%/} + [ "$i" = '*' ] && continue [ -f "$i/vftool.pid" ] && state=active || state=stopped printf "%-20s %s\n" "$i" "$state" done } start() { - usage 'start [-a][-c vm] name' 'Start a VM' && return - while getopts :ac: opt; do + usage 'start [-af][-c vm] name' 'Start a VM' && return + while getopts :ac:f opt; do case $opt in - (a) attach=1 ;; + (a) a=1 ;; (c) from=$OPTARG ;; + (f) f=1 ;; (*) Opth=1 start; exit;; esac done @@ -146,8 +186,9 @@ start() { init_vftool cd "$dir/$1" || die "start $1 failed" [ -f vftool.pid ] && die "Error: process $(cat vftool.pid) is active or $PWD/vftool.pid should be removed" - start_vm & - [ "$attach" ] && sleep 1 && vm console $1 + start_vm & sleep 2 + [ "$f" ] && finalize + [ "$a" ] && vm console $1 } start_vm() ( @@ -157,8 +198,8 @@ start_vm() ( trap 'rm -f vftool.pid' EXIT "$dir/vftool" \ - -k vmlinux \ - -i initrd \ + ${kernel+-k "$kernel"} \ + ${initrd+-i "$initrd"} \ ${hdd+-d "$hdd"} \ ${iso+-c "$iso"} \ ${cpu+-p "$cpu"} \ @@ -167,7 +208,7 @@ start_vm() ( >>vftool.log 2>&1 & sleep 1 echo "$!" >vftool.pid - screen -S "${PWD##*/}" -d -m "$(grep -om 1 '\/dev\/tty.*' vftool.log)" + screen -S "${PWD##*/}" -d -m "$(vftool_tty)" wait ) @@ -186,9 +227,11 @@ version() { echo "$vm_version" } +vftool_tty() { grep -om 1 '\/dev\/tty.*' 'vftool.log'; } + # Main starts here. dir="$HOME/.vm" -Cmdlist='add console del info help ls log start stop version' +Cmdlist='add console del edit exp info help ls log start stop version' [ "$1" ] && C=$1 && shift 1 || { help; exit 1; } for c in $Cmdlist; do case $c in -- cgit v1.2.3 From 73aec290b0f95b7be7ef952b042359bb95b18645 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 26 Mar 2021 10:38:56 +0100 Subject: improve update_hosts --- bin/update_hosts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/update_hosts b/bin/update_hosts index 6444550..793344c 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -1,9 +1,10 @@ -#!/bin/sh -ex +#!/bin/sh -e # Update /etc/hosts with a well curated blacklist of malware, ads, porn, etc. # Custom hosts are preserved. [ "$USER" = root ] || exec sudo "$0" "$@" +echo "last update: $(date -r /etc/hosts)" cd /etc cp -p hosts hosts.old hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) @@ -14,3 +15,4 @@ awk 'BEGIN { hosts = ARGV[1]; ARGV[1] = "" } {print}' "$hosts" > hosts.new mv hosts.new hosts [ "$(uname -s)" != Darwin ] || dscacheutil -flushcache +diff -u /etc/hosts.old /etc/hosts | diffstat -- cgit v1.2.3 From 9734e798057795f89a7bd0a0d933745f0d249b2f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 26 Mar 2021 12:01:52 +0100 Subject: improve update_hosts --- bin/update_hosts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/update_hosts b/bin/update_hosts index 793344c..8d148a6 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -3,8 +3,18 @@ # Update /etc/hosts with a well curated blacklist of malware, ads, porn, etc. # Custom hosts are preserved. + [ "$USER" = root ] || exec sudo "$0" "$@" -echo "last update: $(date -r /etc/hosts)" + +echo "Check from https://github.com/StevenBlack/hosts" +lsd=$(curl -s "https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1"| jq -r '.[0].commit.committer.date') +echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" +echo "last local update: $(date -r /etc/hosts)" +if [ $(date -j -f "%FT%TZ" "$lsd" +%s) -lt $(date -r /etc/hosts +%s) ]; then + echo "Nothing to do" + exit +fi + cd /etc cp -p hosts hosts.old hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) -- cgit v1.2.3 From a8243acb9f5cabd19cc9df16a15018129e0b225e Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 26 Mar 2021 13:50:43 +0100 Subject: improve update_hosts --- bin/update_hosts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/update_hosts b/bin/update_hosts index 8d148a6..4427cd2 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -10,19 +10,18 @@ echo "Check from https://github.com/StevenBlack/hosts" lsd=$(curl -s "https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1"| jq -r '.[0].commit.committer.date') echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" echo "last local update: $(date -r /etc/hosts)" -if [ $(date -j -f "%FT%TZ" "$lsd" +%s) -lt $(date -r /etc/hosts +%s) ]; then - echo "Nothing to do" - exit -fi +[ $(date -j -f "%FT%TZ" "$lsd" +%s) -lt $(date -r /etc/hosts +%s) ] && echo "Nothing to do" && exit cd /etc cp -p hosts hosts.old hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) -curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | -awk 'BEGIN { hosts = ARGV[1]; ARGV[1] = "" } -/^# Custom host / { print hosts; next } -/^# End of custom host / { next } -{print}' "$hosts" > hosts.new +curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' + BEGIN { hosts = ARGV[1]; ARGV[1] = "" } + /^# Custom host / { print hosts; next } + /^# End of custom host / { next } + { print } +' "$hosts" > hosts.new + mv hosts.new hosts [ "$(uname -s)" != Darwin ] || dscacheutil -flushcache diff -u /etc/hosts.old /etc/hosts | diffstat -- cgit v1.2.3 From ae04cc260d63765fc20a2d7bb21d121986f71445 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 29 Mar 2021 10:26:13 +0200 Subject: update --- .zshrc | 3 +++ bin/icat | 2 ++ bin/vm | 50 +++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/.zshrc b/.zshrc index bd67270..599574e 100644 --- a/.zshrc +++ b/.zshrc @@ -63,3 +63,6 @@ source ~/.zsh-powerline.sh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +# test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" + diff --git a/bin/icat b/bin/icat index 0170513..d363e09 100755 --- a/bin/icat +++ b/bin/icat @@ -2,6 +2,8 @@ # Display images directly in terminal. # 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 terminal size can not be probed. diff --git a/bin/vm b/bin/vm index 11fed61..818d6f8 100755 --- a/bin/vm +++ b/bin/vm @@ -62,7 +62,8 @@ del() { usage 'del name' 'Delete a VM' && return case $1 in ''|*/*|.*) die "invalid VM name: $1" ;; esac [ -d "$dir/$1" ] || die "$dir/$1 not found" - cd "$dir" && rm -r "$1" + [ -f "$dir/$1/vftool.pid" ] && die "vm $1 is still active, stop it first" + rm -rf "$dir/$1" } die() { [ "$1" ] && echo "$0: $@" >&2; exit 1; } @@ -78,13 +79,48 @@ exp() { cd "$dir/$1" || die "invalid VM: $1" [ -f vftool.pid ] || die "vm $1 is not active" - screen -X stuff 'root + sleep 1 && screen -X stuff 'root ' - screen -X stuff 'sed -i "s/die..Bootloader/;; #/" /sbin/setup-disk + sleep 1 && screen -X stuff 'sed -i.bak "s/die..Bootloader/;; # die \"Bootloader/" /sbin/setup-disk ' - screen -X stuff 'grep BOOTLOADER /sbin/setup-disk + sleep 1 && screen -X stuff 'setup-alpine -e +' + sleep 1 && screen -X stuff 'none +' + sleep 1 && screen -X stuff "$1 +" + sleep 1 && screen -X stuff 'eth0 +' + sleep 1 && screen -X stuff '192.168.64.2 +' + sleep 1 && screen -X stuff '255.255.255.0 +' + sleep 1 && screen -X stuff '192.168.64.1 +' + sleep 1 && screen -X stuff 'n +' + sleep 3 && screen -X stuff ' +' + sleep 1 && screen -X stuff '192.168.64.1 +' + sleep 1 && screen -X stuff 'Europe/Paris +' + sleep 5 && screen -X stuff 'none +' + sleep 1 && screen -X stuff 'chrony +' + sleep 5 && screen -X stuff '1 +' + sleep 1 && screen -X stuff 'openssh +' + sleep 5 && screen -X stuff 'vda +' + sleep 3 && screen -X stuff 'sys +' + sleep 1 && screen -X stuff 'y +' + sleep 20 && screen -X stuff 'cat /etc/fstab ' - } finalize() { @@ -109,7 +145,7 @@ info() { alpine_makefile='# Generated by "vm". DO NOT EDIT. # Check https://alpinelinux.org/downloads for possible upgrades -iso_url = https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-virt-3.13.2-aarch64.iso +iso_url = https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/aarch64/alpine-virt-3.13.3-aarch64.iso iso = $(notdir $(iso_url)) isoinfo ?= /opt/homebrew/bin/isoinfo @@ -204,7 +240,7 @@ start_vm() ( ${iso+-c "$iso"} \ ${cpu+-p "$cpu"} \ ${ram+-m "$ram"} \ - ${arg+-m "$arg"} \ + -a "${arg-console=hvc0}" \ >>vftool.log 2>&1 & sleep 1 echo "$!" >vftool.pid -- cgit v1.2.3 From 3f9cb5afb3b6ee2d4234d5e4d3e5398cf022bc41 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 10 Apr 2021 14:15:57 +0200 Subject: update vm --- bin/vm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/vm b/bin/vm index 818d6f8..19255d2 100755 --- a/bin/vm +++ b/bin/vm @@ -47,6 +47,9 @@ add() { cp "../$c/vmlinux" "../$c/initrd" . echo "kernel=${k-vmlinux}" >> config echo "initrd=initrd" >> config + echo "cpu=1" >> config + echo "ram=512" >> config + echo "arg=\"console=hvc0\"" >> config } } @@ -119,7 +122,7 @@ exp() { ' sleep 1 && screen -X stuff 'y ' - sleep 20 && screen -X stuff 'cat /etc/fstab + sleep 20 && screen -X stuff 'blkid /dev/vda3 ' } @@ -253,7 +256,7 @@ stop() { [ "$1" ] || die 'stop: name missing' cd "$dir/$1" || die 'stop $1 failed' [ -f vftool.pid ] || die "stop: vm $1 is not active" - kill $(cat vftool.pid) + kill $(cat vftool.pid) || rm -f vftool.pid } usage() { [ "$Opth" ] && printf " %-34s %s\n" "$1" "$2"; } -- cgit v1.2.3 From 6962b31552fbf1a2516b0777cc4a52d99a76f6f2 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 5 May 2021 20:32:05 +0200 Subject: update --- .bash-powerline.sh | 12 ++++++------ .bashrc | 55 +++++++++++++++++++++++++++++++----------------------- .profile | 4 +++- .tmux.conf | 3 --- .vimrc | 4 +++- .zshrc | 3 +++ bin/update_hosts | 1 - 7 files changed, 47 insertions(+), 35 deletions(-) delete mode 100644 .tmux.conf diff --git a/.bash-powerline.sh b/.bash-powerline.sh index 626157a..f87eadb 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -9,8 +9,8 @@ __powerline() { readonly COLOR_CWD='\[\033[0;34m\]' # blue readonly COLOR_GIT='\[\033[0;36m\]' # cyan #readonly COLOR_SUCCESS='\[\033[0;32m\]' # green - readonly COLOR_SUCCESS='\[\033[0;1;34m\]' # blue, bold - readonly COLOR_FAILURE='\[\033[0;1;31m\]' # red, bold + readonly COLOR_SUCCESS='\[\033[0;34m\]' # blue + readonly COLOR_FAILURE='\[\033[0;31m\]' # red #readonly SYMBOL_GIT_BRANCH='⑂' readonly SYMBOL_GIT_BRANCH='→' @@ -26,7 +26,7 @@ __powerline() { host=$(hostname) fi - [ "$PS_SYMBOL" ] || PS_SYMBOL=';' + [ "$PS_SYMBOL" ] || PS_SYMBOL='$' __git_info() { [[ $POWERLINE_GIT = 0 ]] && return # disabled @@ -67,9 +67,9 @@ __powerline() { # Check the exit code of the previous command and display different # colors in the prompt accordingly. if [ $? -eq 0 ]; then - local symbol="$COLOR_SUCCESS$PS_SYMBOL $RESET" + local symbol="$COLOR_SUCCESS $PS_SYMBOL $RESET" else - local symbol="$COLOR_FAILURE$PS_SYMBOL $RESET" + local symbol="$COLOR_FAILURE $PS_SYMBOL $RESET" fi local cwd="$COLOR_CWD\w$RESET" @@ -86,7 +86,7 @@ __powerline() { local git="$COLOR_GIT$(__git_info)$RESET" fi - [ "$SSH_TTY" ] && PS1=": $host:$cwd$git$symbol" || PS1=": $cwd$git$symbol" + [ "$SSH_TTY" ] && PS1="$host:$cwd$git$symbol" || PS1="$cwd$git$symbol" } PROMPT_DIRTRIM=1 diff --git a/.bashrc b/.bashrc index 95f2377..fca1532 100644 --- a/.bashrc +++ b/.bashrc @@ -40,41 +40,41 @@ 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 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 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' @@ -85,6 +85,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 @@ -107,6 +110,12 @@ 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' @@ -117,19 +126,19 @@ meteo() { # fzf # 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}" +#export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" -[ -f ~/.fzf.bash ] && source ~/.fzf.bash +#[ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/.profile b/.profile index acb8299..78b4393 100644 --- a/.profile +++ b/.profile @@ -1,6 +1,6 @@ # ~/.profile -PATH=~/bin:$PATH:~/go/bin +PATH=~/bin:/opt/homebrew/bin:$PATH:~/go/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/.vimrc b/.vimrc index 9f5b410..6b26f67 100644 --- a/.vimrc +++ b/.vimrc @@ -25,7 +25,9 @@ autocmd filetype vimki nnoremap - YpVr- 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 b (go-build) diff --git a/.zshrc b/.zshrc index 599574e..fc3b9f9 100644 --- a/.zshrc +++ b/.zshrc @@ -1,5 +1,8 @@ # Environment export YAEGI_DOT_CMD='dotty -' +export YAEGI_UNSAFE=1 +export YAEGI_UNRESTRICTED=1 +export YAEGI_SYSCALL=1 # gnuplot display in terminal export GNUTERM='sixelgd enhanced truecolor font "arial,9"' diff --git a/bin/update_hosts b/bin/update_hosts index 4427cd2..75c41d1 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -3,7 +3,6 @@ # Update /etc/hosts with a well curated blacklist of malware, ads, porn, etc. # Custom hosts are preserved. - [ "$USER" = root ] || exec sudo "$0" "$@" echo "Check from https://github.com/StevenBlack/hosts" -- cgit v1.2.3 From ebfa4aaf6afe44ffcc15261d8333c861c62ae27d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 9 May 2021 16:59:33 +0200 Subject: add gemini --- bin/gemini | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100755 bin/gemini diff --git a/bin/gemini b/bin/gemini new file mode 100755 index 0000000..1bc3d57 --- /dev/null +++ b/bin/gemini @@ -0,0 +1,132 @@ +#!/usr/bin/env yaegi +package main + +import ( + "bufio" + "crypto/tls" + "fmt" + "io/ioutil" + "net/url" + "os" + "strconv" + "strings" +) + +func main() { + stdinReader := bufio.NewReader(os.Stdin) + var u string // URL + links := make([]string, 0, 100) + history := make([]string, 0, 100) + for { + fmt.Print("> ") + cmd, _ := stdinReader.ReadString('\n') + cmd = strings.TrimSpace(cmd) + // Command dispatch + switch strings.ToLower(cmd) { + case "": // Nothing + continue + case "q": // Quit + fmt.Println("Bye!") + os.Exit(0) + case "b": // Back + if len(history) < 2 { + fmt.Println("No history yet!") + continue + } + u = history[len(history)-2] + history = history[0 : len(history)-2] + default: + index, err := strconv.Atoi(cmd) + if err != nil { + // Treat this as a URL + u = cmd + if !strings.HasPrefix(u, "gemini://") { + u = "gemini://" + u + } + } else { + // Treat this as a menu lookup + u = links[index-1] + } + } + // Parse URL + parsed, err := url.Parse(u) + if err != nil { + fmt.Println("Error parsing URL!") + continue + } + // Connect to server + conn, err := tls.Dial("tcp", parsed.Host+":1965", &tls.Config{InsecureSkipVerify: true}) + if err != nil { + fmt.Println("Failed to connect: " + err.Error()) + continue + } + defer conn.Close() + // Send request + conn.Write([]byte(u + "\r\n")) + // Receive and parse response header + reader := bufio.NewReader(conn) + responseHeader, err := reader.ReadString('\n') + parts := strings.Fields(responseHeader) + status, err := strconv.Atoi(parts[0][0:1]) + meta := parts[1] + // Switch on status code + switch status { + case 1, 3, 6: + // No input, redirects or client certs + fmt.Println("Unsupported feature!") + case 2: + // Successful transaction + // text/* content only + if !strings.HasPrefix(meta, "text/") { + fmt.Println("Unsupported type " + meta) + continue + } + // Read everything + bodyBytes, err := ioutil.ReadAll(reader) + if err != nil { + fmt.Println("Error reading body") + continue + } + body := string(bodyBytes) + if meta == "text/gemini" { + // Handle Gemini map + links = make([]string, 0, 100) + preformatted := false + for _, line := range strings.Split(body, "\n") { + if strings.HasPrefix(line, "```") { + preformatted = !preformatted + } else if preformatted { + fmt.Println(line) + } else if strings.HasPrefix(line, "=>") { + line = line[2:] + bits := strings.Fields(line) + parsedLink, err := url.Parse(bits[0]) + if err != nil { + continue + } + link := parsed.ResolveReference(parsedLink).String() + var label string + if len(bits) == 1 { + label = link + } else { + label = strings.Join(bits[1:], " ") + } + links = append(links, link) + fmt.Printf("[%d] %s\n", len(links), label) + } else { + // This should really be wrapped, but there's + // no easy support for this in Go's standard + // library + fmt.Println(line) + } + } + } else { + // Just print any other kind of text + fmt.Print(body) + } + history = append(history, u) + case 4, 5: + fmt.Println("ERROR: " + meta) + } + } +} -- cgit v1.2.3 From 547f1550666700a087acb13f1cc3ef010bbb78fc Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 15 May 2021 18:11:23 +0200 Subject: fvwm is back --- .Xresources | 9 +- .config/i3/config | 1 + .fvwm2rc | 340 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ .xinitrc | 4 +- .xsession | 4 +- bin/wol | 6 + bin/xt | 1 + 7 files changed, 357 insertions(+), 8 deletions(-) create mode 100644 .fvwm2rc create mode 100755 bin/wol diff --git a/.Xresources b/.Xresources index b1c3e3d..7ca66a3 100644 --- a/.Xresources +++ b/.Xresources @@ -7,9 +7,10 @@ URxvt.colorBD: blue3 URxvt.colorUL: magenta3 URxvt.cursorColor: red ! URxvt.color12: rgb:5c/5c/ff -!URxvt.font: xft:Mono:size=12 -!URxvt.letterSpace: -1 Urxvt.font: 6x13 +!URxvt.font: xft:Mono:size=12 +!URxvt.font: xft:Mono:size=10 +URxvt.letterSpace: -1 URxvt.perl-ext-common: font-size URxvt.keysym.C-Prior: font-size:increase URxvt.keysym.C-Next: font-size:decrease @@ -20,8 +21,8 @@ xterm*termName: xterm-256color xterm*VT100.Translations: #override \ Ctrl Next: smaller-vt-font() \n\ Ctrl Prior: larger-vt-font() \n -xterm*faceName: DejaVu Sans Mono -xterm*faceSize: 10 +!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/.config/i3/config b/.config/i3/config index 48c461c..a1de2b3 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -87,6 +87,7 @@ for_window [class="vlc"] floating enable for_window [instance="wish"] floating enable for_window [class="wpa_gui"] floating enable for_window [class="XVroot"] floating enable +#for_window [class="XTerm"] floating enable for_window [class="zoom"] floating enable bindsym button3 floating toggle diff --git a/.fvwm2rc b/.fvwm2rc new file mode 100644 index 0000000..fac2b23 --- /dev/null +++ b/.fvwm2rc @@ -0,0 +1,340 @@ +HilightColor black IndianRed +WindowFont fixed +IconFont fixed +MenuStyle black grey76 grey30 fixed fvwm +IgnoreModifiers 2 + +#Style "*" SloppyFocus +Style "*" MouseFocusClickRaises +Style "*" ForeColor black +Style "*" BackColor SteelBlue +Style "*" IconBox 800x64+0-0 +Style "*" MWMFunctions, MWMButtons, MWMBorder, MWMDecor, DecorateTransient, StickyIcon +Style "*" RandomPlacement + +OpaqueMoveSize 0 +#EdgeScroll 100 100 +#EdgeScroll 100000 100000 +EdgeScroll 0 0 +EdgeResistance 100000 100000 +#style "*" EdgeMoveResistance 100000 100 + +DeskTopSize 2x2 + +#ImagePath /usr/X11R6/include/X11/pixmaps/ +#ImagePath /usr/share/pixmaps/ + +Style "*" BorderWidth 4, HandleWidth 4 +Style "Fvwm*" NoTitle, Sticky, WindowListSkip +Style "*Pager" NoHandles, BorderWidth 0, WindowListSkip, CirculateSkip +Style "FvwmBanner" StaysOnTop +Style "FvwmButtons" NoTitle, NoHandles, Sticky, WindowListSkip,BorderWidth 4 +Style "*lock" NoTitle, NoHandles, WindowListSkip +Style "gkrellm" NoTitle, Sticky, WindowListSkip, CirculateSkip +#Style "*unknown*" NoTitle, BorderWidth 0, NoHandles, WindowListSkip + +#Style "rxvt" Icon Monitor.xpm +#Style "xterm" Icon Monitor.xpm +#Style "uxterm" Icon Monitor.xpm + +#========================================================================# +# Stuff to do at start-up +# + +AddToFunc "StartFunction" ++ "I" Module FvwmPager 0 0 ++ "I" Exec dunst +#+ "I" Exec xsetroot -solid rgb:3/4/5 +#+ "I" Exec setxkbmap fr +#+ "I" Exec synclient VertScrollDelta=-114 + +#========================================================================# +# Now define some handy complex functions +# +AddToFunc "Move-or-Raise" "M" Move ++ "M" Raise ++ "C" Raise ++ "D" Maximize 100 100 + +AddToFunc "Move-or-Lower" "M" Move ++ "M" Lower ++ "C" Lower ++ "D" RaiseLower + +AddToFunc "Move-or-Iconify" "M" Move ++ "D" Iconify + +AddToFunc "Resize-or-Raise" "M" Resize ++ "M" Raise ++ "C" Raise ++ "D" RaiseLower + +AddToFunc "Focus-and-Raise" I Focus ++ I Iconify false ++ I Raise ++ I WarpToWindow 50 8p + +#========================================================================# +DestroyMenu "Quit-Verify" +AddToMenu "Quit-Verify" +#+ "&Lock screen" Exec exec vlock -an ++ "&Fvwm restart" Restart +#+ "&Lock screen" Exec exec slock sudo sh -c "echo mem > /sys/power/state" ++ "&Quit X11" Quit ++ "&Suspend" Exec exec slock sudo sh -c "echo mem > /sys/power/state" +#+ "&Suspend" Exec exec suspend ++ "&Reboot" Exec exec sudo /sbin/reboot ++ "&Power off" Exec exec sudo /sbin/poweroff + +DestroyMenu "Module-Popup" +AddToMenu "Module-Popup" ++ "Debug" Module FvwmDebug ++ "Identify" Module FvwmIdent ++ "Window List" Module FvwmWinList + +DestroyMenu "Desktop-Apps" +AddToMenu "Desktop-Apps" ++ "&Brave" Exec exec brave ++ "&Chromium" Exec exec chromium ++ "&Discord" Exec exec discord ++ "&Firefox" Exec exec firefox ++ "&LibreOffice" Exec exec libreoffice ++ "&Keybase" Exec exec keybase-gui ++ "S&ignal" Exec exec signal-desktop ++ "&Slack" Exec exec slack ++ "&Zoom" Exec exec zoom + +DestroyMenu "Settings" +AddToMenu "Settings" ++ "&Display" Exec exec arandr ++ "&Keyboard" Exec exec setxkbmap fr ++ "&Power" Exec exec sudo xt -e powertop ++ "&Sound" Exec exec pavucontrol ++ "&Wifi" Exec exec sudo wpa_gui -i wlo1 + +DestroyMenu "Multimedia" +AddToMenu "Multimedia" ++ "&Geeqie" Exec exec geeqie ++ "&Molotov" Exec exec molotov ++ "&Spotify" Exec exec spotify ++ "&Vlc" Exec exec vlc + +DestroyMenu "Utilities" +AddToMenu "Utilities" +#+ "&Xterm" Exec exec uxterm -sl 500 -j -ls -cr red +#+ "&Top" Exec exec uxterm -T Top -n Top -e top +#+ "&Xterm" Exec exec urxvtc +sb -sl 500 -j -ls -cr red ++ "&Xterm" Exec exec xt ++ "&Black Xterm" Exec exec bxt ++ "&Top" Exec exec xt -T Top -n Top -e /bin/top ++ "&Web" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache +#+ "&Web" Exec exec brave +#+ "&Firefox" Exec exec firefox +#+ "&Chromium" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache ++ "&Mail" Exec exec thunderbird +#+ "xclipboard" Exec exec xclipboard +#+ "" Nop ++ "" Nop ++ "&System" Popup Settings ++ "&Desktop" Popup Desktop-Apps ++ "M&ultimedia" Popup Multimedia ++ "ssh bip" Exec exec uxterm -j -sl 500 -cr red -e mosh bip +#+ "ssh dev.ugrid.net" Exec exec uxterm -j -sl 500 -cr red -e ssh dev.ugrid.net ++ "" Nop ++ "&Quit" Popup Quit-Verify + +# Define the most common window operations +DestroyMenu "Window Ops" +AddToMenu "Window Ops" ++ "&Move Alt+F5" Function Move-or-Raise ++ "&Resize Alt+F6" Function Resize-or-Raise ++ "R&aise" Raise ++ "&Lower" Lower ++ "(De)Iconify" Iconify ++ "(Un)Stick" Stick ++ "(Un)Maximize Alt+F12" Function maximize_func ++ "" Nop ++ "&Kill" Destroy ++ "&Close" Delete ++ "" Nop ++ "Switch to..." WindowList ++ "Refresh Screen" Refresh + +# +# A trimmed down version of "Window Ops", good for binding to decorations +# +AddToMenu "Window-Ops2" "&Move Alt+F5" Move-or-Raise ++ "&Size Alt+F6" Resize-or-Raise ++ "Mi&nimize Alt+F4" Iconify 1 ++ "&Horizontal Max Alt+F10" Maximize 100 0 ++ "&Vertical Max Alt+F11" Maximize 0 100 ++ "Ma&ximize Alt+F12" Maximize 100 100 ++ "" Nop ++ "&Kill" Destroy ++ "&Close" Delete + +#========================================================================# +# +# One more complex function - couldn't be defined earlier because it used +# pop-up menus +# +# This creates the "system" menu for the title-bar window-ops +# pop-up +# +AddToFunc "window_ops_func" "C" PopUp Window-Ops2 ++ "M" PopUp Window-Ops2 ++ "D" Delete + +#========================================================================# +# +# Mouse bindings +# + +# First, for the mouse in the root window +# Button 1 gives the Utilities menu +# Button 2 gives the Window Ops menu +# Button 3 gives the WindowList (like TwmWindows) +# I use the AnyModifier (A) option for the modifier field, so you can hold down +# any shift-control-whatever combination you want! + +# Button Context Modifi Function +Mouse 1 R A Menu "Utilities" Nop +Mouse 2 R A Menu "Window Ops" Nop +Mouse 3 R A WindowList + +# Now the title bar buttons +# Any button in the left title-bar button gives the window ops menu +# Any button in the first right title-bar button Iconifies the window +# Any button in the second title-bar button full-maximizes +# Note the use of "Mouse 0" for AnyButton. + +# Button Context Modif Function +Mouse 0 1 A Function "window_ops_func" +Mouse 0 2 A Maximize 100 100 +Mouse 0 4 A Iconify + +# Now the rest of the frame +# Here I invoke my complex functions for Move-or-lower, Move-or-raise, +# and Resize-or-Raise. +# +# Button 1 in the corner/sides pieces, with any modifiers, gives resize or raise +Mouse 1 FS A Function "Resize-or-Raise" +# Button 1 in the title, or icon, w/ any modifiers, gives move or raise +Mouse 1 T A Function "Move-or-Raise" + +# Button 1 in an icons gives move for a drag, de-iconify for a double-click, +# nothing for a single click +# Button 2 in an icon, w/ any modifiers, gives de-iconify +Mouse 1 I A Function "Move-or-Iconify" +Mouse 2 I A Iconify + +# Button 2 in the corners, sides, or title-bar gives the window ops menu +Mouse 2 FST A Function "window_ops_func" + +# Button 3 anywhere in the decoration (except the title-bar buttons) +# does a raise-lower +Mouse 3 TSIF A RaiseLower + +# Button 3 in the window, with the Modifier-1 key (usually alt or diamond) +# gives Raise-Lower. Used to use control here, but that interferes with xterm +Mouse 3 W M RaiseLower + +#========================================================================# +# Now some keyboard shortcuts. +# Arrow Keys, wrap mode enabled +# press arrow + control anywhere, and scroll by 1 page +Key Left A C Scroll -100000 0 +Key Right A C Scroll +100000 +0 +Key Up A C Scroll +0 -100000 +Key Down A C Scroll +0 +100000 + +#Key Left A C Scroll -100 0 +#Key Right A C Scroll +100 +0 +#Key Up A C Scroll +0 -100 +#Key Down A C Scroll +0 +100 +# +# press arrow + meta key, and scroll by 1/10 of a page +#Key Left A M Scroll -10 +0 +#Key Right A M Scroll +10 +0 +#Key Up A M Scroll +0 -10 +#Key Down A M Scroll +0 +10 + +# press shift arrow + control anywhere, and move the pointer by 1% of a page +Key Left A SC CursorMove -1 0 +Key Right A SC CursorMove +1 +0 +Key Up A SC CursorMove +0 -1 +Key Down A SC CursorMove +0 +1 + +# press shift arrow + meta key, and move the pointer by 1/10 of a page +Key Left A SM CursorMove -10 +0 +Key Right A SM CursorMove +10 +0 +Key Up A SM CursorMove +0 -10 +Key Down A SM CursorMove +0 +10 + +# Keyboard accelerators +Key Super_L A A Popup "Utilities" +Key F1 A M Popup "Utilities" +Key F2 A M Popup "Window Ops" +Key F3 A M Module "WindowList" FvwmWinList +Key F4 A M Iconify +Key F5 A M Move +Key F6 A M Resize +Key F7 A M RaiseLower +#Key F8 A M Exec exec xbacklight +10 +Key F9 A M Close +Key F10 A M Maximize 100 0 +Key F11 A M Maximize 0 100 +Key F12 A M Maximize + +#Key XF86MonBrightnessDown A A Exec exec xbacklight -10 +#Key XF86MonBrightnessUp A A Exec exec xbacklight +10 +Key XF86AudioRaiseVolume A A Exec exec amixer set Master 5%+ +Key XF86AudioLowerVolume A A Exec exec amixer set Master 5%- +Key XF86AudioMute A A Exec exec amixer set Master toggle + +#Page Up/Dapge Down keys are used to scroll by one desktop page +# in any context, press page up/down + control +# in root context, just pressing page up/down is OK +# +# I prefer the non-wrapping scroll. These are for example purposes only +#Key Next A C Scroll 100000 0 +#Key Next R N Scroll 100000 0 +#Key Prior A C Scroll -100000 0 +#Key Prior R N Scroll -100000 0 + +#Key Tab A M Prev Focus +#Key Tab A MS Next Focus +Key Tab A M Prev Focus-and-Raise +Key Tab A MS Next Focus-and-Raise + +Key Escape A C WindowList + + +#========================================================================# + +# Definitions used by the modules + +#------------------ Pager +*FvwmPagerBack grey60 +*FvwmPagerFore black +#*FvwmPagerFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-* +*FvwmPagerFont fixed +*FvwmPagerHilight #c3c3c3 +*FvwmPagerGeometry 80x60-1-1 +*FvwmPagerLabel 0 "swift" +*FvwmPagerSmallFont 5x8 + +#------------------ Identify +*FvwmIdentBack #000080 +*FvwmIdentFore Yellow +*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-* + +#------------------ FvwmWinList +*FvwmWinListBack #c3c3c3 +*FvwmWinListFore Black +*FvwmWinListFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-* +*FvwmWinListAction Click1 Iconify -1,Focus +*FvwmWinListAction Click2 Iconify +*FvwmWinListAction Click3 Module "FvwmIdent" FvwmIdent +*FvwmWinListUseSkipList +*FvwmWinListGeometry +0-1 diff --git a/.xinitrc b/.xinitrc index f982ca7..92f75e1 100644 --- a/.xinitrc +++ b/.xinitrc @@ -20,5 +20,5 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -#exec fvwm -exec i3 +exec fvwm +#exec i3 diff --git a/.xsession b/.xsession index f982ca7..92f75e1 100755 --- a/.xsession +++ b/.xsession @@ -20,5 +20,5 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -#exec fvwm -exec i3 +exec fvwm +#exec i3 diff --git a/bin/wol b/bin/wol new file mode 100755 index 0000000..146e46a --- /dev/null +++ b/bin/wol @@ -0,0 +1,6 @@ +#!/bin/sh -x +ip_plex=192.168.1.90 mac_plex=b0:83:fe:61:a7:aa +eval "mac=\$mac_$1 ip=\$ip_$1" +wakeonlan "$mac" +#ping -o "$ip" +ssh "root@$ip" diff --git a/bin/xt b/bin/xt index 71b92d3..f14954c 100755 --- a/bin/xt +++ b/bin/xt @@ -1,4 +1,5 @@ #!/bin/sh exec xterm -sl 500 -j -cr red "$@" & #cmd="urxvtc ${@:--T $HOSTNAME}" +#cmd="urxvtc $@" #eval "$cmd" || { [ $? = 2 ] && urxvtd -q -o -f && eval "$cmd"; } -- cgit v1.2.3 From 67efb5857e720ebbe323ea7284793c43f27b0f67 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 29 May 2021 18:16:42 +0200 Subject: update --- .bash-powerline.sh | 12 ++--- bin/md | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 6 deletions(-) create mode 100755 bin/md diff --git a/.bash-powerline.sh b/.bash-powerline.sh index f87eadb..626157a 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -9,8 +9,8 @@ __powerline() { readonly COLOR_CWD='\[\033[0;34m\]' # blue readonly COLOR_GIT='\[\033[0;36m\]' # cyan #readonly COLOR_SUCCESS='\[\033[0;32m\]' # green - readonly COLOR_SUCCESS='\[\033[0;34m\]' # blue - readonly COLOR_FAILURE='\[\033[0;31m\]' # red + readonly COLOR_SUCCESS='\[\033[0;1;34m\]' # blue, bold + readonly COLOR_FAILURE='\[\033[0;1;31m\]' # red, bold #readonly SYMBOL_GIT_BRANCH='⑂' readonly SYMBOL_GIT_BRANCH='→' @@ -26,7 +26,7 @@ __powerline() { host=$(hostname) fi - [ "$PS_SYMBOL" ] || PS_SYMBOL='$' + [ "$PS_SYMBOL" ] || PS_SYMBOL=';' __git_info() { [[ $POWERLINE_GIT = 0 ]] && return # disabled @@ -67,9 +67,9 @@ __powerline() { # Check the exit code of the previous command and display different # colors in the prompt accordingly. if [ $? -eq 0 ]; then - local symbol="$COLOR_SUCCESS $PS_SYMBOL $RESET" + local symbol="$COLOR_SUCCESS$PS_SYMBOL $RESET" else - local symbol="$COLOR_FAILURE $PS_SYMBOL $RESET" + local symbol="$COLOR_FAILURE$PS_SYMBOL $RESET" fi local cwd="$COLOR_CWD\w$RESET" @@ -86,7 +86,7 @@ __powerline() { local git="$COLOR_GIT$(__git_info)$RESET" fi - [ "$SSH_TTY" ] && PS1="$host:$cwd$git$symbol" || PS1="$cwd$git$symbol" + [ "$SSH_TTY" ] && PS1=": $host:$cwd$git$symbol" || PS1=": $cwd$git$symbol" } PROMPT_DIRTRIM=1 diff --git a/bin/md b/bin/md new file mode 100755 index 0000000..ca08090 --- /dev/null +++ b/bin/md @@ -0,0 +1,136 @@ +#!/bin/sh + +# See https://spec.commonmark.org for reference +md2html() { + awk ' + function newblock(nb) { + if (text) print "<" block ">" text "" + text = "" + block = nb ? nb : "p" + } + + function subinline(tgl, inl) { + while (match($0, tgl)) { + if (inline[ni] == inl) + ni -= sub(tgl, "") + else if (sub(tgl, "<" inl ">")) + inline[++ni] = inl + } + } + + function dolink(href, lnk) { + # Undo escaped html in uris + gsub(/&/, "\\&", href) + gsub(/</, "<", href) + gsub(/>/, ">", href) + # & can be tricky, and not standard: + gsub(/&/, "\\\\\\&", href) + gsub(/&/, "\\\\\\&", lnk) + return "" lnk "" + } + + BEGIN { ni = 0; nl = 0; text = ""; block = "p" } + + # Escape html + esc != "false" { gsub("&", "\\&"); gsub("<", "\\<"); gsub(">", "\\>") } + + # Horizontal rules (_ is not in markdown) + /^[ ]*([-*_] ?)+[ ]*$/ && text == "" { print "
"; next } + + # Tables (not in markdown) + # Syntax: + # Right Align| Center Align |Left Align + /([ ]\|)|(\|[ ])/ { + if (block != "table") newblock("table") + nc = split($0, cells, "|") + $0 = "\n" + for (i = 1; i <= nc; i++) { + align = "left" + if (sub(/^[ ]+/, "", cells[i])) { + if (sub(/[ ]+$/, "", cells[i])) + align = "center" + else + align = "right" + } + sub(/[ ]+$/, "", cells[i]) + $0 = $0 "" cells[i] "\n" + } + $0 = $0 "" + } + + # Ordered and unordered (possibly nested) lists + /^[ ]*([*+-]|(([0-9]+[\.-]?)+))[ ]/ { + newblock("li") + nnl = 1 + while (match($0, /^[ ]/)) { sub(/^[ ]/,""); nnl++ } + while (nl > nnl) print "" + while (nl < nnl) { + list[++nl] = "ol" + if (match($0, /^[*+-]/)) list[nl] = "ul" + print "<" list[nl] ">" + } + sub(/^([*+-]|(([0-9]+[\.-]?)+))[ ]/,"") + } + + # Multi line list items + block == "li" { sub(/^( *)|( *)/,"") } + + # Code blocks + /^( | )/ { + if (block != "code") newblock("code") + sub(/^( | )/, "") + text = text $0 "\n" + next + } + + # Paragraph + /^$/ { newblock(); while(nl > 0) print "" } + + # Setex-style Headers (plus h3 with underscores) + /^=+$/ { block = "h" 1; next } + /^-+$/ { block = "h" 2; next } + /^_+$/ { block = "h" 3; next } + + # Atx-style headers + /^#/ { + newblock() + match($0, /#+/) + n = RLENGTH + if (n > 6) n = 6 + sub(/# */, "#") + text = substr($0, RLENGTH + 1) + block = "h" n + next + } + + { + # Images + while (match($0, /!\[[^\]]+\]\([^\)]+\)/)) { + split(substr($0, RSTART, RLENGTH), a, /(!\[)|\)|(\]\()/) + sub(/!\[[^\]]+\]\([^\)]+\)/, "\""") + } + # Links + while (match($0, /\[[^\]]+\]\([^\)]+\)/)) { + split(substr($0, RSTART, RLENGTH), a, /[\[\)]|(\]\()/) + sub(/\[[^\]]+\]\([^\)]+\)/, dolink(a[3], a[2])) + } + # Auto links (uri matching is poor) + na = split($0, a, /(^\()|[ ]|([,\.\)]([ ]|$))/) + for (i = 1; i <= na; i++) + if (match(a[i], /^(((https?|ftp|file|news|irc):\/\/)|(mailto:)).+$/)) + sub(a[i], dolink(a[i], a[i])) + # Inline + subinline("(\\*\\*)|(__)", "strong") + subinline("\\*", "em") + subinline("`", "code") + text = text (text ? " " : "") $0 + } + + END { + while(ni > 0) text = text "" + newblock() + while(nl > 0) print "" + }' "$1" +} + +md2html "$1" -- cgit v1.2.3 From 4bd0a72b639662f9a13c7c0adb1b423383c84ef5 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 30 May 2021 12:17:55 +0200 Subject: update --- .bashrc | 2 ++ .profile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index fca1532..c6c7b1e 100644 --- a/.bashrc +++ b/.bashrc @@ -47,6 +47,8 @@ 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' diff --git a/.profile b/.profile index 78b4393..bbf3c42 100644 --- a/.profile +++ b/.profile @@ -1,6 +1,6 @@ # ~/.profile -PATH=~/bin:/opt/homebrew/bin:$PATH:~/go/bin +PATH=~/bin:/opt/homebrew/bin:$PATH:~/go/bin:~/.cargo/bin [ "${SHELL##*/}" = bash ] && . ~/.bashrc -- cgit v1.2.3 From 2dc5563129877c1aad571e2023a7e9cc8eec5d04 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 30 May 2021 19:01:16 +0200 Subject: update --- .bashrc | 5 ++--- bin/vm | 45 +++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.bashrc b/.bashrc index c6c7b1e..b50da1b 100644 --- a/.bashrc +++ b/.bashrc @@ -121,12 +121,13 @@ man() { meteo() { local request="wttr.in/${1-Toulouse}?F&T" [ "$(tput cols)" -lt 125 ] && request+='&n' - curl -H "Accept-Language: ${LANG%_*}" --compressed "$request" + 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" @@ -142,5 +143,3 @@ meteo() { # load Nix config files (aka auto-completion etc.) #export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" - -#[ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/bin/vm b/bin/vm index 19255d2..b0e1303 100755 --- a/bin/vm +++ b/bin/vm @@ -28,7 +28,7 @@ add() { while getopts :c:i:k:p:s: opt; do case $opt in [cikps]) eval "$opt=$OPTARG";; - *) Opth=1 add; exit ;; + *) Opth=1 add "$1"; exit ;; esac done shift $((OPTIND - 1)) @@ -38,25 +38,27 @@ add() { [ "$1" = 'alpine-iso' ] && return mkdir -p "$dir/$1" && cd "$dir/$1" || die "add $1 failed" hdd=${p-$1.raw} - [ -f "$hdd" ] || dd if=/dev/zero of=$hdd bs=1 count=0 seek=${s-32g} 2>/dev/null + [ -f "$hdd" ] || dd if=/dev/zero of="$hdd" bs=1 count=0 seek="${s-32g}" 2>/dev/null echo "hdd=\"$hdd\"" > config [ "$c" ] && { [ -d "../$c" ] || die "invalid directory: $dir/$c" iso=$(getconf "$c" iso) - [ "$iso" ] && echo "iso=\"../$c/$iso\"" >> config cp "../$c/vmlinux" "../$c/initrd" . - echo "kernel=${k-vmlinux}" >> config - echo "initrd=initrd" >> config - echo "cpu=1" >> config - echo "ram=512" >> config - echo "arg=\"console=hvc0\"" >> config + [ "$iso" ] && echo "iso=\"../$c/$iso\"" >> config + cat <<- EOT >> config + kernel=${k-vmlinux} + initrd=initrd + cpu=1 + ram=512 + arg="console=hvc0" + EOT } } console() { usage 'console name' 'Attach a console to a VM' && return [ "$1" ] || die 'console: name is missing' - cd "$dir/$1" || die 'console $1 failed' + cd "$dir/$1" || die "console $1 failed" [ -f vftool.pid ] || die "vm $1 is not active" screen -r "$1" } @@ -66,10 +68,10 @@ del() { case $1 in ''|*/*|.*) die "invalid VM name: $1" ;; esac [ -d "$dir/$1" ] || die "$dir/$1 not found" [ -f "$dir/$1/vftool.pid" ] && die "vm $1 is still active, stop it first" - rm -rf "$dir/$1" + rm -rf "${dir:?}/$1" } -die() { [ "$1" ] && echo "$0: $@" >&2; exit 1; } +die() { [ "$1" ] && echo "$0: $*" >&2; exit 1; } edit() { usage 'edit name' 'Edit a VM configuration' && return @@ -128,14 +130,14 @@ exp() { finalize() { tty=$(vftool_tty) - echo "root\nuname -a" >> "$tty" + printf 'root\nuname -a\n' >> "$tty" } getconf() { awk -F '=' -v k="$2" '$1 == k {print $2}' "$dir/$1/config"; } help() { usage 'help' 'Print this help text' && return - echo "$vm_version\nManage virtual machines\nUsage: vm command [options] [args]" + printf '%s\n' "$vm_version\nManage virtual machines\nUsage: vm command [options] [args]" Opth=1; for c in $Cmdlist; do $c; done } @@ -210,13 +212,12 @@ ls() { } start() { - usage 'start [-af][-c vm] name' 'Start a VM' && return - while getopts :ac:f opt; do + usage 'start [-af] name' 'Start a VM' && return + while getopts :af opt; do case $opt in (a) a=1 ;; - (c) from=$OPTARG ;; (f) f=1 ;; - (*) Opth=1 start; exit;; + (*) Opth=1 start "$1"; exit;; esac done shift $((OPTIND - 1)) @@ -227,7 +228,7 @@ start() { [ -f vftool.pid ] && die "Error: process $(cat vftool.pid) is active or $PWD/vftool.pid should be removed" start_vm & sleep 2 [ "$f" ] && finalize - [ "$a" ] && vm console $1 + [ "$a" ] && vm console "$1" } start_vm() ( @@ -254,9 +255,9 @@ start_vm() ( stop() { usage 'stop name' 'Stop a VM' && return [ "$1" ] || die 'stop: name missing' - cd "$dir/$1" || die 'stop $1 failed' + cd "$dir/$1" || die "stop $1 failed" [ -f vftool.pid ] || die "stop: vm $1 is not active" - kill $(cat vftool.pid) || rm -f vftool.pid + kill "$(cat vftool.pid)" || rm -f vftool.pid } usage() { [ "$Opth" ] && printf " %-34s %s\n" "$1" "$2"; } @@ -274,8 +275,8 @@ Cmdlist='add console del edit exp info help ls log start stop version' [ "$1" ] && C=$1 && shift 1 || { help; exit 1; } for c in $Cmdlist; do case $c in - ($C) cmd=$c; break ;; - ($C*) [ "$cmd" ] && die "ambiguous command $C" || cmd=$c ;; + ("$C") cmd=$c; break ;; + ("$C"*) [ "$cmd" ] && die "ambiguous command $C" || cmd=$c ;; esac done [ "$cmd" ] || { help; exit 1; } && $cmd "$@" -- cgit v1.2.3 From 87b63654a7a881afefddaeb6c3dbbf32105070bb Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 4 Jun 2021 16:43:08 +0200 Subject: update, add fv --- bin/fv | 6 ++++++ bin/update_hosts | 6 +++--- bin/vm | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100755 bin/fv diff --git a/bin/fv b/bin/fv new file mode 100755 index 0000000..5662ed3 --- /dev/null +++ b/bin/fv @@ -0,0 +1,6 @@ +#!/bin/sh +# quick file viewer +#exec fzf --multi --preview-window=right:66% --preview 'cat {1}' +exec fzf --ansi --multi --preview-window=right:75% \ + --bind=left:preview-page-up --bind=right:preview-page-down \ + --preview 'cat {1}' diff --git a/bin/update_hosts b/bin/update_hosts index 75c41d1..e7321bf 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -5,7 +5,7 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -echo "Check from https://github.com/StevenBlack/hosts" +echo "Checking from https://github.com/StevenBlack/hosts:" lsd=$(curl -s "https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1"| jq -r '.[0].commit.committer.date') echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" echo "last local update: $(date -r /etc/hosts)" @@ -14,7 +14,7 @@ echo "last local update: $(date -r /etc/hosts)" cd /etc cp -p hosts hosts.old hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) -curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' +curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' BEGIN { hosts = ARGV[1]; ARGV[1] = "" } /^# Custom host / { print hosts; next } /^# End of custom host / { next } @@ -22,5 +22,5 @@ curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | aw ' "$hosts" > hosts.new mv hosts.new hosts -[ "$(uname -s)" != Darwin ] || dscacheutil -flushcache +[ "$(uname -s)" != Darwin ] || { dscacheutil -flushcache; killall -HUP mDNSResponder; } diff -u /etc/hosts.old /etc/hosts | diffstat diff --git a/bin/vm b/bin/vm index b0e1303..732ba49 100755 --- a/bin/vm +++ b/bin/vm @@ -179,7 +179,7 @@ $(isoinfo): init_alpine() { mkdir -p "$dir/alpine-iso" && cd "$dir/alpine-iso" || die 'init alpine failed' - [ -f 'Makefile' ] || printf "%s" "$alpine_makefile" > Makefile + [ -f 'Makefile' ] || printf '%s' "$alpine_makefile" > Makefile make -s all } -- cgit v1.2.3 From 684561b3c989f8421963c8c5c0cd0f38299551e0 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 5 Jun 2021 17:22:33 +0200 Subject: update --- .vim/pack/mvertes/install.sh | 8 ++++++-- Library/LaunchAgents/local.update_hosts.plist | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 Library/LaunchAgents/local.update_hosts.plist diff --git a/.vim/pack/mvertes/install.sh b/.vim/pack/mvertes/install.sh index 24a52f0..388a620 100755 --- a/.vim/pack/mvertes/install.sh +++ b/.vim/pack/mvertes/install.sh @@ -1,7 +1,11 @@ #!/bin/sh -e -plugins='git@github.com:mvertes/vimki git@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 +' +ht='test -d doc && vim -c "helptags doc" -c "q"' mkdir -p start cd start diff --git a/Library/LaunchAgents/local.update_hosts.plist b/Library/LaunchAgents/local.update_hosts.plist new file mode 100644 index 0000000..c4cf01e --- /dev/null +++ b/Library/LaunchAgents/local.update_hosts.plist @@ -0,0 +1,18 @@ + + + + + Label + local.update_hosts + Program + /Users/marc/bin/update_hosts + StartCalendarInterval + + Hour + 9 + Minute + 0 + + + -- cgit v1.2.3 From 6462de909492c58a8b1061633cec1c325539b3b6 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 11 Jun 2021 00:33:09 +0200 Subject: added migrate_vimki --- bin/migrate_vimki | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 bin/migrate_vimki diff --git a/bin/migrate_vimki b/bin/migrate_vimki new file mode 100755 index 0000000..15242e6 --- /dev/null +++ b/bin/migrate_vimki @@ -0,0 +1,58 @@ +#!/bin/sh + +# Migrate Wiki content from vimki to vimki2 format. + +fixfile() { + awk ' + { + for (i = 1; i <= NR; i++) { + if (match($i, /^[A-Z][A-Z_0-9]*[a-z][a-z0-9]*[_A-Z]/) == 0) continue + s = $i + l = "" + while (match(s, /^[A-Z][A-Z_0-9]*[a-z]+/) != 0) { + l = l substr(s, 1, RLENGTH) " " + s = substr(s, RLENGTH+1) + } + p = match(s, /[^A-Za-z0-9_]/) + if (p != 0) { + s2 = substr(s, 1, p-1) "]" substr(s, p) + s = s2 + } else s = s "]" + l = "[" l s + gsub(/[ \t_]+/, " ", l) + sub(/ *]/, "]", l) + $i = tolower(l) + } + print + } + ' "${1:-HomePage}" +} + +fixname() { + echo "$1" | awk '{ + s = $0 + l = "" + while (match(s, /^[A-Z][A-Z_0-9]*[a-z]+/) != 0) { + l = l substr(s, 1, RLENGTH) " " + s = substr(s, RLENGTH+1) + } + p = match(s, /[^A-Za-z0-9_]/) + if (p != 0) { + s2 = substr(s, 1, p-1) "]" substr(s, p) + s = s2 + } + l = l s + gsub(/[ \t_]+/, " ", l) + sub(/ *$/, "", l) + print tolower(l) + + }' +} + +mkdir -p $HOME/Wiki2 +cd $HOME/Wiki +for file in *; do + new=$(fixname "$file") + echo "$new" + fixfile "$file" > "$HOME/Wiki2/$new" +done -- cgit v1.2.3 From 445652e876c99ea24f7211f356c2a3d2c41d5d09 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 12 Jun 2021 00:24:05 +0200 Subject: update --- .vim/pack/mvertes/install.sh | 1 + .vimrc | 4 ---- Library/LaunchAgents/local.update_hosts.plist | 18 ------------------ 3 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 Library/LaunchAgents/local.update_hosts.plist diff --git a/.vim/pack/mvertes/install.sh b/.vim/pack/mvertes/install.sh index 388a620..48d5950 100755 --- a/.vim/pack/mvertes/install.sh +++ b/.vim/pack/mvertes/install.sh @@ -4,6 +4,7 @@ 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"' diff --git a/.vimrc b/.vimrc index 6b26f67..68ae82a 100644 --- a/.vimrc +++ b/.vimrc @@ -12,15 +12,11 @@ set rtp+=/opt/homebrew/opt/fzf let g:fzf_preview = 'cat {}' " vimki plugin -let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" autocmd filetype vimki syntax on autocmd filetype vimki set autowrite " autocmd filetype vimki setlocal spell spelllang=fr autocmd filetype vimki nmap z :FZF ~/Wiki -autocmd filetype vimki nnoremap = YpVr= -autocmd filetype vimki nnoremap - YpVr- - " vim-go plugin let g:go_def_mode = "gopls" let g:go_info_mode = "gopls" diff --git a/Library/LaunchAgents/local.update_hosts.plist b/Library/LaunchAgents/local.update_hosts.plist deleted file mode 100644 index c4cf01e..0000000 --- a/Library/LaunchAgents/local.update_hosts.plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Label - local.update_hosts - Program - /Users/marc/bin/update_hosts - StartCalendarInterval - - Hour - 9 - Minute - 0 - - - -- cgit v1.2.3 From 2621ec5405f52343cf253d02e307c5b160cf7f04 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 13 Jun 2021 14:49:53 +0200 Subject: update --- bin/update_hosts | 8 ++++---- bin/vimki | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100755 bin/vimki diff --git a/bin/update_hosts b/bin/update_hosts index e7321bf..8550ec3 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -13,11 +13,11 @@ echo "last local update: $(date -r /etc/hosts)" cd /etc cp -p hosts hosts.old -hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) +hosts=$(awk '/^# Custom host/, /^# End of custom host/' hosts.old) curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' - BEGIN { hosts = ARGV[1]; ARGV[1] = "" } - /^# Custom host / { print hosts; next } - /^# End of custom host / { next } + BEGIN { hosts = ARGV[1]; ARGV[1] = "" } + /^# Custom host/ { print hosts; next } + /^# End of custom host/ { next } { print } ' "$hosts" > hosts.new diff --git a/bin/vimki b/bin/vimki new file mode 100755 index 0000000..50ab6ea --- /dev/null +++ b/bin/vimki @@ -0,0 +1,29 @@ +#!/bin/sh + +# Batch operations on vimki + +# rename changes the link name and propagates the change in the wiki +rename1() { + gawk -v old="$1" -v new="$2" -v IGNORECASE=1 ' + { + gsub("[[]" old "[]]", "[" new "]") + print + } + ' "$3" +} + +linkfile() { + echo "$1" + #echo "$1" | tr '[:upper:] àçéèêëîïôèùûü' '[:lower:]_aceeeeiiouuu' +} + +rename() { + for f in *; do + rename1 "$1" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f" + done + oldf="$(linkfile "$1")" + [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2")" +} + +cd ~/Wiki +"$@" -- cgit v1.2.3 From 53569210e7967c6d891affb027c1ea202194f9c0 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 19 Jun 2021 13:00:21 +0200 Subject: vimki: rename handle accents and punctuation --- bin/vimki | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/bin/vimki b/bin/vimki index 50ab6ea..f2ba45b 100755 --- a/bin/vimki +++ b/bin/vimki @@ -5,25 +5,46 @@ # rename changes the link name and propagates the change in the wiki rename1() { gawk -v old="$1" -v new="$2" -v IGNORECASE=1 ' + BEGIN { + rx = old + 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) + } { - gsub("[[]" old "[]]", "[" new "]") + gsub("[[]" rx "[]]", "[" new "]") print } ' "$3" } linkfile() { - echo "$1" - #echo "$1" | tr '[:upper:] àçéèêëîïôèùûü' '[:lower:]_aceeeeiiouuu' + echo "$1" | + tr '[:upper:]' '[:lower:]' | + tr 'åäáàâãçéèêëîíìïôöóõòùûüúÿñ' 'aaaaaaceeeeiiiiooooouuuuyn' | + awk '{gsub(/\W+/, "_"); print}' } rename() { - for f in *; do + for f in *.md; do + [ "$(head -c 8 "$f")" = VimCrypt ] && continue rename1 "$1" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f" done oldf="$(linkfile "$1")" [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2")" } +fixfiles() { + for f in *; do + mv "$f" "$(linkfile "$f")" + done +} + cd ~/Wiki "$@" -- cgit v1.2.3 From 6f40c5ba8549a66bd2b9ab449f57a574f0c2e905 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 19 Jun 2021 15:59:06 +0200 Subject: vimki: fix rename --- bin/vimki | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/vimki b/bin/vimki index f2ba45b..3c6626c 100755 --- a/bin/vimki +++ b/bin/vimki @@ -24,6 +24,8 @@ rename1() { ' "$3" } +#shellcheck disable=SC2020 + linkfile() { echo "$1" | tr '[:upper:]' '[:lower:]' | @@ -36,8 +38,8 @@ rename() { [ "$(head -c 8 "$f")" = VimCrypt ] && continue rename1 "$1" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f" done - oldf="$(linkfile "$1")" - [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2")" + oldf="$(linkfile "$1").md" + [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2").md" } fixfiles() { @@ -46,5 +48,5 @@ fixfiles() { done } -cd ~/Wiki +cd ~/Wiki || exit "$@" -- cgit v1.2.3 From 1433c15716d0da97d54d39f7397b80654ce10415 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 20 Jun 2021 14:33:05 +0200 Subject: vimki: fix rename --- bin/vimki | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bin/vimki b/bin/vimki index 3c6626c..2f64162 100755 --- a/bin/vimki +++ b/bin/vimki @@ -5,8 +5,16 @@ # rename changes the link name and propagates the change in the wiki rename1() { gawk -v old="$1" -v new="$2" -v IGNORECASE=1 ' + { + gsub("[[]" old "[]]", "[" new "]") + print + } + ' "$3" +} + +link2rx() { + gawk -v rx="$1" -v IGNORECASE=1 ' BEGIN { - rx = old gsub(/_/, "\\W+", rx) gsub(/a/, "[aåäáàâã]", rx) gsub(/c/, "[cç]", rx) @@ -16,12 +24,8 @@ rename1() { gsub(/u/, "[uùûüú]", rx) gsub(/y/, "[yÿ]", rx) gsub(/n/, "[nñ]", rx) - } - { - gsub("[[]" rx "[]]", "[" new "]") - print - } - ' "$3" + print rx + }' } #shellcheck disable=SC2020 @@ -34,9 +38,10 @@ linkfile() { } rename() { + rx=$(link2rx "$1") for f in *.md; do [ "$(head -c 8 "$f")" = VimCrypt ] && continue - rename1 "$1" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f" + rename1 "$rx" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f" done oldf="$(linkfile "$1").md" [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2").md" -- cgit v1.2.3 From 0ad6087640b7c6f9bee6e954f0736d9c183f6a5c Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 20 Jun 2021 15:36:38 +0200 Subject: vimki: parallelize rename --- bin/vimki | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/vimki b/bin/vimki index 2f64162..e3e0f4d 100755 --- a/bin/vimki +++ b/bin/vimki @@ -4,12 +4,13 @@ # 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() { @@ -39,10 +40,8 @@ linkfile() { rename() { rx=$(link2rx "$1") - for f in *.md; do - [ "$(head -c 8 "$f")" = VimCrypt ] && continue - rename1 "$rx" "$2" "$f" > "$f.$$" && mv "$f.$$" "$f" - done + # Parallelize renaming + echo *.md | xargs -n 1 -P 8 "$0" rename1 "$rx" "$2" oldf="$(linkfile "$1").md" [ -f "$oldf" ] && mv "$oldf" "$(linkfile "$2").md" } -- cgit v1.2.3 From e70107cb6a2f1fe17b848c43774b4e946749ea23 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 15 Aug 2021 11:26:14 +0200 Subject: update --- .vimrc | 2 +- bin/update_kernel_host | 8 ++++++++ bin/vm | 10 ++++++---- bin/wol | 4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100755 bin/update_kernel_host diff --git a/.vimrc b/.vimrc index 68ae82a..fd1fbbc 100644 --- a/.vimrc +++ b/.vimrc @@ -25,7 +25,7 @@ let g:go_list_type = "quickfix" 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 syntax on autocmd FileType go nmap b (go-build) autocmd FileType go nmap i (go-info) autocmd FileType go nmap r (go-run) diff --git a/bin/update_kernel_host b/bin/update_kernel_host new file mode 100755 index 0000000..6180921 --- /dev/null +++ b/bin/update_kernel_host @@ -0,0 +1,8 @@ +#!/bin/sh -ex + +# After 'apk upgrade', update kernel and initrd on VM host + +sudo cp /boot/initramfs-virt /tmp +sudo chmod a+r /tmp/initramfs-virt +gunzip < /boot/vmlinuz-virt > /tmp/vmlinux +scp /tmp/initramfs-virt /tmp/vmlinux marc@m1:.vm/vm1/ diff --git a/bin/vm b/bin/vm index 732ba49..97e3521 100755 --- a/bin/vm +++ b/bin/vm @@ -212,11 +212,12 @@ ls() { } start() { - usage 'start [-af] name' 'Start a VM' && return - while getopts :af opt; do + usage 'start [-afs] name' 'Start a VM' && return + while getopts :afs opt; do case $opt in (a) a=1 ;; (f) f=1 ;; + (s) s=1 ;; (*) Opth=1 start "$1"; exit;; esac done @@ -227,8 +228,9 @@ start() { cd "$dir/$1" || die "start $1 failed" [ -f vftool.pid ] && die "Error: process $(cat vftool.pid) is active or $PWD/vftool.pid should be removed" start_vm & sleep 2 - [ "$f" ] && finalize - [ "$a" ] && vm console "$1" + ! [ "$f" ] || finalize + ! [ "$a" ] || vm console "$1" + ! [ "$s" ] || exec ssh "$1" } start_vm() ( diff --git a/bin/wol b/bin/wol index 39bce0d..7975df9 100755 --- a/bin/wol +++ b/bin/wol @@ -1,6 +1,6 @@ -#!/bin/sh -x +#!/bin/sh ip_plex=192.168.1.90 mac_plex=b0:83:fe:61:a7:aa eval "mac=\$mac_$1 ip=\$ip_$1" wakeonlan "$mac" -ping -o "$ip" +while ! nc -zw 2 "$ip" 22; do printf .; sleep 2; done ssh "root@$ip" -- cgit v1.2.3 From 0b89577b1e7c46986bed003033d677f2d1ebf9cb Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 15 Aug 2021 11:43:21 +0200 Subject: update --- .config/i3/config | 3 ++- .vimrc | 14 +++++++------- bin/gauth | 3 ++- bin/wol | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index a1de2b3..4a1136a 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -79,8 +79,9 @@ for_window [class="libreoffice"] floating enable for_window [class="llpp"] floating enable for_window [class="MuPDF"] floating enable for_window [class="Pavucontrol"] floating enable -for_window [class="Slack"] floating enable +for_window [class="Org.gnome.Software"] floating enable for_window [class="Signal"] floating enable +for_window [class="Slack"] floating enable for_window [class="Spotify"] floating enable for_window [class="Thunderbird"] floating enable for_window [class="vlc"] floating enable diff --git a/.vimrc b/.vimrc index f8fce87..68ae82a 100644 --- a/.vimrc +++ b/.vimrc @@ -1,5 +1,6 @@ " set background= -set t_te= t_ti= laststatus=2 +"set t_te= t_ti= laststatus=2 +set t_te= t_ti= ls=1 ruler syntax off filetype on @@ -7,23 +8,22 @@ filetype plugin on filetype plugin indent on let mapleader = "," +set rtp+=/opt/homebrew/opt/fzf let g:fzf_preview = 'cat {}' " vimki plugin -let g:vimki_lower = "a-zàçéèêếëîïñôöùûü" 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 z :FZF ~/Wiki -autocmd filetype vimki nnoremap = YpVr= -autocmd filetype vimki nnoremap - YpVr- - " 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 b (go-build) diff --git a/bin/gauth b/bin/gauth index 575d6fc..53ddf30 100755 --- a/bin/gauth +++ b/bin/gauth @@ -1,7 +1,8 @@ #!/bin/sh # Use backup from andOTP -gpg -qd ~/.otp_accounts.json.gpg | +# 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/wol b/bin/wol index 146e46a..7975df9 100755 --- a/bin/wol +++ b/bin/wol @@ -1,6 +1,6 @@ -#!/bin/sh -x +#!/bin/sh ip_plex=192.168.1.90 mac_plex=b0:83:fe:61:a7:aa eval "mac=\$mac_$1 ip=\$ip_$1" wakeonlan "$mac" -#ping -o "$ip" +while ! nc -zw 2 "$ip" 22; do printf .; sleep 2; done ssh "root@$ip" -- cgit v1.2.3 From e27491fbca20c2ecd76fcd84bd7007a546da5a75 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 16 Oct 2021 11:18:17 +0200 Subject: update --- .bashrc | 4 ++-- .profile | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index b50da1b..0a03cf8 100644 --- a/.bashrc +++ b/.bashrc @@ -50,7 +50,7 @@ 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 git='hub' #alias go='go1.14.1' #alias go11='go1.11.13' #alias go12='go1.12.10' @@ -64,7 +64,7 @@ alias gtb='go test -v -cpuprofile cpu.out -memprofile mem.out -benchmem -bench' alias rvi='sudo vim' alias rxt='sudo xt' alias rxvi='sudo xvi' -alias ww='vi ~/Wiki/HomePage' +alias ww='vi ~/Wiki/home_page.md' alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' #alias uc='systemctl --user' diff --git a/.profile b/.profile index bbf3c42..983092c 100644 --- a/.profile +++ b/.profile @@ -2,6 +2,11 @@ PATH=~/bin:/opt/homebrew/bin:$PATH:~/go/bin:~/.cargo/bin +if [ -z "$SSH_AUTH_SOCK" ] ; then + eval `ssh-agent -s` + ssh-add +fi + [ "${SHELL##*/}" = bash ] && . ~/.bashrc # Last action: auto start X11 when logged on first console -- cgit v1.2.3 From 7a36b02b5f3ae6560030c97513b8c15d9abd16d8 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 27 Nov 2021 11:04:34 +0100 Subject: update --- .bashrc | 11 +++++++++-- .profile | 3 ++- .vimrc | 3 ++- bin/update_hosts | 6 +++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.bashrc b/.bashrc index 0a03cf8..c222116 100644 --- a/.bashrc +++ b/.bashrc @@ -45,8 +45,8 @@ export TERMINAL=xt #alias ls='ls --color=auto -v' alias ls='ls -GF' alias ll='ls -AlGFhv' -alias vi='vim' -alias view='vim -R' +alias vi='nvim' +alias view='nvim -R' alias ldd='otool -L' alias ibrew='arch -x86_64 /usr/local/bin/brew' #alias op='xdg-open' @@ -59,6 +59,7 @@ alias ibrew='arch -x86_64 /usr/local/bin/brew' alias gob='go build' alias goh='p go help' alias god='p go doc' +alias gol='GO111MODULE=off go' alias gtr='go test -v -run' alias gtb='go test -v -cpuprofile cpu.out -memprofile mem.out -benchmem -bench' alias rvi='sudo vim' @@ -143,3 +144,9 @@ meteo() { # load Nix config files (aka auto-completion etc.) #export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" + +PATH="/Users/marc/perl5/bin${PATH:+:${PATH}}"; export PATH; +PERL5LIB="/Users/marc/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; +PERL_LOCAL_LIB_ROOT="/Users/marc/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; +PERL_MB_OPT="--install_base \"/Users/marc/perl5\""; export PERL_MB_OPT; +PERL_MM_OPT="INSTALL_BASE=/Users/marc/perl5"; export PERL_MM_OPT; diff --git a/.profile b/.profile index 983092c..3e36ae3 100644 --- a/.profile +++ b/.profile @@ -1,6 +1,6 @@ # ~/.profile -PATH=~/bin:/opt/homebrew/bin:$PATH:~/go/bin:~/.cargo/bin +PATH=~/bin:/opt/homebrew/bin:/opt/homebrew/opt/ruby/bin:$PATH:~/go/bin:~/.cargo/bin if [ -z "$SSH_AUTH_SOCK" ] ; then eval `ssh-agent -s` @@ -15,3 +15,4 @@ fi #esac . "/opt/homebrew/etc/profile.d/bash_completion.sh" +eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" diff --git a/.vimrc b/.vimrc index fd1fbbc..7f425b2 100644 --- a/.vimrc +++ b/.vimrc @@ -25,7 +25,7 @@ let g:go_list_type = "quickfix" 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 syntax on autocmd FileType go nmap b (go-build) autocmd FileType go nmap i (go-info) autocmd FileType go nmap r (go-run) @@ -79,3 +79,4 @@ noremap n :bn noremap :bd noremap o :!open & noremap :tag +noremap :Files diff --git a/bin/update_hosts b/bin/update_hosts index 8550ec3..40ec470 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -5,11 +5,11 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -echo "Checking from https://github.com/StevenBlack/hosts:" -lsd=$(curl -s "https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1"| jq -r '.[0].commit.committer.date') +echo 'Checking from https://github.com/StevenBlack/hosts:' +lsd=$(curl -s 'https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1' | jq -r '.[0].commit.committer.date') echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" echo "last local update: $(date -r /etc/hosts)" -[ $(date -j -f "%FT%TZ" "$lsd" +%s) -lt $(date -r /etc/hosts +%s) ] && echo "Nothing to do" && exit +[ $(date -j -f "%FT%TZ" "$lsd" +%s) -lt $(date -r /etc/hosts +%s) ] && echo 'Nothing to do' && exit cd /etc cp -p hosts hosts.old -- cgit v1.2.3 From b9df08e08dc7eba9352bc68a4d1bb55c8d27529f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 28 Nov 2021 15:45:27 +0100 Subject: update --- .backupignore | 11 +++++++++++ .bashrc | 1 + bin/backup | 16 +++++++++------- 3 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 .backupignore diff --git a/.backupignore b/.backupignore new file mode 100644 index 0000000..8f44c0d --- /dev/null +++ b/.backupignore @@ -0,0 +1,11 @@ +.Trash/ +*[Cc]ache*/ +.bundle/ +.*[Cc]ache*/ +.cargo/ +.cpan* +.gem/ +.ipfs/ +.npm/ +.vm*/ +go/pkg diff --git a/.bashrc b/.bashrc index c222116..f4a4278 100644 --- a/.bashrc +++ b/.bashrc @@ -40,6 +40,7 @@ alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date export TERMINAL=xt +alias bu='backup -uvd bip:/home/backup/m1' #alias cl='cf xft:Mono:size=12' #alias cp='cp --reflink' #alias ls='ls --color=auto -v' diff --git a/bin/backup b/bin/backup index 72c69c3..adce78d 100755 --- a/bin/backup +++ b/bin/backup @@ -1,8 +1,6 @@ #!/bin/sh # Incremental backup using rsync(1). -[ "$USER" = root ] || exec sudo "$0" "$@" - backup() { date=$(date +%Y%m%d_%H%M%S) last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) @@ -12,25 +10,29 @@ backup() { (*) opt_link=;; esac - rsync -HSxa$optv --exclude-from=$ignore $opt_link / /boot "$dest/$date" + rsync -HSxa$optv --exclude-from=$ignore $opt_link $volumes "$dest/$date" } dest=/.history -ignore=/etc/backup/ignore +ignore=/etc/backupignore +volumes='/ /boot' -while getopts :d:i:nv opt; do +while getopts :d:i:nuv opt; do case $opt in (d) dest="$OPTARG" ;; (i) ignore="$OPTARG" ;; (n|v) optv="$opt$optv" ;; - (*) echo "Usage: $0 [-nv] [-d [host:]dir] [clean|diff]"; exit 1 ;; + (u) optu=1 volumes="$HOME" ignore="$HOME/.backupignore" ;; + (*) echo "Usage: $0 [-nuv] [-d [[user@]host:]dir] [clean|diff]"; exit 1 ;; esac done shift $((OPTIND - 1)) +[ "$optu" ] || [ "$USER" = root ] || exec sudo "$0" "$@" + [ "$1" ] && cmd=$1 && shift || cmd="" case $cmd in (""|save) backup ;; -(clean) exec backup-clean ${optv+-$optv} "$dest";; +(clean) exec backup-clean ${optv+-$optv} "$@" "$dest";; (diff) exec diffdir "$@";; esac -- cgit v1.2.3 From 3816cb8729fce0206a4e01a2e7989d5462249e88 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 30 Nov 2021 15:42:42 +0100 Subject: update --- .bashrc | 2 +- .config/kitty/kitty.conf | 1516 ++++++++++++++++++++++++++++++++++++++++++++++ .vimrc | 2 +- 3 files changed, 1518 insertions(+), 2 deletions(-) create mode 100644 .config/kitty/kitty.conf diff --git a/.bashrc b/.bashrc index f4a4278..bec9d86 100644 --- a/.bashrc +++ b/.bashrc @@ -38,7 +38,7 @@ export GNUTERM='sixelgd enhanced truecolor font "arial,9"' # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' -export TERMINAL=xt +#export TERMINAL=xt alias bu='backup -uvd bip:/home/backup/m1' #alias cl='cf xft:Mono:size=12' diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf new file mode 100644 index 0000000..eca0bdf --- /dev/null +++ b/.config/kitty/kitty.conf @@ -0,0 +1,1516 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +#: Fonts {{{ + +#: kitty has very powerful font management. You can configure +#: individual font faces and even specify special fonts for particular +#: characters. + +# font_family monospace +# bold_font auto +# italic_font auto +# bold_italic_font auto + +#: You can specify different fonts for the bold/italic/bold-italic +#: variants. To get a full list of supported fonts use the `kitty +#: list-fonts` command. By default they are derived automatically, by +#: the OSes font system. Setting them manually is useful for font +#: families that have many weight variants like Book, Medium, Thick, +#: etc. For example:: + +#: font_family Operator Mono Book +#: bold_font Operator Mono Medium +#: italic_font Operator Mono Book Italic +#: bold_italic_font Operator Mono Medium Italic + +# font_size 11.0 +font_size 14.0 + +#: Font size (in pts) + +# force_ltr no + +#: kitty does not support BIDI (bidirectional text), however, for RTL +#: scripts, words are automatically displayed in RTL. That is to say, +#: in an RTL script, the words "HELLO WORLD" display in kitty as +#: "WORLD HELLO", and if you try to select a substring of an RTL- +#: shaped string, you will get the character that would be there had +#: the the string been LTR. For example, assuming the Hebrew word +#: ירושלים, selecting the character that on the screen appears to be ם +#: actually writes into the selection buffer the character י. kitty's +#: default behavior is useful in conjunction with a filter to reverse +#: the word order, however, if you wish to manipulate RTL glyphs, it +#: can be very challenging to work with, so this option is provided to +#: turn it off. Furthermore, this option can be used with the command +#: line program GNU FriBidi +#: to get BIDI +#: support, because it will force kitty to always treat the text as +#: LTR, which FriBidi expects for terminals. + +# adjust_line_height 0 +# adjust_column_width 0 + +#: Change the size of each character cell kitty renders. You can use +#: either numbers, which are interpreted as pixels or percentages +#: (number followed by %), which are interpreted as percentages of the +#: unmodified values. You can use negative pixels or percentages less +#: than 100% to reduce sizes (but this might cause rendering +#: artifacts). + +# adjust_baseline 0 + +#: Adjust the vertical alignment of text (the height in the cell at +#: which text is positioned). You can use either numbers, which are +#: interpreted as pixels or a percentages (number followed by %), +#: which are interpreted as the percentage of the line height. A +#: positive value moves the baseline up, and a negative value moves +#: them down. The underline and strikethrough positions are adjusted +#: accordingly. + +# symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols + +#: Map the specified unicode codepoints to a particular font. Useful +#: if you need special rendering for some symbols, such as for +#: Powerline. Avoids the need for patched fonts. Each unicode code +#: point is specified in the form U+. You +#: can specify multiple code points, separated by commas and ranges +#: separated by hyphens. symbol_map itself can be specified multiple +#: times. Syntax is:: + +#: symbol_map codepoints Font Family Name + +# disable_ligatures never + +#: Choose how you want to handle multi-character ligatures. The +#: default is to always render them. You can tell kitty to not render +#: them when the cursor is over them by using cursor to make editing +#: easier, or have kitty never render them at all by using always, if +#: you don't like them. The ligature strategy can be set per-window +#: either using the kitty remote control facility or by defining +#: shortcuts for it in kitty.conf, for example:: + +#: map alt+1 disable_ligatures_in active always +#: map alt+2 disable_ligatures_in all never +#: map alt+3 disable_ligatures_in tab cursor + +#: Note that this refers to programming ligatures, typically +#: implemented using the calt OpenType feature. For disabling general +#: ligatures, use the font_features setting. + +# font_features none + +#: Choose exactly which OpenType features to enable or disable. This +#: is useful as some fonts might have features worthwhile in a +#: terminal. For example, Fira Code Retina includes a discretionary +#: feature, zero, which in that font changes the appearance of the +#: zero (0), to make it more easily distinguishable from Ø. Fira Code +#: Retina also includes other discretionary features known as +#: Stylistic Sets which have the tags ss01 through ss20. + +#: For the exact syntax to use for individual features, see the +#: Harfbuzz documentation . + +#: Note that this code is indexed by PostScript name, and not the font +#: family. This allows you to define very precise feature settings; +#: e.g. you can disable a feature in the italic font but not in the +#: regular font. + +#: On Linux, these are read from the FontConfig database first and +#: then this, setting is applied, so they can be configured in a +#: single, central place. + +#: To get the PostScript name for a font, use kitty + list-fonts +#: --psnames: + +#: .. code-block:: sh + +#: $ kitty + list-fonts --psnames | grep Fira +#: Fira Code +#: Fira Code Bold (FiraCode-Bold) +#: Fira Code Light (FiraCode-Light) +#: Fira Code Medium (FiraCode-Medium) +#: Fira Code Regular (FiraCode-Regular) +#: Fira Code Retina (FiraCode-Retina) + +#: The part in brackets is the PostScript name. + +#: Enable alternate zero and oldstyle numerals:: + +#: font_features FiraCode-Retina +zero +onum + +#: Enable only alternate zero:: + +#: font_features FiraCode-Retina +zero + +#: Disable the normal ligatures, but keep the calt feature which (in +#: this font) breaks up monotony:: + +#: font_features TT2020StyleB-Regular -liga +calt + +#: In conjunction with force_ltr, you may want to disable Arabic +#: shaping entirely, and only look at their isolated forms if they +#: show up in a document. You can do this with e.g.:: + +#: font_features UnifontMedium +isol -medi -fina -init + +# box_drawing_scale 0.001, 1, 1.5, 2 + +#: Change the sizes of the lines used for the box drawing unicode +#: characters These values are in pts. They will be scaled by the +#: monitor DPI to arrive at a pixel value. There must be four values +#: corresponding to thin, normal, thick, and very thick lines. + +#: }}} + +#: Cursor customization {{{ + +# cursor #cccccc +cursor #ff0000 + +#: Default cursor color + +# cursor_text_color #111111 + +#: Choose the color of text under the cursor. If you want it rendered +#: with the background color of the cell underneath instead, use the +#: special keyword: background + +# cursor_shape block + +#: The cursor shape can be one of (block, beam, underline). Note that +#: when reloading the config this will be changed only if the cursor +#: shape has not been set by the program running in the terminal. + +# cursor_beam_thickness 1.5 + +#: Defines the thickness of the beam cursor (in pts) + +# cursor_underline_thickness 2.0 + +#: Defines the thickness of the underline cursor (in pts) + +# cursor_blink_interval -1 +cursor_blink_interval 0 + +#: The interval (in seconds) at which to blink the cursor. Set to zero +#: to disable blinking. Negative values mean use system default. Note +#: that numbers smaller than repaint_delay will be limited to +#: repaint_delay. + +# cursor_stop_blinking_after 15.0 + +#: Stop blinking cursor after the specified number of seconds of +#: keyboard inactivity. Set to zero to never stop blinking. + +#: }}} + +#: Scrollback {{{ + +# scrollback_lines 2000 + +#: Number of lines of history to keep in memory for scrolling back. +#: Memory is allocated on demand. Negative numbers are (effectively) +#: infinite scrollback. Note that using very large scrollback is not +#: recommended as it can slow down performance of the terminal and +#: also use large amounts of RAM. Instead, consider using +#: scrollback_pager_history_size. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER + +#: Program with which to view scrollback in a new window. The +#: scrollback buffer is passed as STDIN to this program. If you change +#: it, make sure the program you use can handle ANSI escape sequences +#: for colors and text formatting. INPUT_LINE_NUMBER in the command +#: line above will be replaced by an integer representing which line +#: should be at the top of the screen. Similarly CURSOR_LINE and +#: CURSOR_COLUMN will be replaced by the current cursor position. + +# scrollback_pager_history_size 0 + +#: Separate scrollback history size, used only for browsing the +#: scrollback buffer (in MB). This separate buffer is not available +#: for interactive scrolling but will be piped to the pager program +#: when viewing scrollback buffer in a separate window. The current +#: implementation stores the data in UTF-8, so approximatively 10000 +#: lines per megabyte at 100 chars per line, for pure ASCII text, +#: unformatted text. A value of zero or less disables this feature. +#: The maximum allowed size is 4GB. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +# scrollback_fill_enlarged_window no + +#: Fill new space with lines from the scrollback buffer after +#: enlarging a window. + +# wheel_scroll_multiplier 5.0 + +#: Modify the amount scrolled by the mouse wheel. Note this is only +#: used for low precision scrolling devices, not for high precision +#: scrolling on platforms such as macOS and Wayland. Use negative +#: numbers to change scroll direction. + +# touch_scroll_multiplier 1.0 + +#: Modify the amount scrolled by a touchpad. Note this is only used +#: for high precision scrolling devices on platforms such as macOS and +#: Wayland. Use negative numbers to change scroll direction. + +#: }}} + +#: Mouse {{{ + +# mouse_hide_wait 3.0 + +#: Hide mouse cursor after the specified number of seconds of the +#: mouse not being used. Set to zero to disable mouse cursor hiding. +#: Set to a negative value to hide the mouse cursor immediately when +#: typing text. Disabled by default on macOS as getting it to work +#: robustly with the ever-changing sea of bugs that is Cocoa is too +#: much effort. + +# url_color #0087bd +# url_style curly + +#: The color and style for highlighting URLs on mouse-over. url_style +#: can be one of: none, single, double, curly + +# open_url_with default + +#: The program with which to open URLs that are clicked on. The +#: special value default means to use the operating system's default +#: URL handler. + +# url_prefixes http https file ftp gemini irc gopher mailto news git + +#: The set of URL prefixes to look for when detecting a URL under the +#: mouse cursor. + +# detect_urls yes + +#: Detect URLs under the mouse. Detected URLs are highlighted with an +#: underline and the mouse cursor becomes a hand over them. Even if +#: this option is disabled, URLs are still clickable. + +# url_excluded_characters + +#: Additional characters to be disallowed from URLs, when detecting +#: URLs under the mouse cursor. By default, all characters legal in +#: URLs are allowed. + +# copy_on_select no +copy_on_select yes + +#: Copy to clipboard or a private buffer on select. With this set to +#: clipboard, simply selecting text with the mouse will cause the text +#: to be copied to clipboard. Useful on platforms such as macOS that +#: do not have the concept of primary selections. You can instead +#: specify a name such as a1 to copy to a private kitty buffer +#: instead. Map a shortcut with the paste_from_buffer action to paste +#: from this private buffer. For example:: + +#: map cmd+shift+v paste_from_buffer a1 + +#: Note that copying to the clipboard is a security risk, as all +#: programs, including websites open in your browser can read the +#: contents of the system clipboard. + +# strip_trailing_spaces never + +#: Remove spaces at the end of lines when copying to clipboard. A +#: value of smart will do it when using normal selections, but not +#: rectangle selections. always will always do it. + +# select_by_word_characters @-./_~?&=%+# + +#: Characters considered part of a word when double clicking. In +#: addition to these characters any character that is marked as an +#: alphanumeric character in the unicode database will be matched. + +# click_interval -1.0 + +#: The interval between successive clicks to detect double/triple +#: clicks (in seconds). Negative numbers will use the system default +#: instead, if available, or fallback to 0.5. + +# focus_follows_mouse no +focus_follows_mouse yes + +#: Set the active window to the window under the mouse when moving the +#: mouse around + +# pointer_shape_when_grabbed arrow + +#: The shape of the mouse pointer when the program running in the +#: terminal grabs the mouse. Valid values are: arrow, beam and hand + +# default_pointer_shape beam + +#: The default shape of the mouse pointer. Valid values are: arrow, +#: beam and hand + +# pointer_shape_when_dragging beam + +#: The default shape of the mouse pointer when dragging across text. +#: Valid values are: arrow, beam and hand + +#: Mouse actions {{{ + +#: Mouse buttons can be remapped to perform arbitrary actions. The +#: syntax for doing so is: + +#: .. code-block:: none + +#: mouse_map button-name event-type modes action + +#: Where ``button-name`` is one of ``left``, ``middle``, ``right`` or +#: ``b1 ... b8`` with added keyboard modifiers, for example: +#: ``ctrl+shift+left`` refers to holding the ctrl+shift keys while +#: clicking with the left mouse button. The number ``b1 ... b8`` can +#: be used to refer to upto eight buttons on a mouse. + +#: ``event-type`` is one ``press``, ``release``, ``doublepress``, +#: ``triplepress``, ``click`` and ``doubleclick``. ``modes`` +#: indicates whether the action is performed when the mouse is grabbed +#: by the program running in the terminal, or not. It can have one or +#: more or the values, ``grabbed,ungrabbed``. ``grabbed`` refers to +#: when the program running in the terminal has requested mouse +#: events. Note that the click and double click events have a delay of +#: click_interval to disambiguate from double and triple presses. + +#: You can run kitty with the kitty --debug-input command line option +#: to see mouse events. See the builtin actions below to get a sense +#: of what is possible. + +#: If you want to unmap an action map it to ``no-op``. For example, to +#: disable opening of URLs with a plain click:: + +#: mouse_map left click ungrabbed no-op + +#: .. note:: +#: Once a selection is started, releasing the button that started it will +#: automatically end it and no release event will be dispatched. + +# clear_all_mouse_actions no + +#: You can have kitty remove all mouse actions seen up to this point. +#: Useful, for instance, to remove the default mouse actions. + +# mouse_map left click ungrabbed mouse_click_url_or_select +# mouse_map shift+left click grabbed,ungrabbed mouse_click_url_or_select +# mouse_map ctrl+shift+left release grabbed,ungrabbed mouse_click_url + +#: Variant with ctrl+shift is present because the simple click based +#: version has an unavoidable delay of click_interval, to disambiguate +#: clicks from double clicks. + +# mouse_map ctrl+shift+left press grabbed discard_event + +#: Prevent this press event from being sent to the program that has +#: grabbed the mouse, as the corresponding release event is used to +#: open a URL. + +# mouse_map middle release ungrabbed paste_from_selection +# mouse_map left press ungrabbed mouse_selection normal +# mouse_map ctrl+alt+left press ungrabbed mouse_selection rectangle +# mouse_map left doublepress ungrabbed mouse_selection word +# mouse_map left triplepress ungrabbed mouse_selection line + +#: Select the entire line + +# mouse_map ctrl+alt+left triplepress ungrabbed mouse_selection line_from_point + +#: Select from the clicked point to the end of the line + +# mouse_map right press ungrabbed mouse_selection extend + +#: If you want only the end of the selection to be moved instead of +#: the nearest boundary, use move-end instead of extend. + +# mouse_map shift+middle release ungrabbed,grabbed paste_selection +# mouse_map shift+left press ungrabbed,grabbed mouse_selection normal +# mouse_map shift+ctrl+alt+left press ungrabbed,grabbed mouse_selection rectangle +# mouse_map shift+left doublepress ungrabbed,grabbed mouse_selection word +# mouse_map shift+left triplepress ungrabbed,grabbed mouse_selection line + +#: Select the entire line + +# mouse_map shift+ctrl+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point + +#: Select from the clicked point to the end of the line + +# mouse_map shift+right press ungrabbed,grabbed mouse_selection extend +#: }}} + +#: }}} + +#: Performance tuning {{{ + +# repaint_delay 10 + +#: Delay (in milliseconds) between screen updates. Decreasing it, +#: increases frames-per-second (FPS) at the cost of more CPU usage. +#: The default value yields ~100 FPS which is more than sufficient for +#: most uses. Note that to actually achieve 100 FPS you have to either +#: set sync_to_monitor to no or use a monitor with a high refresh +#: rate. Also, to minimize latency when there is pending input to be +#: processed, repaint_delay is ignored. + +# input_delay 3 + +#: Delay (in milliseconds) before input from the program running in +#: the terminal is processed. Note that decreasing it will increase +#: responsiveness, but also increase CPU usage and might cause flicker +#: in full screen programs that redraw the entire screen on each loop, +#: because kitty is so fast that partial screen updates will be drawn. + +# sync_to_monitor yes + +#: Sync screen updates to the refresh rate of the monitor. This +#: prevents tearing (https://en.wikipedia.org/wiki/Screen_tearing) +#: when scrolling. However, it limits the rendering speed to the +#: refresh rate of your monitor. With a very high speed mouse/high +#: keyboard repeat rate, you may notice some slight input latency. If +#: so, set this to no. + +#: }}} + +#: Terminal bell {{{ + +# enable_audio_bell yes + +#: Enable/disable the audio bell. Useful in environments that require +#: silence. + +# visual_bell_duration 0.0 + +#: Visual bell duration. Flash the screen when a bell occurs for the +#: specified number of seconds. Set to zero to disable. + +# window_alert_on_bell yes + +#: Request window attention on bell. Makes the dock icon bounce on +#: macOS or the taskbar flash on linux. + +# bell_on_tab yes + +#: Show a bell symbol on the tab if a bell occurs in one of the +#: windows in the tab and the window is not the currently focused +#: window + +# command_on_bell none + +#: Program to run when a bell occurs. The environment variable +#: KITTY_CHILD_CMDLINE can be used to get the program running in the +#: window in which the bell occurred. + +#: }}} + +#: Window layout {{{ + +# remember_window_size yes +# initial_window_width 640 +# initial_window_height 400 + +#: If enabled, the window size will be remembered so that new +#: instances of kitty will have the same size as the previous +#: instance. If disabled, the window will initially have size +#: configured by initial_window_width/height, in pixels. You can use a +#: suffix of "c" on the width/height values to have them interpreted +#: as number of cells instead of pixels. + +# enabled_layouts * +enabled_layouts tall,fat,grid + +#: The enabled window layouts. A comma separated list of layout names. +#: The special value all means all layouts. The first listed layout +#: will be used as the startup layout. Default configuration is all +#: layouts in alphabetical order. For a list of available layouts, see +#: the https://sw.kovidgoyal.net/kitty/overview/#layouts. + +# window_resize_step_cells 2 +# window_resize_step_lines 2 + +#: The step size (in units of cell width/cell height) to use when +#: resizing windows. The cells value is used for horizontal resizing +#: and the lines value for vertical resizing. + +# window_border_width 0.5pt + +#: The width of window borders. Can be either in pixels (px) or pts +#: (pt). Values in pts will be rounded to the nearest number of pixels +#: based on screen resolution. If not specified the unit is assumed to +#: be pts. Note that borders are displayed only when more than one +#: window is visible. They are meant to separate multiple windows. + +# draw_minimal_borders yes + +#: Draw only the minimum borders needed. This means that only the +#: minimum needed borders for inactive windows are drawn. That is only +#: the borders that separate the inactive window from a neighbor. Note +#: that setting a non-zero window margin overrides this and causes all +#: borders to be drawn. + +# window_margin_width 0 + +#: The window margin (in pts) (blank area outside the border). A +#: single value sets all four sides. Two values set the vertical and +#: horizontal sides. Three values set top, horizontal and bottom. Four +#: values set top, right, bottom and left. + +# single_window_margin_width -1 + +#: The window margin (in pts) to use when only a single window is +#: visible. Negative values will cause the value of +#: window_margin_width to be used instead. A single value sets all +#: four sides. Two values set the vertical and horizontal sides. Three +#: values set top, horizontal and bottom. Four values set top, right, +#: bottom and left. + +# window_padding_width 0 + +#: The window padding (in pts) (blank area between the text and the +#: window border). A single value sets all four sides. Two values set +#: the vertical and horizontal sides. Three values set top, horizontal +#: and bottom. Four values set top, right, bottom and left. + +# placement_strategy center + +#: When the window size is not an exact multiple of the cell size, the +#: cell area of the terminal window will have some extra padding on +#: the sides. You can control how that padding is distributed with +#: this option. Using a value of center means the cell area will be +#: placed centrally. A value of top-left means the padding will be on +#: only the bottom and right edges. + +# active_border_color #00ff00 + +#: The color for the border of the active window. Set this to none to +#: not draw borders around the active window. + +# inactive_border_color #cccccc + +#: The color for the border of inactive windows + +# bell_border_color #ff5a00 + +#: The color for the border of inactive windows in which a bell has +#: occurred + +# inactive_text_alpha 1.0 + +#: Fade the text in inactive windows by the specified amount (a number +#: between zero and one, with zero being fully faded). + +# hide_window_decorations no + +#: Hide the window decorations (title-bar and window borders) with +#: yes. On macOS, titlebar-only can be used to only hide the titlebar. +#: Whether this works and exactly what effect it has depends on the +#: window manager/operating system. Note that the effects of changing +#: this setting when reloading config are undefined. + +# resize_debounce_time 0.1 + +#: The time (in seconds) to wait before redrawing the screen when a +#: resize event is received. On platforms such as macOS, where the +#: operating system sends events corresponding to the start and end of +#: a resize, this number is ignored. + +# resize_draw_strategy static + +#: Choose how kitty draws a window while a resize is in progress. A +#: value of static means draw the current window contents, mostly +#: unchanged. A value of scale means draw the current window contents +#: scaled. A value of blank means draw a blank window. A value of size +#: means show the window size in cells. + +# resize_in_steps no + +#: Resize the OS window in steps as large as the cells, instead of +#: with the usual pixel accuracy. Combined with an +#: initial_window_width and initial_window_height in number of cells, +#: this option can be used to keep the margins as small as possible +#: when resizing the OS window. Note that this does not currently work +#: on Wayland. + +# confirm_os_window_close 0 + +#: Ask for confirmation when closing an OS window or a tab that has at +#: least this number of kitty windows in it. A value of zero disables +#: confirmation. This confirmation also applies to requests to quit +#: the entire application (all OS windows, via the quit action). + +#: }}} + +#: Tab bar {{{ + +# tab_bar_edge bottom + +#: Which edge to show the tab bar on, top or bottom + +# tab_bar_margin_width 0.0 + +#: The margin to the left and right of the tab bar (in pts) + +# tab_bar_margin_height 0.0 0.0 + +#: The margin above and below the tab bar (in pts). The first number +#: is the margin between the edge of the OS Window and the tab bar and +#: the second number is the margin between the tab bar and the +#: contents of the current tab. + +# tab_bar_style fade + +#: The tab bar style, can be one of: + +#: fade +#: Each tab's edges fade into the background color (see tab_fade) +#: slant +#: Tabs look like the tabs in a physical file +#: separator +#: Tabs are separated by a configurable separator (see tab_separator) +#: powerline +#: Tabs are shown as a continuous line with "fancy" separators (see tab_powerline_style) +#: hidden +#: The tab bar is hidden. If you use this, you might want to create a mapping +#: for the https://sw.kovidgoyal.net/kitty/actions/#select-tab action which presents you with a list +#: of tabs and allows for easy switching to a tab. + +# tab_bar_min_tabs 2 + +#: The minimum number of tabs that must exist before the tab bar is +#: shown + +# tab_switch_strategy previous + +#: The algorithm to use when switching to a tab when the current tab +#: is closed. The default of previous will switch to the last used +#: tab. A value of left will switch to the tab to the left of the +#: closed tab. A value of right will switch to the tab to the right of +#: the closed tab. A value of last will switch to the right-most tab. + +# tab_fade 0.25 0.5 0.75 1 + +#: Control how each tab fades into the background when using fade for +#: the tab_bar_style. Each number is an alpha (between zero and one) +#: that controls how much the corresponding cell fades into the +#: background, with zero being no fade and one being full fade. You +#: can change the number of cells used by adding/removing entries to +#: this list. + +# tab_separator " ┇" + +#: The separator between tabs in the tab bar when using separator as +#: the tab_bar_style. + +# tab_powerline_style angled + +#: The powerline separator style between tabs in the tab bar when +#: using powerline as the tab_bar_style, can be one of: angled, +#: slanted, or round. + +# tab_activity_symbol none + +#: Some text or a unicode symbol to show on the tab if a window in the +#: tab that does not have focus has some activity. If you want to use +#: leading or trailing spaces surround the text with quotes. + +# tab_title_template "{title}" + +#: A template to render the tab title. The default just renders the +#: title. If you wish to include the tab-index as well, use something +#: like: {index}: {title}. Useful if you have shortcuts mapped for +#: goto_tab N. If you prefer to see the index as a superscript, use +#: {sup.index}. In addition you can use {layout_name} for the current +#: layout name, {num_windows} for the number of windows in the tab and +#: {num_window_groups} for the number of window groups (not counting +#: overlay windows) in the tab. Note that formatting is done by +#: Python's string formatting machinery, so you can use, for instance, +#: {layout_name[:2].upper()} to show only the first two letters of the +#: layout name, upper-cased. If you want to style the text, you can +#: use styling directives, for example: +#: {fmt.fg.red}red{fmt.fg.default}normal{fmt.bg._00FF00}green +#: bg{fmt.bg.normal}. Similarly, for bold and italic: +#: {fmt.bold}bold{fmt.nobold}normal{fmt.italic}italic{fmt.noitalic}. + +# active_tab_title_template none + +#: Template to use for active tabs, if not specified falls back to +#: tab_title_template. + +# active_tab_foreground #000 +# active_tab_background #eee +# active_tab_font_style bold-italic +# inactive_tab_foreground #444 +# inactive_tab_background #999 +# inactive_tab_font_style normal + +#: Tab bar colors and styles + +# tab_bar_background none + +#: Background color for the tab bar. Defaults to using the terminal +#: background color. + +#: }}} + +#: Color scheme {{{ + +# foreground #dddddd +# background #000000 + +#: The foreground and background colors + +# background_opacity 1.0 + +#: The opacity of the background. A number between 0 and 1, where 1 is +#: opaque and 0 is fully transparent. This will only work if +#: supported by the OS (for instance, when using a compositor under +#: X11). Note that it only sets the background color's opacity in +#: cells that have the same background color as the default terminal +#: background. This is so that things like the status bar in vim, +#: powerline prompts, etc. still look good. But it means that if you +#: use a color theme with a background color in your editor, it will +#: not be rendered as transparent. Instead you should change the +#: default background color in your kitty config and not use a +#: background color in the editor color scheme. Or use the escape +#: codes to set the terminals default colors in a shell script to +#: launch your editor. Be aware that using a value less than 1.0 is a +#: (possibly significant) performance hit. If you want to dynamically +#: change transparency of windows set dynamic_background_opacity to +#: yes (this is off by default as it has a performance cost). Changing +#: this setting when reloading the config will only work if +#: dynamic_background_opacity was enabled in the original config. + +# background_image none + +#: Path to a background image. Must be in PNG format. + +# background_image_layout tiled + +#: Whether to tile or scale the background image. + +# background_image_linear no + +#: When background image is scaled, whether linear interpolation +#: should be used. + +# dynamic_background_opacity no + +#: Allow changing of the background_opacity dynamically, using either +#: keyboard shortcuts (increase_background_opacity and +#: decrease_background_opacity) or the remote control facility. +#: Changing this setting by reloading the config is not supported. + +# background_tint 0.0 + +#: How much to tint the background image by the background color. The +#: tint is applied only under the text area, not margin/borders. Makes +#: it easier to read the text. Tinting is done using the current +#: background color for each window. This setting applies only if +#: background_opacity is set and transparent windows are supported or +#: background_image is set. + +# dim_opacity 0.75 + +#: How much to dim text that has the DIM/FAINT attribute set. One +#: means no dimming and zero means fully dimmed (i.e. invisible). + +# selection_foreground #000000 + +#: The foreground for text selected with the mouse. A value of none +#: means to leave the color unchanged. + +# selection_background #fffacd + +#: The background for text selected with the mouse. + +#: The color table {{{ + +#: The 256 terminal colors. There are 8 basic colors, each color has a +#: dull and bright version, for the first 16 colors. You can set the +#: remaining 240 colors as color16 to color255. + +# color0 #000000 +# color8 #767676 + +#: black + +# color1 #cc0403 +# color9 #f2201f + +#: red + +# color2 #19cb00 +# color10 #23fd00 + +#: green + +# color3 #cecb00 +# color11 #fffd00 + +#: yellow + +# color4 #0d73cc +# color12 #1a8fff + +#: blue + +# color5 #cb1ed1 +# color13 #fd28ff + +#: magenta + +# color6 #0dcdcd +# color14 #14ffff + +#: cyan + +# color7 #dddddd +# color15 #ffffff + +#: white + +# mark1_foreground black + +#: Color for marks of type 1 + +# mark1_background #98d3cb + +#: Color for marks of type 1 (light steel blue) + +# mark2_foreground black + +#: Color for marks of type 2 + +# mark2_background #f2dcd3 + +#: Color for marks of type 1 (beige) + +# mark3_foreground black + +#: Color for marks of type 3 + +# mark3_background #f274bc + +#: Color for marks of type 3 (violet) + +#: }}} + +#: }}} + +#: Advanced {{{ + +# shell . + +#: The shell program to execute. The default value of . means to use +#: whatever shell is set as the default shell for the current user. +#: Note that on macOS if you change this, you might need to add +#: --login and --interactive to ensure that the shell starts in +#: interactive mode and reads its startup rc files. + +# editor . + +#: The terminal editor (such as ``vim`` or ``nano``) to use when +#: editing the kitty config file or similar tasks. + +#: The default value of . means to use the environment variables +#: VISUAL and EDITOR in that order. If these variables aren't set, +#: kitty will run your shell (``$SHELL -l -i -c env``) to see if your +#: shell config files set VISUAL or EDITOR. If that doesn't work, +#: kitty will cycle through various known editors (``vim``, ``emacs``, +#: etc) and take the first one that exists on your system. + +# close_on_child_death no + +#: Close the window when the child process (shell) exits. If no (the +#: default), the terminal will remain open when the child exits as +#: long as there are still processes outputting to the terminal (for +#: example disowned or backgrounded processes). If yes, the window +#: will close as soon as the child process exits. Note that setting it +#: to yes means that any background processes still using the terminal +#: can fail silently because their stdout/stderr/stdin no longer work. + +# allow_remote_control no +allow_remote_control yes + +#: Allow other programs to control kitty. If you turn this on other +#: programs can control all aspects of kitty, including sending text +#: to kitty windows, opening new windows, closing windows, reading the +#: content of windows, etc. Note that this even works over ssh +#: connections. You can chose to either allow any program running +#: within kitty to control it, with yes or only programs that connect +#: to the socket specified with the kitty --listen-on command line +#: option, if you use the value socket-only. The latter is useful if +#: you want to prevent programs running on a remote computer over ssh +#: from controlling kitty. Reloading the config will not affect this +#: setting. + +# listen_on none + +#: Tell kitty to listen to the specified unix/tcp socket for remote +#: control connections. Note that this will apply to all kitty +#: instances. It can be overridden by the kitty --listen-on command +#: line flag. This option accepts only UNIX sockets, such as +#: unix:${TEMP}/mykitty or (on Linux) unix:@mykitty. Environment +#: variables are expanded. If {kitty_pid} is present then it is +#: replaced by the PID of the kitty process, otherwise the PID of the +#: kitty process is appended to the value, with a hyphen. This option +#: is ignored unless you also set allow_remote_control to enable +#: remote control. See the help for kitty --listen-on for more +#: details. Changing this option by reloading the config is not +#: supported. + +# env + +#: Specify environment variables to set in all child processes. Note +#: that environment variables are expanded recursively, so if you +#: use:: + +#: env MYVAR1=a +#: env MYVAR2=${MYVAR1}/${HOME}/b + +#: The value of MYVAR2 will be a//b. + +# update_check_interval 24 + +#: Periodically check if an update to kitty is available. If an update +#: is found a system notification is displayed informing you of the +#: available update. The default is to check every 24 hrs, set to zero +#: to disable. Changing this option by reloading the config is not +#: supported. + +# startup_session none + +#: Path to a session file to use for all kitty instances. Can be +#: overridden by using the kitty --session command line option for +#: individual instances. See +#: https://sw.kovidgoyal.net/kitty/overview/#startup-sessions in the +#: kitty documentation for details. Note that relative paths are +#: interpreted with respect to the kitty config directory. Environment +#: variables in the path are expanded. Changing this option by +#: reloading the config is not supported. + +# clipboard_control write-clipboard write-primary + +#: Allow programs running in kitty to read and write from the +#: clipboard. You can control exactly which actions are allowed. The +#: set of possible actions is: write-clipboard read-clipboard write- +#: primary read-primary. The default is to allow writing to the +#: clipboard and primary selection. Note that enabling the read +#: functionality is a security risk as it means that any program, even +#: one running on a remote server via SSH can read your clipboard. See +#: also clipboard_max_size. + +# clipboard_max_size 64 + +#: The maximum size (in MB) of data from programs running in kitty +#: that will be stored for writing to the system clipboard. See also +#: clipboard_control. A value of zero means no size limit is applied. + +# allow_hyperlinks yes + +#: Process hyperlink (OSC 8) escape sequences. If disabled OSC 8 +#: escape sequences are ignored. Otherwise they become clickable +#: links, that you can click by holding down ctrl+shift and clicking +#: with the mouse. The special value of ``ask`` means that kitty will +#: ask before opening the link. + +# term xterm-kitty + +#: The value of the TERM environment variable to set. Changing this +#: can break many terminal programs, only change it if you know what +#: you are doing, not because you read some advice on Stack Overflow +#: to change it. The TERM variable is used by various programs to get +#: information about the capabilities and behavior of the terminal. If +#: you change it, depending on what programs you run, and how +#: different the terminal you are changing it to is, various things +#: from key-presses, to colors, to various advanced features may not +#: work. Changing this option by reloading the config will only affect +#: newly created windows. + +#: }}} + +#: OS specific tweaks {{{ + +# wayland_titlebar_color system + +#: Change the color of the kitty window's titlebar on Wayland systems +#: with client side window decorations such as GNOME. A value of +#: system means to use the default system color, a value of background +#: means to use the background color of the currently active window +#: and finally you can use an arbitrary color, such as #12af59 or red. + +# macos_titlebar_color system + +#: Change the color of the kitty window's titlebar on macOS. A value +#: of system means to use the default system color, a value of +#: background means to use the background color of the currently +#: active window and finally you can use an arbitrary color, such as +#: #12af59 or red. WARNING: This option works by using a hack, as +#: there is no proper Cocoa API for it. It sets the background color +#: of the entire window and makes the titlebar transparent. As such it +#: is incompatible with background_opacity. If you want to use both, +#: you are probably better off just hiding the titlebar with +#: hide_window_decorations. + +# macos_option_as_alt no + +#: Use the option key as an alt key. With this set to no, kitty will +#: use the macOS native Option+Key = unicode character behavior. This +#: will break any Alt+key keyboard shortcuts in your terminal +#: programs, but you can use the macOS unicode input technique. You +#: can use the values: left, right, or both to use only the left, +#: right or both Option keys as Alt, instead. Changing this setting by +#: reloading the config is not supported. + +# macos_hide_from_tasks no + +#: Hide the kitty window from running tasks (⌘+Tab) on macOS. Changing +#: this setting by reloading the config is not supported. + +# macos_quit_when_last_window_closed no + +#: Have kitty quit when all the top-level windows are closed. By +#: default, kitty will stay running, even with no open windows, as is +#: the expected behavior on macOS. + +# macos_window_resizable yes + +#: Disable this if you want kitty top-level (OS) windows to not be +#: resizable on macOS. Changing this setting by reloading the config +#: will only affect newly created windows. + +# macos_thicken_font 0 + +#: Draw an extra border around the font with the given width, to +#: increase legibility at small font sizes. For example, a value of +#: 0.75 will result in rendering that looks similar to sub-pixel +#: antialiasing at common font sizes. + +# macos_traditional_fullscreen no + +#: Use the traditional full-screen transition, that is faster, but +#: less pretty. + +# macos_show_window_title_in all + +#: Show or hide the window title in the macOS window or menu-bar. A +#: value of window will show the title of the currently active window +#: at the top of the macOS window. A value of menubar will show the +#: title of the currently active window in the macOS menu-bar, making +#: use of otherwise wasted space. all will show the title everywhere +#: and none hides the title in the window and the menu-bar. + +# macos_custom_beam_cursor no + +#: Enable/disable custom mouse cursor for macOS that is easier to see +#: on both light and dark backgrounds. WARNING: this might make your +#: mouse cursor invisible on dual GPU machines. Changing this setting +#: by reloading the config is not supported. + +# linux_display_server auto + +#: Choose between Wayland and X11 backends. By default, an appropriate +#: backend based on the system state is chosen automatically. Set it +#: to x11 or wayland to force the choice. Changing this setting by +#: reloading the config is not supported. + +#: }}} + +#: Keyboard shortcuts {{{ + +#: Keys are identified simply by their lowercase unicode characters. +#: For example: ``a`` for the A key, ``[`` for the left square bracket +#: key, etc. For functional keys, such as ``Enter or Escape`` the +#: names are present at https://sw.kovidgoyal.net/kitty/keyboard- +#: protocol/#functional-key-definitions. For a list of modifier names, +#: see: GLFW mods + +#: On Linux you can also use XKB key names to bind keys that are not +#: supported by GLFW. See XKB keys +#: for a list of key names. The name to use is the part +#: after the XKB_KEY_ prefix. Note that you can only use an XKB key +#: name for keys that are not known as GLFW keys. + +#: Finally, you can use raw system key codes to map keys, again only +#: for keys that are not known as GLFW keys. To see the system key +#: code for a key, start kitty with the kitty --debug-input option. +#: Then kitty will output some debug text for every key event. In that +#: text look for ``native_code`` the value of that becomes the key +#: name in the shortcut. For example: + +#: .. code-block:: none + +#: on_key_input: glfw key: 65 native_code: 0x61 action: PRESS mods: 0x0 text: 'a' + +#: Here, the key name for the A key is 0x61 and you can use it with:: + +#: map ctrl+0x61 something + +#: to map ctrl+a to something. + +#: You can use the special action no_op to unmap a keyboard shortcut +#: that is assigned in the default configuration:: + +#: map kitty_mod+space no_op + +#: You can combine multiple actions to be triggered by a single +#: shortcut, using the syntax below:: + +#: map key combine action1 action2 action3 ... + +#: For example:: + +#: map kitty_mod+e combine : new_window : next_layout + +#: this will create a new window and switch to the next available +#: layout + +#: You can use multi-key shortcuts using the syntax shown below:: + +#: map key1>key2>key3 action + +#: For example:: + +#: map ctrl+f>2 set_font_size 20 + +#: The full list of actions that can be mapped to key presses is +#: available here . + +# kitty_mod ctrl+shift + +#: The value of kitty_mod is used as the modifier for all default +#: shortcuts, you can change it in your kitty.conf to change the +#: modifiers for all the default shortcuts. + +# clear_all_shortcuts no + +#: You can have kitty remove all shortcut definition seen up to this +#: point. Useful, for instance, to remove the default shortcuts. + +# kitten_alias hints hints --hints-offset=0 + +#: You can create aliases for kitten names, this allows overriding the +#: defaults for kitten options and can also be used to shorten +#: repeated mappings of the same kitten with a specific group of +#: options. For example, the above alias changes the default value of +#: kitty +kitten hints --hints-offset to zero for all mappings, +#: including the builtin ones. + +#: Clipboard {{{ + +# map kitty_mod+c copy_to_clipboard + +#: There is also a copy_or_interrupt action that can be optionally +#: mapped to Ctrl+c. It will copy only if there is a selection and +#: send an interrupt otherwise. Similarly, copy_and_clear_or_interrupt +#: will copy and clear the selection or send an interrupt if there is +#: no selection. + +# map kitty_mod+v paste_from_clipboard +# map kitty_mod+s paste_from_selection +# map kitty_mod+o pass_selection_to_program + +#: You can also pass the contents of the current selection to any +#: program using pass_selection_to_program. By default, the system's +#: open program is used, but you can specify your own, the selection +#: will be passed as a command line argument to the program, for +#: example:: + +#: map kitty_mod+o pass_selection_to_program firefox + +#: You can pass the current selection to a terminal program running in +#: a new kitty window, by using the @selection placeholder:: + +#: map kitty_mod+y new_window less @selection + +#: }}} + +#: Scrolling {{{ + +# map kitty_mod+up scroll_line_up +# map kitty_mod+down scroll_line_down +# map kitty_mod+page_up scroll_page_up +# map kitty_mod+page_down scroll_page_down +# map kitty_mod+home scroll_home +# map kitty_mod+end scroll_end +# map kitty_mod+h show_scrollback + +#: You can pipe the contents of the current screen + history buffer as +#: STDIN to an arbitrary program using the ``launch`` function. For +#: example, the following opens the scrollback buffer in less in an +#: overlay window:: + +#: map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R + +#: For more details on piping screen and buffer contents to external +#: programs, see launch. + +#: }}} + +#: Window management {{{ + +# map kitty_mod+enter new_window + +#: You can open a new window running an arbitrary program, for +#: example:: + +#: map kitty_mod+y launch mutt + +#: You can open a new window with the current working directory set to +#: the working directory of the current window using:: + +#: map ctrl+alt+enter launch --cwd=current + +#: You can open a new window that is allowed to control kitty via the +#: kitty remote control facility by prefixing the command line with @. +#: Any programs running in that window will be allowed to control +#: kitty. For example:: + +#: map ctrl+enter launch --allow-remote-control some_program + +#: You can open a new window next to the currently active window or as +#: the first window, with:: + +#: map ctrl+n launch --location=neighbor some_program +#: map ctrl+f launch --location=first some_program + +#: For more details, see launch. + +# map kitty_mod+n new_os_window + +#: Works like new_window above, except that it opens a top level OS +#: kitty window. In particular you can use new_os_window_with_cwd to +#: open a window with the current working directory. + +# map kitty_mod+w close_window +# map kitty_mod+] next_window +# map kitty_mod+[ previous_window +# map kitty_mod+f move_window_forward +# map kitty_mod+b move_window_backward +# map kitty_mod+` move_window_to_top +# map kitty_mod+r start_resizing_window +# map kitty_mod+1 first_window +# map kitty_mod+2 second_window +# map kitty_mod+3 third_window +# map kitty_mod+4 fourth_window +# map kitty_mod+5 fifth_window +# map kitty_mod+6 sixth_window +# map kitty_mod+7 seventh_window +# map kitty_mod+8 eighth_window +# map kitty_mod+9 ninth_window +# map kitty_mod+0 tenth_window +#: }}} + +#: Tab management {{{ + +# map kitty_mod+right next_tab +# map kitty_mod+left previous_tab +# map kitty_mod+t new_tab +# map kitty_mod+q close_tab +# map shift+cmd+w close_os_window +# map kitty_mod+. move_tab_forward +# map kitty_mod+, move_tab_backward +# map kitty_mod+alt+t set_tab_title + +#: You can also create shortcuts to go to specific tabs, with 1 being +#: the first tab, 2 the second tab and -1 being the previously active +#: tab, and any number larger than the last tab being the last tab:: + +#: map ctrl+alt+1 goto_tab 1 +#: map ctrl+alt+2 goto_tab 2 + +#: Just as with new_window above, you can also pass the name of +#: arbitrary commands to run when using new_tab and use +#: new_tab_with_cwd. Finally, if you want the new tab to open next to +#: the current tab rather than at the end of the tabs list, use:: + +#: map ctrl+t new_tab !neighbor [optional cmd to run] +#: }}} + +#: Layout management {{{ + +# map kitty_mod+l next_layout + +#: You can also create shortcuts to switch to specific layouts:: + +#: map ctrl+alt+t goto_layout tall +#: map ctrl+alt+s goto_layout stack + +#: Similarly, to switch back to the previous layout:: + +#: map ctrl+alt+p last_used_layout + +#: There is also a toggle layout function that switches to the named +#: layout or back to the previous layout if in the named layout. +#: Useful to temporarily "zoom" the active window by switching to the +#: stack layout:: + +#: map ctrl+alt+z toggle_layout stack +#: }}} + +#: Font sizes {{{ + +#: You can change the font size for all top-level kitty OS windows at +#: a time or only the current one. + +# map kitty_mod+equal change_font_size all +2.0 +# map kitty_mod+minus change_font_size all -2.0 +# map kitty_mod+backspace change_font_size all 0 + +#: To setup shortcuts for specific font sizes:: + +#: map kitty_mod+f6 change_font_size all 10.0 + +#: To setup shortcuts to change only the current OS window's font +#: size:: + +#: map kitty_mod+f6 change_font_size current 10.0 +#: }}} + +#: Select and act on visible text {{{ + +#: Use the hints kitten to select text and either pass it to an +#: external program or insert it into the terminal or copy it to the +#: clipboard. + +# map kitty_mod+e open_url_with_hints + +#: Open a currently visible URL using the keyboard. The program used +#: to open the URL is specified in open_url_with. + +# map kitty_mod+p>f kitten hints --type path --program - + +#: Select a path/filename and insert it into the terminal. Useful, for +#: instance to run git commands on a filename output from a previous +#: git command. + +# map kitty_mod+p>shift+f kitten hints --type path + +#: Select a path/filename and open it with the default open program. + +# map kitty_mod+p>l kitten hints --type line --program - + +#: Select a line of text and insert it into the terminal. Use for the +#: output of things like: ls -1 + +# map kitty_mod+p>w kitten hints --type word --program - + +#: Select words and insert into terminal. + +# map kitty_mod+p>h kitten hints --type hash --program - + +#: Select something that looks like a hash and insert it into the +#: terminal. Useful with git, which uses sha1 hashes to identify +#: commits + +# map kitty_mod+p>n kitten hints --type linenum + +#: Select something that looks like filename:linenum and open it in +#: vim at the specified line number. + +# map kitty_mod+p>y kitten hints --type hyperlink + +#: Select a hyperlink (i.e. a URL that has been marked as such by the +#: terminal program, for example, by ls --hyperlink=auto). + + +#: The hints kitten has many more modes of operation that you can map +#: to different shortcuts. For a full description see kittens/hints. +#: }}} + +#: Miscellaneous {{{ + +# map kitty_mod+f11 toggle_fullscreen +# map kitty_mod+f10 toggle_maximized +# map kitty_mod+u kitten unicode_input +# map kitty_mod+f2 edit_config_file +# map kitty_mod+escape kitty_shell window + +#: Open the kitty shell in a new window/tab/overlay/os_window to +#: control kitty using commands. + +# map kitty_mod+a>m set_background_opacity +0.1 +# map kitty_mod+a>l set_background_opacity -0.1 +# map kitty_mod+a>1 set_background_opacity 1 +# map kitty_mod+a>d set_background_opacity default +# map kitty_mod+delete clear_terminal reset active + +#: You can create shortcuts to clear/reset the terminal. For example:: + +#: # Reset the terminal +#: map kitty_mod+f9 clear_terminal reset active +#: # Clear the terminal screen by erasing all contents +#: map kitty_mod+f10 clear_terminal clear active +#: # Clear the terminal scrollback by erasing it +#: map kitty_mod+f11 clear_terminal scrollback active +#: # Scroll the contents of the screen into the scrollback +#: map kitty_mod+f12 clear_terminal scroll active + +#: If you want to operate on all windows instead of just the current +#: one, use all instead of active. + +#: It is also possible to remap Ctrl+L to both scroll the current +#: screen contents into the scrollback buffer and clear the screen, +#: instead of just clearing the screen, for example, for ZSH add the +#: following to ~/.zshrc: + +#: .. code-block:: sh + +#: scroll-and-clear-screen() { +#: printf '\n%.0s' {1..$LINES} +#: zle clear-screen +#: } +#: zle -N scroll-and-clear-screen +#: bindkey '^l' scroll-and-clear-screen + +# map kitty_mod+f5 load_config_file + +#: Reload kitty.conf, applying any changes since the last time it was +#: loaded. Note that a handful of settings cannot be dynamically +#: changed and require a full restart of kitty. You can also map a +#: keybinding to load a different config file, for example:: + +#: map f5 load_config /path/to/alternative/kitty.conf + +#: Note that all setting from the original kitty.conf are discarded, +#: in other words the new conf settings *replace* the old ones. + +# map kitty_mod+f6 debug_config + +#: Show details about exactly what configuration kitty is running with +#: and its host environment. Useful for debugging issues. + + +#: You can tell kitty to send arbitrary (UTF-8) encoded text to the +#: client program when pressing specified shortcut keys. For example:: + +#: map ctrl+alt+a send_text all Special text + +#: This will send "Special text" when you press the ctrl+alt+a key +#: combination. The text to be sent is a python string literal so you +#: can use escapes like \x1b to send control codes or \u21fb to send +#: unicode characters (or you can just input the unicode characters +#: directly as UTF-8 text). The first argument to send_text is the +#: keyboard modes in which to activate the shortcut. The possible +#: values are normal or application or kitty or a comma separated +#: combination of them. The special keyword all means all modes. The +#: modes normal and application refer to the DECCKM cursor key mode +#: for terminals, and kitty refers to the special kitty extended +#: keyboard protocol. + +#: Another example, that outputs a word and then moves the cursor to +#: the start of the line (same as pressing the Home key):: + +#: map ctrl+alt+a send_text normal Word\x1b[H +#: map ctrl+alt+a send_text application Word\x1bOH + +#: }}} + +#: }}} diff --git a/.vimrc b/.vimrc index 7f425b2..436dcaa 100644 --- a/.vimrc +++ b/.vimrc @@ -25,7 +25,7 @@ let g:go_list_type = "quickfix" 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 syntax on autocmd FileType go nmap b (go-build) autocmd FileType go nmap i (go-info) autocmd FileType go nmap r (go-run) -- cgit v1.2.3 From de9baa2ddebf828e57809cdb41dddc3ee56cb29e Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 1 Dec 2021 10:26:52 +0100 Subject: updates --- .bashrc | 3 +++ .config/kitty/kitty.conf | 6 +++--- .profile | 1 + .vimrc | 15 ++++----------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.bashrc b/.bashrc index bec9d86..5c0cdee 100644 --- a/.bashrc +++ b/.bashrc @@ -32,6 +32,9 @@ fixab() { printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 "$1"; } #export LESS_TERMCAP_us=$(tput setaf 5) # underline (magenta) #export LESS_TERMCAP_ue=$'\E[0m' # end underline +# Less: use a 4-space tabulation +export LESS=Rx4 + # gnuplot display in terminal export GNUTERM='sixelgd enhanced truecolor font "arial,9"' diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index eca0bdf..3777c68 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -511,9 +511,9 @@ focus_follows_mouse yes #: Window layout {{{ -# remember_window_size yes -# initial_window_width 640 -# initial_window_height 400 +remember_window_size no +initial_window_width c640 +initial_window_height c480 #: If enabled, the window size will be remembered so that new #: instances of kitty will have the same size as the previous diff --git a/.profile b/.profile index 3e36ae3..a2ba42f 100644 --- a/.profile +++ b/.profile @@ -16,3 +16,4 @@ fi . "/opt/homebrew/etc/profile.d/bash_completion.sh" eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" +tabs -4 diff --git a/.vimrc b/.vimrc index 436dcaa..c2a5776 100644 --- a/.vimrc +++ b/.vimrc @@ -1,7 +1,7 @@ +" General vim defaults " set background= -"set t_te= t_ti= laststatus=2 set t_te= t_ti= ls=1 ruler - +set ai ts=4 sw=4 noet syntax off filetype on filetype plugin on @@ -35,21 +35,14 @@ autocmd FileType go nmap v (go-referrers) autocmd FileType go nmap n :cnext autocmd FileType go nmap p :cprevious autocmd FileType go nmap a :cclose -autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 +" autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 let g:netrw_browsex_viewer = "open" let g:netrw_gx = "" let g:netrw_banner = 0 -autocmd filetype javascript,html,json,yaml set ts=2 sts=2 sw=2 et +" autocmd filetype javascript,html,json,yaml set ts=2 sts=2 sw=2 et -" :set wm=2 linebreak -" :set term=ansi -":set modeline -":set modelines=5 -set autoindent -"set breakindent -" :set ts=2 sw=2 sts=2 et :set wrap :set linebreak :set nolist -- cgit v1.2.3 From ea345acc22fbb3a0ac36a7d1ea43de3dae0f51a1 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 2 Dec 2021 15:26:02 +0100 Subject: update --- .backupignore | 2 ++ .config/kitty/kitty.conf | 5 +++-- .vimrc | 3 ++- bin/backup | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.backupignore b/.backupignore index 8f44c0d..f899501 100644 --- a/.backupignore +++ b/.backupignore @@ -9,3 +9,5 @@ .npm/ .vm*/ go/pkg +*.lock +*.socket diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index 3777c68..34dc1b5 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -24,6 +24,7 @@ #: bold_italic_font Operator Mono Medium Italic # font_size 11.0 +# font_family Fira Code font_size 14.0 #: Font size (in pts) @@ -512,8 +513,8 @@ focus_follows_mouse yes #: Window layout {{{ remember_window_size no -initial_window_width c640 -initial_window_height c480 +initial_window_width 640 +initial_window_height 480 #: If enabled, the window size will be remembered so that new #: instances of kitty will have the same size as the previous diff --git a/.vimrc b/.vimrc index c2a5776..092b7a1 100644 --- a/.vimrc +++ b/.vimrc @@ -41,7 +41,8 @@ let g:netrw_browsex_viewer = "open" let g:netrw_gx = "" let g:netrw_banner = 0 -" autocmd filetype javascript,html,json,yaml set ts=2 sts=2 sw=2 et +" python and yaml formatting: +autocmd filetype python,yaml set ts=2 sts=2 sw=2 et :set wrap :set linebreak diff --git a/bin/backup b/bin/backup index adce78d..9de097f 100755 --- a/bin/backup +++ b/bin/backup @@ -3,7 +3,7 @@ backup() { date=$(date +%Y%m%d_%H%M%S) - last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) + last=$(rsync --list-only "$dest/" 2>/dev/null | awk '{r=$NF} END {print r}') case $last in ([12]*) opt_link=--link-dest=../$last;; -- cgit v1.2.3 From 0ef8a62a84932a70be06686c55205793921b783b Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 4 Dec 2021 15:20:25 +0100 Subject: update --- .backupignore | 18 ++++++++++++++++++ .config/kitty/kitty.conf | 1 + 2 files changed, 19 insertions(+) diff --git a/.backupignore b/.backupignore index f899501..b4667fa 100644 --- a/.backupignore +++ b/.backupignore @@ -11,3 +11,21 @@ go/pkg *.lock *.socket +*.db-wal +*.db-shm +httpstorages.* +SiriAnalytics.db +Application Support/Knowledge/ +IdentityServices/ +Library/Biome/ +Library/Calendars/ +Library/Saved Application State/ +Containers/com.adguard.* +Containers/com.apple.Safari/ +CoreSpotlight/ +Google/DriveFS/ +GoogleSoftwareUpdate/ +Group Containers/group.com.apple.secure-control-center-preferences/ +Safari/Databases/ +Safari/LocalStorage/ +Safari/Template Icons/ diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index 34dc1b5..c79faf1 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -482,6 +482,7 @@ focus_follows_mouse yes #: Terminal bell {{{ # enable_audio_bell yes +enable_audio_bell no #: Enable/disable the audio bell. Useful in environments that require #: silence. -- cgit v1.2.3 From e589eff80a403bfe7831c040fe55a6bcf5ba038b Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 6 Dec 2021 15:02:31 +0100 Subject: update --- .backupignore | 5 ++ .bashrc | 6 ++- .config/i3/config | 1 + .i3status.conf | 2 +- .otp_accounts.json.gpg | 70 +++++++++++++++++---------- .profile | 6 +-- .vimrc | 2 +- .xinitrc | 10 +++- bin/backup | 55 ++++++++++++--------- bin/backup-clean | 127 +++++++++++++++++++------------------------------ bin/byo | 4 +- bin/gauth | 6 +-- bin/p4a | 3 ++ 13 files changed, 161 insertions(+), 136 deletions(-) create mode 100644 .backupignore create mode 100755 bin/p4a diff --git a/.backupignore b/.backupignore new file mode 100644 index 0000000..ade7961 --- /dev/null +++ b/.backupignore @@ -0,0 +1,5 @@ +.*[Cc]ache/ +*[Cc]ache/ +CacheStorage/ +go/pkg/ +gopath/pkg/ diff --git a/.bashrc b/.bashrc index c086d45..f20fbdd 100644 --- a/.bashrc +++ b/.bashrc @@ -32,6 +32,8 @@ fixab() { printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 "$1"; } #export LESS_TERMCAP_us=$(tput setaf 5) # underline (magenta) #export LESS_TERMCAP_ue=$'\E[0m' # end underline +export BACKUP=bip:/home/backup/marc@yoda + # gnuplot display in terminal export GNUTERM='sixelgd enhanced truecolor font "arial,9"' @@ -47,7 +49,7 @@ alias ll='ls -AlFhv' alias vi='vim' alias view='vim -R' #alias op='xdg-open' -alias git='hub' +#alias git='hub' #alias go='go1.14.1' alias go11='go1.11.13' alias go12='go1.12.10' @@ -58,6 +60,7 @@ 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 kd='sudo cat /sys/kernel/debug/tracing/trace_pipe' #alias vi='vim' alias rvi='sudo vim' alias rxt='sudo xt' @@ -85,6 +88,7 @@ alias wai='~/go/src/github.co/traefik/whoami/whoami' # yaegi debug export YAEGI_DOT_CMD='dotty -' +export YAEGI_BPF=1 YAEGI_UNSAFE=1 YAEGI_SYSCALL=1 YAEGI_UNRESTRICTED=1 mosht() { mosh "$@" -- tmux new -A; } export -f mosht diff --git a/.config/i3/config b/.config/i3/config index 4a1136a..84f31c2 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -76,6 +76,7 @@ for_window [class="gnuplot_qt"] floating enable for_window [instance="gxditview"] floating enable for_window [class="Keybase"] floating enable for_window [class="libreoffice"] floating enable +for_window [class="Liferea"] floating enable for_window [class="llpp"] floating enable for_window [class="MuPDF"] floating enable for_window [class="Pavucontrol"] floating enable diff --git a/.i3status.conf b/.i3status.conf index 87656f8..7590d2b 100644 --- a/.i3status.conf +++ b/.i3status.conf @@ -93,8 +93,8 @@ 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" + #path = "/sys/class/hwmon/hwmon7/temp1_input" } tztime local { diff --git a/.otp_accounts.json.gpg b/.otp_accounts.json.gpg index bbf1956..e99f48a 100644 --- a/.otp_accounts.json.gpg +++ b/.otp_accounts.json.gpg @@ -1,27 +1,49 @@ -----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 +hQIMA+yVXrx81qjVAQ/+LlxKCUSXoeouLcdeA1hA6N52r66XXUmak1hdMuII2d1u +uOfnYaC6uhjohbGF+OoSS/bMSmTz2rSDaSKJFzFyjcB8HMV65ZBb/4dg7ujdugXI +47dkqvwJC/ipJ8FC86sXYVSVCPNHyvOfU8vA0F289v+40UJPWv8ocIM+ZCeCblxD +CK+FCpdVVWF5j20qn1CxlUWxUs4d2ztogYUKoWNUy2grKENhEmkqRkCYk85Macmn +zsO0tpRUuFlt3Lj07l2BGLb6ZIh2sRis/rv4NGLUgdwS+j3hLVQCcWiKZmhWdDcQ +KcNg2LdR95O6izwX9K2GAP9go5RSDc+kSnz5o0w0DepxDu75lf5cL77ndaTY9Bi/ +JdK1qE1VHrNRuJ1iOn2dDxFlQfFj2MnVABtG6h7BBlTQwz7lumYeuL4gM2m/Y5U9 +0p5/bSkt2ANIVCI+C8cukbMAdVaFxrUZ0J+Ir+RXnyF28ECBVfFfP6r4wLXYdbOp ++4sNo2x9wuBED1Qhkxp1lesRE1MUN9seJXMYM48HLDuRluSo+RQeK2FS1uc5c9kY +Ozjq3xehK7RqI0kBD5eW+BQzOrkq+YmMy7kYlH4uFx43tsE1Ie4BeEex3SReQcO1 +9BsNZPqEvd9eoa6hg/6rtiM7LCL3qs6xKUG3St1scw39O0oz4b2vpMZqw5dd8XuF +AYwD4gO8x2JTLcUBC/4lwe4w+sFiOiweYXUSDna+hDctogknBjx2e6vKxEmub87d +EMHjG2RIjbIOEu2Heyb24SphqSxe/dqi9vkj5hldUyN6ZLAcqOmYflGlLMkQN321 +Vn7fGnQM8da3n5tc3WBL4AdgmXhgj9bTbnVGiXL10MUGxkBtnc4hkGQwVMhyauot +02Sahrh0f9miunzbvH3Y00lZFc60ZOxInoIQdoBViEQ4pJztUHHrn5JKf2ajkGZS +e+PAwp0zi2JVl+2Rf039FRdghKeDdvZYobNV0GsBsRpbO5L5el+FHAZQwc/Yo7ya +AMhGb6Ewz/Lk5pWq4PbPJOUY3MvYrJOjDyCOz6DDEnuo5eoHwq2KmGGnkiiZ29Kf +dkcEsbxCM8twJa7N7LoBsGFesLw6uTz2BoIFVyTAHgxVxm85X5suiMgoPdxESXTj +gKY27mzessrxBoYMGjTThLJEOI4V4jlznA/1JJks24setxf03qd1FK5/dXNe87+I +3uFkNPUsyK7D5FtEMgbSw+gBAJW493F1qUTGrU5KmgNo94ApQcC9fKUwMzGbcLa6 +P43SxaM4qdq9gx9uIrjzAH4EZX7BE1H96pJfYrgoswdvPvGSjM4OYVxOANieN5xo +dkwQ1vHifSZ/xmEU6XdJPLEWr8oSFUhjjpd4C5jL2Xq9QLS/rLkyuV8ONck/FZkR +fQoNmLCWsllW1BpTlxArGUvwJsrR+l2/PXyU6VVXj8ntb1Wjl6MiL+JTv7vkPNyH +C56eoKORca0EtScVDMhIPWfn8wdeoroPr9eoSvyL/Dcol7spkHVbQ5jITwSwS9F8 +wUw9dxOn6chwbZqwSe7Sg/npNwaq+b0TEjGhwChu3vNIC4IgjOZYkkzGkC7z75Cq +9boUEvfo9Z4SO91PjKdrs8D+t/X5znqy+TmH0Ovr5y7FRqlZs7uf/CqeuSGNkomI +89x6aXM+081w/6zme1rnoPrMbTTLwuEX2wJ9Z4s9Zq8BrkC19h9cmKhZyd8yb9NU +KENQUdfSiNjmjLhT3vafPRvIt5nMyDmq/fir+e5fCHZS69+SoLm5x1U2VHD1NoBB +KvH8l8o5l4zBKsD1C1LiNzcIZ39N+xl83aFk1Y0WaKX/PFubztHj2iHKtaGBjJLk +OL/3kmQhNW8XWjS9swbrxIYRVfTLXoQ4npMCxY1dvViWpt0r7PbxJMcbjG1adEvk +HsmPQUhSHgjxaezd1it7kYu1GpgNEHW2grKMDt23p2QUEuU6beqrQ84A2HgCYei0 +TqUXk3W1NXAZAe9rSwJgwBBWidLfXGgNAoP0dDG1d9ANYFktC9gIt1ZLDPZWxs/x +v/dfMaO3/+C80ON5B1eK/ZpFc4WKboZMa9Aqzwav3XnXok/w+nazLa+FsgoROxSh +ZDO16Khr3hQ2bPf53Cj7FGJRUfmi3Jt/2na4rSrvjjhG6nNgZurIJE7ZW/ggIJ6f +GjdG0Ni8tzpTk5thI05gHDdY8JLZ/zwVZ1yUrhS5n9azDam2Oo+M4L20nxjrMnfE +nGNiYLZKpCn63y5W19eznm/8gPjp1Jh9UIhXrtii+a2rIXK9z6Y2a9oPqnxsO7s0 +dGgFLa/Wb7WHAfEmuJ5H0T+pRP22cVK7bxKvgRxhq8INTUCpm+I6dCXx3KU+v2XX +cp0/WK4KPDiEIlGjyVZBcF08wvmNG4yEtNqaJQ21FPrBE3reLq08gDdEvMdg5FDh +CPbexx0yoMiPU16SC7fPGo27j22OYQaWlMQBSA+951NWAMhdRY7c+5ehIO62aChn +/w7ww8Rxx6BBc4meBROtPnyCb4b/PMkWrmFp3h8qeUvvLKsxwrd32rglw332KrTz +F2Amnc7eiS9N7Y5uxjx6AOpIDyNovGpShY+ReFUp2kUnClMrQERz/gBF8SdFiBZj +Ud1V1FR7HoSp3rVpHUzv6c12DoyQiUkOOzJ6oCHV9NnOhB349wKtTpo671v5h6sK +dx6v9bCwKEFmRGZd6Vb+v7u0VY/t4I9iOQiGJm57Y0jUAS7HNxVMXEUgCrWXfzJh +T3enPB81c2Ohsp0FBVuxU+FucBY2B4h6qtcG3Uyne/Gq4TcWRYlt5/Em6IXojprm +0I6oD0UBjnXA +=OCjq -----END PGP MESSAGE----- diff --git a/.profile b/.profile index acb8299..cb09e87 100644 --- a/.profile +++ b/.profile @@ -5,6 +5,6 @@ PATH=~/bin:$PATH:~/go/bin [ "${SHELL##*/}" = bash ] && . ~/.bashrc # Last action: auto start X11 when logged on first console -#case $HOSTNAME in -#([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; -#esac +case $HOSTNAME in +([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; +esac diff --git a/.vimrc b/.vimrc index 68ae82a..1380fe8 100644 --- a/.vimrc +++ b/.vimrc @@ -8,7 +8,7 @@ filetype plugin on filetype plugin indent on let mapleader = "," -set rtp+=/opt/homebrew/opt/fzf +" set rtp+=/opt/homebrew/opt/fzf let g:fzf_preview = 'cat {}' " vimki plugin diff --git a/.xinitrc b/.xinitrc index 92f75e1..2ab853e 100644 --- a/.xinitrc +++ b/.xinitrc @@ -1,4 +1,10 @@ #!/bin/sh + +. /etc/X11/xinit/xinitrc.d/50-systemd-user.sh +#eval $(ssh-agent) +eval $(gnome-keyring-daemon --start) +export SSH_AUTH_SOCK + # start pulseaudio on crux only. Should be handled by systemd on arch #pulseaudio --start --exit-idle-time=-1 --log-target=syslog & @@ -20,5 +26,5 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -exec fvwm -#exec i3 +#exec fvwm +exec i3 diff --git a/bin/backup b/bin/backup index 72c69c3..3964927 100755 --- a/bin/backup +++ b/bin/backup @@ -1,36 +1,47 @@ #!/bin/sh -# Incremental backup using rsync(1). -[ "$USER" = root ] || exec sudo "$0" "$@" +usage() { + echo "Usage: $0 [-nv] [[[user@]host]:dir] -backup() { - date=$(date +%Y%m%d_%H%M%S) - last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) +Incremental backup using rsync(1). If run as root, a full system +backup is performed. Otherwise, the user's home directory is backed. - case $last in - ([12]*) opt_link=--link-dest=../$last;; - (*) opt_link=;; - esac +Options: +-n dry-run +-v verbose - rsync -HSxa$optv --exclude-from=$ignore $opt_link / /boot "$dest/$date" -} +Files: +- $HOME/.backupignore exclude files from user backup (non root) +- /etc/backupignore exclude files from system backup (root) -dest=/.history -ignore=/etc/backup/ignore +Environment: +- BACKUP backup directory" +} -while getopts :d:i:nv opt; do +while getopts :nv opt; do case $opt in - (d) dest="$OPTARG" ;; - (i) ignore="$OPTARG" ;; (n|v) optv="$opt$optv" ;; - (*) echo "Usage: $0 [-nv] [-d [host:]dir] [clean|diff]"; exit 1 ;; + (*) usage; exit 1 ;; esac done shift $((OPTIND - 1)) -[ "$1" ] && cmd=$1 && shift || cmd="" -case $cmd in -(""|save) backup ;; -(clean) exec backup-clean ${optv+-$optv} "$dest";; -(diff) exec diffdir "$@";; +BACKUP=${1:-$BACKUP} +[ "$BACKUP" ] || { usage; exit 1; } + +[ "$USER" = root ] && + ignore=/etc/backupignore volumes='/ /boot' || + ignore="$HOME/.backupignore" volumes="$HOME" +[ -f "$ignore" ] && ignore="--exclude-from=$ignore" || ignore= + +last=$(rsync --list-only "$BACKUP/" 2>/dev/null | awk '{r=$NF} END {print r}') +case $last in +([12]*) opt_link=--link-dest=../$last;; +(*) opt_link=;; esac + +date=$(date +%Y-%m-%d-%H%M%S) + +[ "$optv" ] && echo "# Backup $volumes to $BACKUP/$date" + +exec rsync -HSxa$optv $ignore $opt_link $volumes "$BACKUP/$date" diff --git a/bin/backup-clean b/bin/backup-clean index 30d25db..1c752d9 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -1,89 +1,62 @@ #!/bin/sh -# backup garbage collector -[ "$USER" = root ] || exec sudo "$0" "$@" -# Durations, in number of seconds. -hd=3600 # hour duration: 60s * 60 -h12=43200 # 12h: hd * 12 -dd=86400 # day duration: hd * 24 -wd=604800 # week duration: dd * 7 -md=2592000 # month duration: dd * 30 -yd=31557600 # year duration: dd * 365.25 +usage() { + echo "Usage: $0 [-nv] [[[user@]host:]dir] -now=$(date +'%Y%m%d_%H%M%S') +$0 removes old backups and keeps: +- backups for the current day +- 1 backup per past day for the current month +- 1 backup per past month for the current year +- 1 backup per past year -# The following works only for busybox date, not coreutils -# Kept for reference only. -#date2ts() { d=${1%_*} t=${1#*_}; date -d "$d${t%??}" +%s; } +Options: +-n dry run +-v verbose -# Convert date to timestamp, using date from GNU coreutils, -# works also with busybox date. -date2ts() { - t=$1; r=${t#????}; Y=${t%$r} # Year (with century) - t=$r; r=${t#??}; m=${t%$r} # Month - t=$r; r=${t#??}; d=${t%$r} # Day - t=${r#_}; r=${t#??}; H=${t%$r} # Hour - t=$r; r=${t#??}; M=${t%$r} # Minute - S=${t#??} # Second - date -d "$Y-$m-$d $H:$M:$S" +%s - #date -jf "%Y-%m-%d %H:%M:%S" "$Y-$m-$d $H:$M:$S" +%s # BSD, MacOS (not tested) +Environment variables: +- BACKUP - backup directory" } -ts2date() { date -d "@$1" +'%Y%m%d_%H%M%S'; } - -tsn=$(date2ts "$now") - -# Minimal retention delay in seconds, according to backup age, -# implemented using POSIX shell arithmetic. -retention_delay() { - d=$((tsn - $1)) - if [ $((d < h12)) = 1 ]; then - r=0 # keep all backups in the last 12 hours - elif [ $((d < dd)) = 1 ]; then - r=$hd # keep 1 backup per hour in the last day - elif [ $((d < wd)) = 1 ]; then - r=$dd # keep 1 backup per day in the last week - elif [ $((d < md)) = 1 ]; then - r=$wd # keep 1 backup per week in the last month - elif [ $((d < yd)) = 1 ]; then - r=$md # keep 1 backup per month in the last year - else - r=$yd # keep 1 backup per year in the previous years - fi - echo $r -} - -dest=/.history -while getopts :d:nv opt; do +while getopts :nv opt; do case $opt in - (d) tsn=$(date2ts "$OPTARG") ;; - (n) optn=1 ;; - (v) optv=1 ;; - (*) echo "Usage: $0 [-nv] [dir]"; exit 1 ;; + (n) optn=echo ;; + (v) optv=-t ;; + (*) usage; exit 1 ;; esac done -shift $((OPTIND - 1)) -[ "$1" ] && dest=$1 +shift $((OPTIND -1)) -# Sorted list of backups, most recent first. -lbu=$(ls -rv "$dest") -lasy=${lbu##* +BACKUP=${1:-$BACKUP} +[ "$BACKUP" ] || { usage; exit 1; } + +host=${BACKUP%:*} dir=${BACKUP#*:} +ls='ls -r' rm="xargs -r $optv $optn rm -rf" +[ "$host" = "$dir" ] || ls="ssh $host $ls" rm="ssh $host $rm" + +[ "$optv" ] && echo "# Cleaning backups on $BACKUP" + +$ls "$dir" | +awk -v now=$(date +%Y-%m-%d) -v dir="$dir" ' +BEGIN { + yn = substr(now, 1, 4) # Year now + mn = substr(now, 6, 2) # Month now + dn = substr(now, 9, 2) # Day now } -for d in $lbu; do - tsc=$(date2ts "$d") - if ! [ "$tsp" ]; then - [ "$optv" ] && echo "keep $dest/$d" - tsp=$tsc - continue - fi - mrd=$(retention_delay "$tsp") - dp=$((tsp - tsc)) - #if [ $((dp < mrd)) = 1 ]; then - if [ "$d" != "last" -a $((dp < mrd)) = 1 ]; then - [ "$optv" ] && echo "delete $dest/$d" - [ "$optn" ] || rm -rf "${dest:?}/$d" - else - [ "$optv" ] && echo "keep $dest/$d" - tsp=$tsc - fi -done +{ + yb = substr($0, 1, 4) # Year backup + mb = substr($0, 6, 2) # Month backup + db = substr($0, 9, 2) # Day backup + $0 = dir "/" $0 + + if (yb != yn) { + if (yb in yearly) print; else yearly[yb] = 1 + next + } + if (mb != mn) { + if (mb in monthly) print; else monthly[mb] = 1 + next + } + if (db != dn) { + if (db in dayly) print; else dayly[db] = 1 + } +}' | $rm diff --git a/bin/byo b/bin/byo index bc09fb8..93bb7f0 100755 --- a/bin/byo +++ b/bin/byo @@ -26,8 +26,8 @@ yoda_uuid='8c463221-6bb7-414e-9060-c9570bb3a6bb' dest=/mnt/backup/$(hostname) [ -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 +time backup -v "$dest" +# [ ! "$optC" ] || backup -v -d "$dest" clean [ ! "$optd" ] || time duperemove -drh --hashfile="$dest/.hashfile" "$dest" df -h / "$dest" ls -v "$dest" diff --git a/bin/gauth b/bin/gauth index 53ddf30..b18f73d 100755 --- a/bin/gauth +++ b/bin/gauth @@ -1,9 +1,9 @@ #!/bin/sh # Use backup from andOTP -# gpg -qd ~/.otp_accounts.json.gpg | -cat ~/otp_accounts.json | +# cat ~/.otp_accounts.json | +gpg -qd ~/.otp_accounts.json.gpg 2>/dev/null | jq -r '.[] | "\(.label) \(.secret)"' | while read -r l s; do echo "$l $(oathtool --totp -b "$s")" -done +done | column -t diff --git a/bin/p4a b/bin/p4a new file mode 100755 index 0000000..30e54ff --- /dev/null +++ b/bin/p4a @@ -0,0 +1,3 @@ +#!/bin/sh +adb forward tcp:8222 tcp:8022 +ssh ssh://u0_a250@localhost:8222 -- cgit v1.2.3 From 14b5c600034a9d52497af2974f30dafc21710282 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 6 Dec 2021 15:36:55 +0100 Subject: update --- .backupignore | 1 + .bashrc | 4 +- bin/backup | 57 ++++++++++++++---------- bin/backup-clean | 132 +++++++++++++++++++++++-------------------------------- 4 files changed, 91 insertions(+), 103 deletions(-) diff --git a/.backupignore b/.backupignore index b4667fa..a660b53 100644 --- a/.backupignore +++ b/.backupignore @@ -13,6 +13,7 @@ go/pkg *.socket *.db-wal *.db-shm +*- Google Drive httpstorages.* SiriAnalytics.db Application Support/Knowledge/ diff --git a/.bashrc b/.bashrc index 5c0cdee..c5bdc82 100644 --- a/.bashrc +++ b/.bashrc @@ -38,12 +38,12 @@ export LESS=Rx4 # gnuplot display in terminal export GNUTERM='sixelgd enhanced truecolor font "arial,9"' +export BACKUP=bip:/home/backup/marc@m1 + # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' #export TERMINAL=xt - -alias bu='backup -uvd bip:/home/backup/m1' #alias cl='cf xft:Mono:size=12' #alias cp='cp --reflink' #alias ls='ls --color=auto -v' diff --git a/bin/backup b/bin/backup index 9de097f..3964927 100755 --- a/bin/backup +++ b/bin/backup @@ -1,38 +1,47 @@ #!/bin/sh -# Incremental backup using rsync(1). -backup() { - date=$(date +%Y%m%d_%H%M%S) - last=$(rsync --list-only "$dest/" 2>/dev/null | awk '{r=$NF} END {print r}') +usage() { + echo "Usage: $0 [-nv] [[[user@]host]:dir] - case $last in - ([12]*) opt_link=--link-dest=../$last;; - (*) opt_link=;; - esac +Incremental backup using rsync(1). If run as root, a full system +backup is performed. Otherwise, the user's home directory is backed. - rsync -HSxa$optv --exclude-from=$ignore $opt_link $volumes "$dest/$date" -} +Options: +-n dry-run +-v verbose -dest=/.history -ignore=/etc/backupignore -volumes='/ /boot' +Files: +- $HOME/.backupignore exclude files from user backup (non root) +- /etc/backupignore exclude files from system backup (root) + +Environment: +- BACKUP backup directory" +} -while getopts :d:i:nuv opt; do +while getopts :nv opt; do case $opt in - (d) dest="$OPTARG" ;; - (i) ignore="$OPTARG" ;; (n|v) optv="$opt$optv" ;; - (u) optu=1 volumes="$HOME" ignore="$HOME/.backupignore" ;; - (*) echo "Usage: $0 [-nuv] [-d [[user@]host:]dir] [clean|diff]"; exit 1 ;; + (*) usage; exit 1 ;; esac done shift $((OPTIND - 1)) -[ "$optu" ] || [ "$USER" = root ] || exec sudo "$0" "$@" +BACKUP=${1:-$BACKUP} +[ "$BACKUP" ] || { usage; exit 1; } -[ "$1" ] && cmd=$1 && shift || cmd="" -case $cmd in -(""|save) backup ;; -(clean) exec backup-clean ${optv+-$optv} "$@" "$dest";; -(diff) exec diffdir "$@";; +[ "$USER" = root ] && + ignore=/etc/backupignore volumes='/ /boot' || + ignore="$HOME/.backupignore" volumes="$HOME" +[ -f "$ignore" ] && ignore="--exclude-from=$ignore" || ignore= + +last=$(rsync --list-only "$BACKUP/" 2>/dev/null | awk '{r=$NF} END {print r}') +case $last in +([12]*) opt_link=--link-dest=../$last;; +(*) opt_link=;; esac + +date=$(date +%Y-%m-%d-%H%M%S) + +[ "$optv" ] && echo "# Backup $volumes to $BACKUP/$date" + +exec rsync -HSxa$optv $ignore $opt_link $volumes "$BACKUP/$date" diff --git a/bin/backup-clean b/bin/backup-clean index 30d25db..f5baa29 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -1,89 +1,67 @@ #!/bin/sh -# backup garbage collector -[ "$USER" = root ] || exec sudo "$0" "$@" -# Durations, in number of seconds. -hd=3600 # hour duration: 60s * 60 -h12=43200 # 12h: hd * 12 -dd=86400 # day duration: hd * 24 -wd=604800 # week duration: dd * 7 -md=2592000 # month duration: dd * 30 -yd=31557600 # year duration: dd * 365.25 +usage() { + echo "Usage: $0 [-nv] [[[user@]host:]dir] -now=$(date +'%Y%m%d_%H%M%S') +$0 removes old backups and keeps: +- backups for the current day +- 1 backup per past day for the current month +- 1 backup per past month for the current year +- 1 backup per past year -# The following works only for busybox date, not coreutils -# Kept for reference only. -#date2ts() { d=${1%_*} t=${1#*_}; date -d "$d${t%??}" +%s; } +Options: +-n dry run +-v verbose -# Convert date to timestamp, using date from GNU coreutils, -# works also with busybox date. -date2ts() { - t=$1; r=${t#????}; Y=${t%$r} # Year (with century) - t=$r; r=${t#??}; m=${t%$r} # Month - t=$r; r=${t#??}; d=${t%$r} # Day - t=${r#_}; r=${t#??}; H=${t%$r} # Hour - t=$r; r=${t#??}; M=${t%$r} # Minute - S=${t#??} # Second - date -d "$Y-$m-$d $H:$M:$S" +%s - #date -jf "%Y-%m-%d %H:%M:%S" "$Y-$m-$d $H:$M:$S" +%s # BSD, MacOS (not tested) +Environment variables: +- BACKUP - backup directory" } -ts2date() { date -d "@$1" +'%Y%m%d_%H%M%S'; } - -tsn=$(date2ts "$now") - -# Minimal retention delay in seconds, according to backup age, -# implemented using POSIX shell arithmetic. -retention_delay() { - d=$((tsn - $1)) - if [ $((d < h12)) = 1 ]; then - r=0 # keep all backups in the last 12 hours - elif [ $((d < dd)) = 1 ]; then - r=$hd # keep 1 backup per hour in the last day - elif [ $((d < wd)) = 1 ]; then - r=$dd # keep 1 backup per day in the last week - elif [ $((d < md)) = 1 ]; then - r=$wd # keep 1 backup per week in the last month - elif [ $((d < yd)) = 1 ]; then - r=$md # keep 1 backup per month in the last year - else - r=$yd # keep 1 backup per year in the previous years - fi - echo $r -} - -dest=/.history -while getopts :d:nv opt; do +while getopts :nv opt; do case $opt in - (d) tsn=$(date2ts "$OPTARG") ;; - (n) optn=1 ;; - (v) optv=1 ;; - (*) echo "Usage: $0 [-nv] [dir]"; exit 1 ;; + (n) optn=echo ;; + (v) optv=-t ;; + (*) usage; exit 1 ;; esac done -shift $((OPTIND - 1)) -[ "$1" ] && dest=$1 +shift $((OPTIND -1)) + +BACKUP=${1:-$BACKUP} +[ "$BACKUP" ] || { usage; exit 1; } -# Sorted list of backups, most recent first. -lbu=$(ls -rv "$dest") -lasy=${lbu##* +host=${BACKUP%:*} dir=${BACKUP#*:} +ls='ls -r' rm="xargs -r $optv $optn rm -rf" +[ "$host" = "$dir" ] || ls="ssh $host $ls" rm="ssh $host $rm" + +[ "$optv" ] && echo "# Cleaning backups on $BACKUP" + +$ls "$dir" | +awk -v now=$(date +%Y-%m-%d) -v dir="$dir" ' +BEGIN { + yn = substr(now, 1, 4) # Year now + mn = substr(now, 6, 2) # Month now + dn = substr(now, 9, 2) # Day now } -for d in $lbu; do - tsc=$(date2ts "$d") - if ! [ "$tsp" ]; then - [ "$optv" ] && echo "keep $dest/$d" - tsp=$tsc - continue - fi - mrd=$(retention_delay "$tsp") - dp=$((tsp - tsc)) - #if [ $((dp < mrd)) = 1 ]; then - if [ "$d" != "last" -a $((dp < mrd)) = 1 ]; then - [ "$optv" ] && echo "delete $dest/$d" - [ "$optn" ] || rm -rf "${dest:?}/$d" - else - [ "$optv" ] && echo "keep $dest/$d" - tsp=$tsc - fi -done +{ + yb = substr($0, 1, 4) # Year backup + mb = substr($0, 6, 2) # Month backup + db = substr($0, 9, 2) # Day backup + $0 = dir "/" $0 + + dy = yn - yb + dm = dy * 12 + mn - mb + # if (yb != yn) { + if (dm > 12) + if (yb in yearly) print; else yearly[yb] = 1 + next + } + # if (mb != mn) { + dd = dm * 30 + dn - db + if (dd > 30) { + if (mb in monthly) print; else monthly[mb] = 1 + next + } + if (db != dn) { + if (db in dayly) print; else dayly[db] = 1 + } +}' | $rm -- cgit v1.2.3 From 4233fc9c6bc0f2f136a495efcd497394edd5156b Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 7 Dec 2021 14:50:57 +0100 Subject: update --- .backupignore | 5 +++++ bin/backup | 3 +-- bin/backup-clean | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.backupignore b/.backupignore index a660b53..3834dfa 100644 --- a/.backupignore +++ b/.backupignore @@ -13,7 +13,12 @@ go/pkg *.socket *.db-wal *.db-shm +*.old +*.log +*.o *- Google Drive +build/*/ +login.keychain-db httpstorages.* SiriAnalytics.db Application Support/Knowledge/ diff --git a/bin/backup b/bin/backup index 3964927..d682849 100755 --- a/bin/backup +++ b/bin/backup @@ -42,6 +42,5 @@ esac date=$(date +%Y-%m-%d-%H%M%S) -[ "$optv" ] && echo "# Backup $volumes to $BACKUP/$date" - +echo "# Backup $volumes to $BACKUP/$date" exec rsync -HSxa$optv $ignore $opt_link $volumes "$BACKUP/$date" diff --git a/bin/backup-clean b/bin/backup-clean index f5baa29..34e6d97 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -33,7 +33,7 @@ host=${BACKUP%:*} dir=${BACKUP#*:} ls='ls -r' rm="xargs -r $optv $optn rm -rf" [ "$host" = "$dir" ] || ls="ssh $host $ls" rm="ssh $host $rm" -[ "$optv" ] && echo "# Cleaning backups on $BACKUP" +echo "# Cleaning backups on $BACKUP" $ls "$dir" | awk -v now=$(date +%Y-%m-%d) -v dir="$dir" ' @@ -51,7 +51,7 @@ BEGIN { dy = yn - yb dm = dy * 12 + mn - mb # if (yb != yn) { - if (dm > 12) + if (dm > 12) { if (yb in yearly) print; else yearly[yb] = 1 next } -- cgit v1.2.3 From 2285a119864b87bc136035efa6f650d14aacbf12 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 9 Dec 2021 20:44:13 +0100 Subject: update --- .backupignore | 2 +- .bash-powerline.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.backupignore b/.backupignore index 3834dfa..579b72d 100644 --- a/.backupignore +++ b/.backupignore @@ -18,7 +18,6 @@ go/pkg *.o *- Google Drive build/*/ -login.keychain-db httpstorages.* SiriAnalytics.db Application Support/Knowledge/ @@ -28,6 +27,7 @@ Library/Calendars/ Library/Saved Application State/ Containers/com.adguard.* Containers/com.apple.Safari/ +Containers/com.ranchero.NetNewsWire-Evergreen/ CoreSpotlight/ Google/DriveFS/ GoogleSoftwareUpdate/ diff --git a/.bash-powerline.sh b/.bash-powerline.sh index 626157a..6d2ee2d 100644 --- a/.bash-powerline.sh +++ b/.bash-powerline.sh @@ -23,7 +23,7 @@ __powerline() { elif test -f '/etc/hostname'; then host=$( Date: Fri, 10 Dec 2021 12:15:36 +0100 Subject: update --- .bashrc | 10 ---------- .profile | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.bashrc b/.bashrc index c5bdc82..1a05028 100644 --- a/.bashrc +++ b/.bashrc @@ -144,13 +144,3 @@ meteo() { # 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}" - -PATH="/Users/marc/perl5/bin${PATH:+:${PATH}}"; export PATH; -PERL5LIB="/Users/marc/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; -PERL_LOCAL_LIB_ROOT="/Users/marc/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; -PERL_MB_OPT="--install_base \"/Users/marc/perl5\""; export PERL_MB_OPT; -PERL_MM_OPT="INSTALL_BASE=/Users/marc/perl5"; export PERL_MM_OPT; diff --git a/.profile b/.profile index a2ba42f..9811256 100644 --- a/.profile +++ b/.profile @@ -15,5 +15,5 @@ fi #esac . "/opt/homebrew/etc/profile.d/bash_completion.sh" -eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" + tabs -4 -- cgit v1.2.3 From ee915415941c712701d907fff92a73a7b296b682 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 18 Dec 2021 11:31:04 +0100 Subject: disable gopls, revert to vim --- .bashrc | 4 ++-- .vimrc | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.bashrc b/.bashrc index 1a05028..8e0b339 100644 --- a/.bashrc +++ b/.bashrc @@ -49,8 +49,8 @@ alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date #alias ls='ls --color=auto -v' alias ls='ls -GF' alias ll='ls -AlGFhv' -alias vi='nvim' -alias view='nvim -R' +alias vi='vim' +alias view='vim -R' alias ldd='otool -L' alias ibrew='arch -x86_64 /usr/local/bin/brew' #alias op='xdg-open' diff --git a/.vimrc b/.vimrc index 092b7a1..f002a86 100644 --- a/.vimrc +++ b/.vimrc @@ -18,12 +18,15 @@ autocmd filetype vimki set autowrite autocmd filetype vimki nmap z :FZF ~/Wiki " 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 = "gopls" -let g:go_gopls_gofumpt = 1 +"let g:go_def_mode = "gopls" +"let g:go_info_mode = "gopls" +"let g:go_list_type = "quickfix" +"let g:go_fmt_command = "gopls" +"let g:go_gopls_gofumpt = 1 + +let g:go_gopls_enabled = 0 +let g:go_def_mode = "godef" +let g:go_fmt_command = "goimports" let g:go_metalinter_command = "golangci-lint" "autocmd FileType go syntax on autocmd FileType go nmap b (go-build) -- cgit v1.2.3 From 6258df971a00f175cd434e7874c6ba5616b50e60 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 18 Dec 2021 11:37:10 +0100 Subject: update --- .backupignore | 3 +++ .vimrc | 36 +++++++++++++++++------------------- bin/backup | 3 +-- bin/backup-clean | 11 ++++++++--- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.backupignore b/.backupignore index ade7961..0a92520 100644 --- a/.backupignore +++ b/.backupignore @@ -3,3 +3,6 @@ CacheStorage/ go/pkg/ gopath/pkg/ +sigfox/vm/ +nvlib/ +dvlib/ diff --git a/.vimrc b/.vimrc index 1380fe8..8972385 100644 --- a/.vimrc +++ b/.vimrc @@ -1,14 +1,14 @@ +" General vim defaults " set background= -"set t_te= t_ti= laststatus=2 set t_te= t_ti= ls=1 ruler - +set ai ts=4 sw=4 noet syntax off filetype on filetype plugin on filetype plugin indent on let mapleader = "," -" set rtp+=/opt/homebrew/opt/fzf +"set rtp+=/opt/homebrew/opt/fzf let g:fzf_preview = 'cat {}' " vimki plugin @@ -18,14 +18,17 @@ autocmd filetype vimki set autowrite autocmd filetype vimki nmap z :FZF ~/Wiki " 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 = "gopls" -let g:go_gopls_gofumpt = 1 +"let g:go_def_mode = "gopls" +"let g:go_info_mode = "gopls" +"let g:go_list_type = "quickfix" +"let g:go_fmt_command = "gopls" +"let g:go_gopls_gofumpt = 1 + +let g:go_gopls_enabled = 0 +let g:go_def_mode = "godef" +let g:go_fmt_command = "goimports" let g:go_metalinter_command = "golangci-lint" -autocmd FileType go syntax on +"autocmd FileType go syntax on autocmd FileType go nmap b (go-build) autocmd FileType go nmap i (go-info) autocmd FileType go nmap r (go-run) @@ -35,21 +38,15 @@ autocmd FileType go nmap v (go-referrers) autocmd FileType go nmap n :cnext autocmd FileType go nmap p :cprevious autocmd FileType go nmap a :cclose -autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 +" autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 let g:netrw_browsex_viewer = "open" let g:netrw_gx = "" let g:netrw_banner = 0 -autocmd filetype javascript,html,json,yaml set ts=2 sts=2 sw=2 et +" python and yaml formatting: +autocmd filetype python,yaml set ts=2 sts=2 sw=2 et -" :set wm=2 linebreak -" :set term=ansi -":set modeline -":set modelines=5 -set autoindent -"set breakindent -" :set ts=2 sw=2 sts=2 et :set wrap :set linebreak :set nolist @@ -79,3 +76,4 @@ noremap n :bn noremap :bd noremap o :!open & noremap :tag +noremap :Files diff --git a/bin/backup b/bin/backup index 3964927..d682849 100755 --- a/bin/backup +++ b/bin/backup @@ -42,6 +42,5 @@ esac date=$(date +%Y-%m-%d-%H%M%S) -[ "$optv" ] && echo "# Backup $volumes to $BACKUP/$date" - +echo "# Backup $volumes to $BACKUP/$date" exec rsync -HSxa$optv $ignore $opt_link $volumes "$BACKUP/$date" diff --git a/bin/backup-clean b/bin/backup-clean index 1c752d9..34e6d97 100755 --- a/bin/backup-clean +++ b/bin/backup-clean @@ -33,7 +33,7 @@ host=${BACKUP%:*} dir=${BACKUP#*:} ls='ls -r' rm="xargs -r $optv $optn rm -rf" [ "$host" = "$dir" ] || ls="ssh $host $ls" rm="ssh $host $rm" -[ "$optv" ] && echo "# Cleaning backups on $BACKUP" +echo "# Cleaning backups on $BACKUP" $ls "$dir" | awk -v now=$(date +%Y-%m-%d) -v dir="$dir" ' @@ -48,11 +48,16 @@ BEGIN { db = substr($0, 9, 2) # Day backup $0 = dir "/" $0 - if (yb != yn) { + dy = yn - yb + dm = dy * 12 + mn - mb + # if (yb != yn) { + if (dm > 12) { if (yb in yearly) print; else yearly[yb] = 1 next } - if (mb != mn) { + # if (mb != mn) { + dd = dm * 30 + dn - db + if (dd > 30) { if (mb in monthly) print; else monthly[mb] = 1 next } -- cgit v1.2.3 From 053556962bb2d29ac76bcca51cabd1df238f80e3 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 7 Jan 2022 15:24:15 +0100 Subject: update --- .Xresources | 2 + .bashrc | 7 +- .config/i3/config | 4 +- .vim/plugin/cscope_maps.vim | 167 ++++++++++++++++++++++++++++ bin/hdmi | 8 +- bin/vm | 258 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 439 insertions(+), 7 deletions(-) create mode 100644 .vim/plugin/cscope_maps.vim create mode 100755 bin/vm diff --git a/.Xresources b/.Xresources index 7ca66a3..64ab14c 100644 --- a/.Xresources +++ b/.Xresources @@ -30,6 +30,8 @@ xterm*decTerminalID: vt340 xterm*allowWindowOps : False xterm*disallowedWindowOps : 1,2,3,4,5,6,7,8,9,11,13,18,19,20,21,GetSelection,SetSelection,SetWinLines,SetXprop +! Colors optimized for a light background +! ! Black + DarkGrey *color0: #000000 *color8: #555753 diff --git a/.bashrc b/.bashrc index f20fbdd..642c6d7 100644 --- a/.bashrc +++ b/.bashrc @@ -46,6 +46,7 @@ alias cl='cf xft:Mono:size=12' alias cp='cp --reflink' alias ls='ls --color=auto -v' alias ll='ls -AlFhv' +alias more='less' alias vi='vim' alias view='vim -R' #alias op='xdg-open' @@ -131,7 +132,9 @@ unset base # Display git status in prompt . ~/.bash-powerline.sh -# export PS1='; ' +# 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}" +#export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" + +eval "$(direnv hook bash)" diff --git a/.config/i3/config b/.config/i3/config index 84f31c2..182f119 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -68,6 +68,7 @@ for_window [class="Display"] floating enable for_window [class="Feedreader"] floating enable for_window [class="feh"] floating enable for_window [class="firefox"] floating enable +for_window [class="fluent-reader"] floating enable for_window [class="Geeqie"] floating enable for_window [class="Gpicview"] floating enable for_window [class="Ghb"] floating enable @@ -79,8 +80,9 @@ for_window [class="libreoffice"] floating enable for_window [class="Liferea"] floating enable for_window [class="llpp"] floating enable for_window [class="MuPDF"] floating enable -for_window [class="Pavucontrol"] floating enable for_window [class="Org.gnome.Software"] floating enable +for_window [class="Pavucontrol"] floating enable +for_window [title="QEMU"] floating enable for_window [class="Signal"] floating enable for_window [class="Slack"] floating enable for_window [class="Spotify"] floating enable diff --git a/.vim/plugin/cscope_maps.vim b/.vim/plugin/cscope_maps.vim new file mode 100644 index 0000000..abcae71 --- /dev/null +++ b/.vim/plugin/cscope_maps.vim @@ -0,0 +1,167 @@ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" CSCOPE settings for vim +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" This file contains some boilerplate settings for vim's cscope interface, +" plus some keyboard mappings that I've found useful. +" +" USAGE: +" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a +" 'plugin' directory in some other directory that is in your +" 'runtimepath'. +" +" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from +" your ~/.vimrc file (or cut and paste it into your .vimrc). +" +" NOTE: +" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim +" keeps timing you out before you can complete them, try changing your timeout +" settings, as explained below. +" +" Happy cscoping, +" +" Jason Duell jduell@alumni.princeton.edu 2002/3/7 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +" This tests to see if vim was configured with the '--enable-cscope' option +" when it was compiled. If it wasn't, time to recompile vim... +if has("cscope") + + """"""""""""" Standard cscope/vim boilerplate + + " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' + set cscopetag + + " check cscope for definition of a symbol before checking ctags: set to 1 + " if you want the reverse search order. + set csto=0 + + " add any cscope database in current directory + if filereadable("cscope.out") + cs add cscope.out + " else add the database pointed to by environment variable + elseif $CSCOPE_DB != "" + cs add $CSCOPE_DB + endif + + " show msg when any other cscope db added + set cscopeverbose + + + """"""""""""" My cscope/vim key mappings + " + " The following maps all invoke one of the following cscope search types: + " + " 's' symbol: find all references to the token under cursor + " 'g' global: find global definition(s) of the token under cursor + " 'c' calls: find all calls to the function name under cursor + " 't' text: find all instances of the text under cursor + " 'e' egrep: egrep search for the word under cursor + " 'f' file: open the filename under cursor + " 'i' includes: find files that include the filename under cursor + " 'd' called: find functions that function under cursor calls + " + " Below are three sets of the maps: one set that just jumps to your + " search result, one that splits the existing vim window horizontally and + " diplays your search result in the new window, and one that does the same + " thing, but does a vertical split instead (vim 6 only). + " + " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's + " unlikely that you need their default mappings (CTRL-\'s default use is + " as part of CTRL-\ CTRL-N typemap, which basically just does the same + " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use). + " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all + " of these maps to use other keys. One likely candidate is 'CTRL-_' + " (which also maps to CTRL-/, which is easier to type). By default it is + " used to switch between Hebrew and English keyboard mode. + " + " All of the maps involving the macro use '^$': this is so + " that searches over '#include " return only references to + " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all + " files that contain 'time.h' as part of their name). + + + " To do the first type of search, hit 'CTRL-\', followed by one of the + " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope + " search will be displayed in the current window. You can use CTRL-T to + " go back to where you were before the search. + " + + " MV: replace C-\ by C-, + nmap s :cs find s =expand("") + nmap g :cs find g =expand("") + nmap c :cs find c =expand("") + nmap t :cs find t =expand("") + nmap e :cs find e =expand("") + nmap f :cs find f =expand("") + nmap i :cs find i ^=expand("")$ + nmap d :cs find d =expand("") + + + " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type + " makes the vim window split horizontally, with search result displayed in + " the new window. + " + " (Note: earlier versions of vim may not have the :scs command, but it + " can be simulated roughly via: + " nmap s :cs find s =expand("") + + " MV: replace C-@ by C-; + nmap s :scs find s =expand("") + nmap g :scs find g =expand("") + nmap c :scs find c =expand("") + nmap t :scs find t =expand("") + nmap e :scs find e =expand("") + nmap f :scs find f =expand("") + nmap i :scs find i ^=expand("")$ + nmap d :scs find d =expand("") + + + " Hitting CTRL-space *twice* before the search type does a vertical + " split instead of a horizontal one (vim 6 and up only) + " + " (Note: you may wish to put a 'set splitright' in your .vimrc + " if you prefer the new window on the right instead of the left + + nmap s :vert scs find s =expand("") + nmap g :vert scs find g =expand("") + nmap c :vert scs find c =expand("") + nmap t :vert scs find t =expand("") + nmap e :vert scs find e =expand("") + nmap f :vert scs find f =expand("") + nmap i :vert scs find i ^=expand("")$ + nmap d :vert scs find d =expand("") + + + """"""""""""" key map timeouts + " + " By default Vim will only wait 1 second for each keystroke in a mapping. + " You may find that too short with the above typemaps. If so, you should + " either turn off mapping timeouts via 'notimeout'. + " + "set notimeout + " + " Or, you can keep timeouts, by uncommenting the timeoutlen line below, + " with your own personal favorite value (in milliseconds): + " + "set timeoutlen=4000 + " + " Either way, since mapping timeout settings by default also set the + " timeouts for multicharacter 'keys codes' (like ), you should also + " set ttimeout and ttimeoutlen: otherwise, you will experience strange + " delays as vim waits for a keystroke after you hit ESC (it will be + " waiting to see if the ESC is actually part of a key code like ). + " + "set ttimeout + " + " personally, I find a tenth of a second to work well for key code + " timeouts. If you experience problems and have a slow terminal or network + " connection, set it higher. If you don't set ttimeoutlen, the value for + " timeoutlent (default: 1000 = 1 second, which is sluggish) is used. + " + "set ttimeoutlen=100 + +endif + + diff --git a/bin/hdmi b/bin/hdmi index d6f206a..e6e3094 100755 --- a/bin/hdmi +++ b/bin/hdmi @@ -2,8 +2,8 @@ # Toggle auxiliary HDMI screen on/off when connected/disconnected. opt="--auto --left-of eDP1" -#opt="--auto --right-of eDP-1" -#opt="--auto --above eDP-1" +#opt="--auto --right-of eDP1" +#opt="--auto --above eDP1" # Also add the following rule to /etc/udev/rules.d/hdmi.rules # KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" @@ -11,5 +11,5 @@ opt="--auto --left-of eDP1" # wait for the screen to settle sleep 3 -xrandr | grep -q 'HDMI1 connected' || opt="--off" -xrandr --output HDMI1 $opt +xrandr | grep -q '^DP1 connected' || opt="--off" +xrandr --output DP1 $opt diff --git a/bin/vm b/bin/vm new file mode 100755 index 0000000..8b4da42 --- /dev/null +++ b/bin/vm @@ -0,0 +1,258 @@ +#!/bin/sh + +# Manage virtual machines +# +# Prereq: +# - curl +# - cdrtools (isoinfo) +# - expect +# - qemu +# - screen +# +# TODO: +# - extract bzImage and initrd.gz with isoinfo +# - ssh scripts to finish install (once ssh is ready) +# +# DONE: +# - setup vde and networking +# - setup ssh keys so it is possible to ssh in vm from host +# +unset CDPATH +export LC_ALL=C IFS=' +' + +version='vm-0.1' + +arch=$(uname -m) +sys=$(uname -s) +alpine_version='3.15.0' +pubkey=$HOME/.ssh/id_rsa.pub +dir="${VM_DIR:-$HOME/.vm}" + +console() { + usage 'console name' 'Attach a console to a virtual machine' && return + [ "$1" ] || die "missing argument" + is_running "$1" && screen -r "vm!$1!" +} + +create() { + usage 'create [-s size] name' 'Create an alpinelinux disk image' && return + size=8g + while getopts :s: opt; do + case $opt in + s) size=$OPTARG ;; + *) Opth=2 create_alpine_image; return ;; + esac + done + shift $((OPTIND - 1)) + [ -d "$dir/$1" ] && die "create failed: $dir/$1 already exists" + mkdir "$dir/$1" + cd "$dir/$1" || die "create failed: invalid directory $dir/$1" + qemu-img create "$1.raw" "$size" || die "create failed" + mac=$(new_macaddr) + ip=$(new_ip) + hdd="$1.raw" + echo "hdd=$hdd +mac=$mac +ip=$ip" >> config + + # Before install do not use virtio, as devices may not recognized as bootable + # TODO: alternate way: extract kernel and initrd files and pass them directly to qemu + screen -S "vm!$1!" -d -m qemu-system-$arch -nographic \ + -cdrom ../alpine-iso/alpine-virt-$alpine_version-$arch.iso \ + -hdd "$hdd" -net nic,macaddr=$mac -net vde + setup_alpine "$1" + post_setup_alpine "$1" +} + +die() { [ "$1" ] && echo "$0: $*" >&2; exit 1; } + +help() { + usage 'help' 'Print this help text' && return + printf "$version\n Manage virtual machines\n\nUsage: vm command [options] [args]\n" + Opth=1; for c in $Cmdlist; do $c; done +} + +init() { + mkdir -p "$dir" +} + +init_alpine_iso() { + usage init_alpine_iso '' && return + mkdir -p "$dir/alpine-iso" + iso_url="https://dl-cdn.alpinelinux.org/alpine/v${alpine_version%.*}/releases/$arch" + iso="alpine-virt-$alpine_version-$arch.iso" + cd "$dir/alpine-iso" + [ -f "$iso" ] || curl -LO "$iso_url/$iso" || rm -f "$iso" + echo "iso=$iso +" > config + echo 10 > ../index +} + +is_running() { screen -ls "vm!$1!" >/dev/null 2>&1; } + +ls() { + usage 'ls' 'list virtual machines' && return + init && cd "$dir" || die "could not change dir to $dir" + for i in */; do + i=${i%/} + [ "$i" = '*' ] && continue + is_running "$i" && state=active || state=stopped + printf "%-20s %s\n" "$i" "$state" + done +} + +new_ip() { + read index < $dir/index + index=$((index + 1)) + echo "$index" > $dir/index + echo "10.0.2.$index/24" +} + +new_macaddr() { printf 'de:ad:be:ef:%02x:%02x\n' $((RANDOM % 256)) $((RANDOM % 256)); } + +pidof() { + usage 'pidof name' 'print the PID of a virtual machine' && return + p=$(screen -ls "vm!$1!" | awk 'NR==2 {print substr($1, 1, index($1, ".")-1)}') + [ "$p" ] && pgrep -P $p +} + +post_setup_alpine() { + start "$1" + read proto key id < "$pubkey" + # echo ' + expect -c ' + set timeout -1 + spawn screen -x "vm!'$1'!" + expect { + " login: " { send "root\r"; exp_continue } + "Password: " { send "root\r"; exp_continue } + ":~# " + } + send "mkdir -pm 0700 .ssh\r" + expect ":~# " + send "echo '$proto' '$key' '$id' >.ssh/authorized_keys\r" + expect ":~# " + send "exit\r" + ' +} + +# setup_alpine automates alpine installation from iso to image. +# When done, base image system is ready, with storage and network up. +# No user nor ssh access configured yet. +# TODO: custom network (in case of no dhcp). +setup_alpine() { + usage 'setup_alpine' && return + expect -c ' + set timeout -1 + spawn screen -x "vm!'$1'!" + expect { + "localhost login: " { send "root\r"; exp_continue } + "localhost:~# " { send "SWAP_SIZE=0 setup-alpine\r"; exp_continue } + "Select keyboard layout: " { send "\r"; exp_continue } + "Enter system hostname" { send "'$1'\r"; exp_continue } + "Which one do you want to initialize?" { send "\r"; exp_continue } + "Ip address for eth0?" { send "'$ip'\r"; exp_continue } + "Gateway?" { send "10.0.2.2\r"; exp_continue } + "manual network configuration?" { send "\r"; exp_continue } + "DNS domain name?" { send "lan\r"; exp_continue } + "DNS nameserver(s)?" { send "10.0.2.2 1.1.1.1\r"; exp_continue } + "New password:" { send "root\r"; exp_continue } + "Retype password:" { send "root\r"; exp_continue } + "Which timezone are you in?" { send "\r"; exp_continue } + "HTTP/FTP proxy URL?" { send "\r"; exp_continue } + "Enter mirror number " { send "\r"; exp_continue } + "Which SSH server?" { send "\r"; exp_continue } + "Which disk(s) would you like to use?" { send "sda\r"; exp_continue } + "How would you like to use it?" { send "sys\r"; exp_continue } + "Erase the above disk(s) and continue?" { send "y\r"; exp_continue } + "Installation is complete" { send "poweroff\r" } + } + interact + ' +} + +start_vde() { + usage start_vde && return + sudo sh <<- EOT + vde_switch -tap tap0 -sock /tmp/vde.ctl -daemon -mod 666 + sleep 1 + ip address add 10.0.2.2/24 dev tap0 + ip link set tap0 up + echo 1 > /proc/sys/net/ipv4/ip_forward + iptables -t nat -A POSTROUTING -s 10.0.2.0/24 -o eth0 -j MASQUERADE + iptables -t nat -A POSTROUTING -s 10.0.2.0/24 -o wlan0 -j MASQUERADE + EOT + #slirpvde --dhcp --daemon +} + +stop_vde() { + # killall slirpvde + sudo sh <<- EOT + iptables -t nat -D POSTROUTING -s 10.0.2.0/24 -o eth0 -j MASQUERADE + iptables -t nat -D POSTROUTING -s 10.0.2.0/24 -o wlan0 -j MASQUERADE + ip link set tap0 down + killall vde_switch + EOT +} + +start() { + usage 'start [-acd] name' 'start a virtual machine' && return + while getopts :acd opt; do + case $opt in + a) opta=1 ;; + c) boot=c ;; + d) boot=d ;; + esac + done + shift $((OPTIND -1)) + [ "$1" ] || die 'start failed: name missing' + cd "$dir/$1" || die "start failed: invalid directory $dir/$1" + is_running "$1" || start_qemu "$1" + [ "$opta" ] && console "$1" +} + +start_qemu() ( + opt='-nographic -cpu max' + [ "$sys" = Linux ] && opt="$opt -enable-kvm" + . ./config || die "could not source $PWD/config" + exec 1>>qemu.log 2>&1 + date +%F_%T + set -x + screen -S "vm!$1!" -d -m qemu-system-$arch $opt \ + ${smp+-smp $smp} \ + ${ram+-m $ram} \ + ${mac+-net nic,macaddr=$mac,model=virtio-net-pci} -net vde \ + ${hdd+-drive file="$hdd",if=virtio,media=disk,format=raw} \ + ${iso+-drive file="$iso",if=virtio,media=cdrom,format=raw} \ + ${boot+-boot $boot} +) + +stop() { + usage 'stop name' 'stop a virtual machine' && return + is_running "$1" && kill "$(pidof "$1")" +} + +usage() { + case $Opth in + 1) printf " %-34s %s\n" "$1" "$2" ;; + 2) printf "$0 $1\n\t$2\n" ;; + *) return 1 ;; + esac +} + +version() { + usage 'version' 'Print version' && return + echo "$version" +} + +Cmdlist='console create help init_alpine_iso ls pidof setup_alpine start start_vde stop version' +[ "$1" ] && C=$1 && shift 1 || { help; exit 1; } +#for c in $Cmdlist; do +# case $c in +# ("$C") cmd=$c; break ;; +# ("$C"*) [ "$cmd" ] && die "ambiguous command $C" || cmd=$c ;; +# esac +#done +cmd=$C +[ "$cmd" ] || { help; exit 1; } && $cmd "$@" -- cgit v1.2.3 From e200c8d78ca1d3388c25c1cef8892b1dd015bbf7 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 28 Jan 2022 12:19:59 +0100 Subject: update --- .bashrc | 6 ++++-- .profile | 2 +- bin/vm | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.bashrc b/.bashrc index 8e0b339..c977a96 100644 --- a/.bashrc +++ b/.bashrc @@ -86,8 +86,8 @@ alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' alias by='go build ./cmd/yaegi' alias cy='cd ~/go/src/github.com/traefik/yaegi' #alias ty='go test -v -short ./interp' -alias ya='rlwrap -pblue yaegi' -alias dya='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi' +alias y='rlwrap -pblue yaegi' +alias dy='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi' alias wai='~/go/src/github.co/traefik/whoami/whoami' # yaegi debug @@ -144,3 +144,5 @@ meteo() { # Display git status in prompt . ~/.bash-powerline.sh + +export GITHUB_TOKEN=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 diff --git a/.profile b/.profile index 9811256..fb64b2e 100644 --- a/.profile +++ b/.profile @@ -1,6 +1,6 @@ # ~/.profile -PATH=~/bin:/opt/homebrew/bin:/opt/homebrew/opt/ruby/bin:$PATH:~/go/bin:~/.cargo/bin +PATH=~/bin:/opt/homebrew/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/tcl-tk/bin:$PATH:~/go/bin:~/.cargo/bin if [ -z "$SSH_AUTH_SOCK" ] ; then eval `ssh-agent -s` diff --git a/bin/vm b/bin/vm index 97e3521..6b03d0e 100755 --- a/bin/vm +++ b/bin/vm @@ -242,7 +242,8 @@ start_vm() ( "$dir/vftool" \ ${kernel+-k "$kernel"} \ ${initrd+-i "$initrd"} \ - ${hdd+-d "$hdd"} \ + ${hda+-d "$hda"} \ + ${hdb+-d "$hdb"} \ ${iso+-c "$iso"} \ ${cpu+-p "$cpu"} \ ${ram+-m "$ram"} \ -- cgit v1.2.3 From a3a3a61742950d45f1573a45a928e9b04c115634 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 3 Feb 2022 14:43:32 +0100 Subject: update --- .config/i3/config | 4 +++- .profile | 6 +++--- .xsession | 6 ++++-- bin/hdmi | 10 +++++----- bin/vm | 30 +++++++++++++++++++++++++++++- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 182f119..5284bcc 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -59,6 +59,8 @@ bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOU # enable floating mode for_window [class="Arandr"] floating enable for_window [class="Brave-browser"] floating enable +for_window [class="Blueberry.py"] floating enable +for_window [class="Blueman-manager"] floating enable for_window [class="Chromium"] floating enable for_window [title="Task Manager - Chromium"] floating enable for_window [title="Gestionnaire de tâches – Chromium"] floating enable @@ -68,7 +70,7 @@ for_window [class="Display"] floating enable for_window [class="Feedreader"] floating enable for_window [class="feh"] floating enable for_window [class="firefox"] floating enable -for_window [class="fluent-reader"] floating enable +for_window [class="fluent-reader"] floating enable border normal for_window [class="Geeqie"] floating enable for_window [class="Gpicview"] floating enable for_window [class="Ghb"] floating enable diff --git a/.profile b/.profile index cb09e87..acb8299 100644 --- a/.profile +++ b/.profile @@ -5,6 +5,6 @@ PATH=~/bin:$PATH:~/go/bin [ "${SHELL##*/}" = bash ] && . ~/.bashrc # Last action: auto start X11 when logged on first console -case $HOSTNAME in -([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; -esac +#case $HOSTNAME in +#([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; +#esac diff --git a/.xsession b/.xsession index 92f75e1..278c5fc 100755 --- a/.xsession +++ b/.xsession @@ -2,6 +2,8 @@ # start pulseaudio on crux only. Should be handled by systemd on arch #pulseaudio --start --exit-idle-time=-1 --log-target=syslog & +eval $(ssh-agent) + # 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 @@ -20,5 +22,5 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -exec fvwm -#exec i3 +#exec fvwm +exec i3 diff --git a/bin/hdmi b/bin/hdmi index e6e3094..0a81716 100755 --- a/bin/hdmi +++ b/bin/hdmi @@ -1,9 +1,9 @@ #!/bin/sh # Toggle auxiliary HDMI screen on/off when connected/disconnected. -opt="--auto --left-of eDP1" -#opt="--auto --right-of eDP1" -#opt="--auto --above eDP1" +opt="--auto --left-of eDP-1" +#opt="--auto --right-of eDP-1" +#opt="--auto --above eDP-1" # Also add the following rule to /etc/udev/rules.d/hdmi.rules # KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" @@ -11,5 +11,5 @@ opt="--auto --left-of eDP1" # wait for the screen to settle sleep 3 -xrandr | grep -q '^DP1 connected' || opt="--off" -xrandr --output DP1 $opt +xrandr | grep -q '^DP-1 connected' || opt="--off" +xrandr --output DP-1 $opt diff --git a/bin/vm b/bin/vm index 8b4da42..35a107e 100755 --- a/bin/vm +++ b/bin/vm @@ -35,13 +35,41 @@ console() { is_running "$1" && screen -r "vm!$1!" } +create_arch() { + usage 'create_arch [-s size] name' 'Create an archlinux disk image' && return + size=8g + while getopts :s: opt; do + case $opt in + s) size=$OPTARG ;; + *) Opth=2 create_arch; return ;; + esac + done + shift $((OPTIND - 1)) + [ -d "$dir/$1" ] && die "create failed: $dir/$1 already exists" + mkdir "$dir/$1" + cd "$dir/$1" || die "create failed: invalid directory $dir/$1" + qemu-img create "$1.raw" "$size" || die "create failed" + mac=$(new_macaddr) + ip=$(new_ip) + hdd="$1.raw" + echo "hdd=$hdd +mac=$mac +ip=$ip" >> config + + mkfs.ext4 "$1.raw" + mkdir -p mnt + sudo mount "$1.raw" mnt + sudo pacstrap mnt base base-devel + sudo umount mnt +} + create() { usage 'create [-s size] name' 'Create an alpinelinux disk image' && return size=8g while getopts :s: opt; do case $opt in s) size=$OPTARG ;; - *) Opth=2 create_alpine_image; return ;; + *) Opth=2 create_arch; return ;; esac done shift $((OPTIND - 1)) -- cgit v1.2.3 From 8867b0a2d59bb6a2747a54c89a772cc5443308a5 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 5 Feb 2022 16:26:29 +0100 Subject: update --- .zsh-powerline.sh | 82 -------------------------------------------------- .zshrc | 71 ------------------------------------------- bin/update_kernel_host | 5 +++ 3 files changed, 5 insertions(+), 153 deletions(-) delete mode 100644 .zsh-powerline.sh delete mode 100644 .zshrc diff --git a/.zsh-powerline.sh b/.zsh-powerline.sh deleted file mode 100644 index e3f05f1..0000000 --- a/.zsh-powerline.sh +++ /dev/null @@ -1,82 +0,0 @@ -# Colorscheme -readonly COLOR_CWD='blue' -readonly COLOR_GIT='cyan' -#readonly COLOR_SUCCESS='green' -readonly COLOR_SUCCESS='blue' -readonly COLOR_FAILURE='red' -#readonly COLOR_TIME='cyan' - -readonly SYMBOL_GIT_BRANCH='⑂' -readonly SYMBOL_GIT_MODIFIED='*' -readonly SYMBOL_GIT_PUSH='↑' -readonly SYMBOL_GIT_PULL='↓' -readonly PS_SYMBOL='$' - -_git_info() { - hash git 2>/dev/null || return # git not found - - # get current branch - local ref=$(git symbolic-ref --short HEAD 2>/dev/null) - - if [[ -n "$ref" ]]; then - # prepend branch symbol - ref=$SYMBOL_GIT_BRANCH$ref - else - # get most recent tag or abbreviated unique hash - ref=$(git describe --tags --always 2>/dev/null) - fi - - [[ -n "$ref" ]] || return # not a git repo - - local marks - - # scan first two lines of output from `git status` - while IFS= read -r line; do - if [[ $line =~ ^## ]]; then # header line - [[ $line =~ ahead\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PUSH$match[1]" - [[ $line =~ behind\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PULL$match[1]" - else # branch is modified if output contains more lines after the header line - marks="$SYMBOL_GIT_MODIFIED$marks" - break - fi - done < <(git status --porcelain --branch 2>/dev/null) # note the space between the two < - - # print without a trailing newline - printf " $ref$marks" -} - - -_config_prompt() { - # Color coding based on exit code of the previous command. Note this must - # be dealt with in the beginning of the function, otherwise the $? will not - # match the right command executed. - - if [[ $? -eq 0 ]]; then - local symbol="%F{$COLOR_SUCCESS}$PS_SYMBOL%f" - else - local symbol="%F{$COLOR_FAILURE}$PS_SYMBOL%f" - fi - - #local cwd="%F{$COLOR_CWD}%~%f" - local cwd="%F{$COLOR_CWD}%2~%f" - local git="%F{$COLOR_GIT}$(_git_info)%f" - #local time="%F{$COLOR_TIME}%D{%H:%M:%S}%f" - - PROMPT="$cwd$git $symbol " - #RPROMPT="$time" -} - - -# useful zsh hook functions - -precmd() { # run before each prompt - _config_prompt -} - - -preexec() { # run after user command is read and about to execute -} - - -chpwd() { # run when changing current working directory -} diff --git a/.zshrc b/.zshrc deleted file mode 100644 index fc3b9f9..0000000 --- a/.zshrc +++ /dev/null @@ -1,71 +0,0 @@ -# Environment -export YAEGI_DOT_CMD='dotty -' -export YAEGI_UNSAFE=1 -export YAEGI_UNRESTRICTED=1 -export YAEGI_SYSCALL=1 - -# gnuplot display in terminal -export GNUTERM='sixelgd enhanced truecolor font "arial,9"' - -# Terraform-perf -export TFP=$HOME/src/github.com/traefik/terraform-perf - -# Auto completion -FPATH=/opt/homebrew/share/zsh-completions:/opt/homebrew/share/zsh/site-functions:$FPATH -autoload -Uz compinit && compinit - -setopt share_history - -# Aliases -alias pt='sudo port -v' -alias pu='pt selfupdate && pt upgrade outdated' - -alias by='go build ./cmd/yaegi' -alias cy='cd ~/go/src/github.com/traefik/yaegi' -alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' -#alias git='hub' -alias ll='ls -AFGl' -alias ls='ls -AG' -alias ya='rlwrap yaegi' - -# Functions -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" -} - -p() { [ -f "$1" -a ! -x "$1" ] && less -XF $1 || "$@" 2>&1 | less -XF ; } - -ty() { go test -v -short ./interp; } - -# Term title management -function set-term-title-precmd() { - emulate -L zsh - print -rn -- $'\e]0;'${(V%):-'%~'}$'\a' >$TTY -} - -function set-term-title-preexec() { - emulate -L zsh - print -rn -- $'\e]0;'${(V)1}$'\a' >$TTY -} - -autoload -Uz add-zsh-hook -add-zsh-hook preexec set-term-title-preexec -add-zsh-hook precmd set-term-title-precmd -set-term-title-precmd - -# Prompt -source ~/.zsh-powerline.sh - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - - -# test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" - diff --git a/bin/update_kernel_host b/bin/update_kernel_host index 6180921..d159417 100755 --- a/bin/update_kernel_host +++ b/bin/update_kernel_host @@ -2,6 +2,11 @@ # After 'apk upgrade', update kernel and initrd on VM host +if [ -f /etc/arch-release ]; then + scp /boot/Image /boot/Image /boot/initramfs-linux.img marc@m1:.vm/a1 + exit +fi + sudo cp /boot/initramfs-virt /tmp sudo chmod a+r /tmp/initramfs-virt gunzip < /boot/vmlinuz-virt > /tmp/vmlinux -- cgit v1.2.3 From 342712955e9b65f2de134fa6542f97095a59e438 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 7 Feb 2022 09:19:12 +0100 Subject: update --- bin/update_kernel_host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/update_kernel_host b/bin/update_kernel_host index d159417..4f2cbbf 100755 --- a/bin/update_kernel_host +++ b/bin/update_kernel_host @@ -3,7 +3,7 @@ # After 'apk upgrade', update kernel and initrd on VM host if [ -f /etc/arch-release ]; then - scp /boot/Image /boot/Image /boot/initramfs-linux.img marc@m1:.vm/a1 + scp /boot/Image /boot/initramfs-linux.img marc@m1:.vm/a1 exit fi -- cgit v1.2.3 From e0b3f54298ebca6e23e631c02764f96f60733f60 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 9 Feb 2022 23:31:58 +0100 Subject: update --- .bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index 00fdd0a..fdc3d6c 100644 --- a/.bashrc +++ b/.bashrc @@ -33,7 +33,7 @@ fixab() { printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 "$1"; } #export LESS_TERMCAP_ue=$'\E[0m' # end underline export BACKUP=bip:/home/backup/marc@$(hostname -s) -export LESS=Rx4 +export LESS=XFRx4 # gnuplot display in terminal export GNUTERM='sixelgd enhanced truecolor font "arial,9"' @@ -44,7 +44,7 @@ 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 cp='cp --reflink' alias ls='ls --color=auto -v' alias ll='ls -AlFhv' alias more='less' -- cgit v1.2.3 From 1e1a1087f799632c021af612eb3c919cf1143237 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 10 Feb 2022 15:27:15 +0100 Subject: vim: improve cscope mappings --- .vimrc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.vimrc b/.vimrc index 8972385..8faef1d 100644 --- a/.vimrc +++ b/.vimrc @@ -77,3 +77,25 @@ noremap :bd noremap o :!open & noremap :tag noremap :Files + +""""""""""""" My cscope/vim key mappings + " + " The following maps all invoke one of the following cscope search types: + " + " 's' symbol: find all references to the token under cursor + " 'g' global: find global definition(s) of the token under cursor + " 'c' calls: find all calls to the function name under cursor + " 't' text: find all instances of the text under cursor + " 'e' egrep: egrep search for the word under cursor + " 'f' file: open the filename under cursor + " 'i' includes: find files that include the filename under cursor + " 'd' called: find functions that function under cursor calls + +noremap s :cs find s =expand("") +noremap g :cs find g =expand("") +noremap c :cs find c =expand("") +noremap t :cs find t =expand("") +noremap e :cs find e =expand("") +noremap i :cs find i =expand("") +noremap f :cs find f =expand("") +noremap d :cs find d =expand("") -- cgit v1.2.3 From c3779261fadc809c2785401dc42009c5d55cebba Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 10 Mar 2022 09:18:57 +0100 Subject: vim: improve cscope --- .bashrc | 10 +-- .vim/plugin/cscope_maps.vim | 167 -------------------------------------------- .vimrc | 28 +++++--- 3 files changed, 23 insertions(+), 182 deletions(-) delete mode 100644 .vim/plugin/cscope_maps.vim diff --git a/.bashrc b/.bashrc index fdc3d6c..09ac7b2 100644 --- a/.bashrc +++ b/.bashrc @@ -50,7 +50,7 @@ alias ll='ls -AlFhv' alias more='less' alias vi='vim' alias view='vim -R' -alias ldd='otool -L' +#alias ldd='otool -L' # Darwin only alias ibrew='arch -x86_64 /usr/local/bin/brew' #alias op='xdg-open' #alias git='hub' @@ -133,12 +133,8 @@ meteo() { #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 +[ -f "/usr/share/fzf/completion.bash" ] && . "/usr/share/fzf/completion.bash" +[ -f "/usr/share/fzf/key-bindings.bash" ] && . "/usr/share/fzf/key-bindings.bash" # 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 diff --git a/.vim/plugin/cscope_maps.vim b/.vim/plugin/cscope_maps.vim deleted file mode 100644 index abcae71..0000000 --- a/.vim/plugin/cscope_maps.vim +++ /dev/null @@ -1,167 +0,0 @@ -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" CSCOPE settings for vim -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" -" This file contains some boilerplate settings for vim's cscope interface, -" plus some keyboard mappings that I've found useful. -" -" USAGE: -" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a -" 'plugin' directory in some other directory that is in your -" 'runtimepath'. -" -" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from -" your ~/.vimrc file (or cut and paste it into your .vimrc). -" -" NOTE: -" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim -" keeps timing you out before you can complete them, try changing your timeout -" settings, as explained below. -" -" Happy cscoping, -" -" Jason Duell jduell@alumni.princeton.edu 2002/3/7 -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - - -" This tests to see if vim was configured with the '--enable-cscope' option -" when it was compiled. If it wasn't, time to recompile vim... -if has("cscope") - - """"""""""""" Standard cscope/vim boilerplate - - " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' - set cscopetag - - " check cscope for definition of a symbol before checking ctags: set to 1 - " if you want the reverse search order. - set csto=0 - - " add any cscope database in current directory - if filereadable("cscope.out") - cs add cscope.out - " else add the database pointed to by environment variable - elseif $CSCOPE_DB != "" - cs add $CSCOPE_DB - endif - - " show msg when any other cscope db added - set cscopeverbose - - - """"""""""""" My cscope/vim key mappings - " - " The following maps all invoke one of the following cscope search types: - " - " 's' symbol: find all references to the token under cursor - " 'g' global: find global definition(s) of the token under cursor - " 'c' calls: find all calls to the function name under cursor - " 't' text: find all instances of the text under cursor - " 'e' egrep: egrep search for the word under cursor - " 'f' file: open the filename under cursor - " 'i' includes: find files that include the filename under cursor - " 'd' called: find functions that function under cursor calls - " - " Below are three sets of the maps: one set that just jumps to your - " search result, one that splits the existing vim window horizontally and - " diplays your search result in the new window, and one that does the same - " thing, but does a vertical split instead (vim 6 only). - " - " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's - " unlikely that you need their default mappings (CTRL-\'s default use is - " as part of CTRL-\ CTRL-N typemap, which basically just does the same - " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use). - " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all - " of these maps to use other keys. One likely candidate is 'CTRL-_' - " (which also maps to CTRL-/, which is easier to type). By default it is - " used to switch between Hebrew and English keyboard mode. - " - " All of the maps involving the macro use '^$': this is so - " that searches over '#include " return only references to - " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all - " files that contain 'time.h' as part of their name). - - - " To do the first type of search, hit 'CTRL-\', followed by one of the - " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope - " search will be displayed in the current window. You can use CTRL-T to - " go back to where you were before the search. - " - - " MV: replace C-\ by C-, - nmap s :cs find s =expand("") - nmap g :cs find g =expand("") - nmap c :cs find c =expand("") - nmap t :cs find t =expand("") - nmap e :cs find e =expand("") - nmap f :cs find f =expand("") - nmap i :cs find i ^=expand("")$ - nmap d :cs find d =expand("") - - - " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type - " makes the vim window split horizontally, with search result displayed in - " the new window. - " - " (Note: earlier versions of vim may not have the :scs command, but it - " can be simulated roughly via: - " nmap s :cs find s =expand("") - - " MV: replace C-@ by C-; - nmap s :scs find s =expand("") - nmap g :scs find g =expand("") - nmap c :scs find c =expand("") - nmap t :scs find t =expand("") - nmap e :scs find e =expand("") - nmap f :scs find f =expand("") - nmap i :scs find i ^=expand("")$ - nmap d :scs find d =expand("") - - - " Hitting CTRL-space *twice* before the search type does a vertical - " split instead of a horizontal one (vim 6 and up only) - " - " (Note: you may wish to put a 'set splitright' in your .vimrc - " if you prefer the new window on the right instead of the left - - nmap s :vert scs find s =expand("") - nmap g :vert scs find g =expand("") - nmap c :vert scs find c =expand("") - nmap t :vert scs find t =expand("") - nmap e :vert scs find e =expand("") - nmap f :vert scs find f =expand("") - nmap i :vert scs find i ^=expand("")$ - nmap d :vert scs find d =expand("") - - - """"""""""""" key map timeouts - " - " By default Vim will only wait 1 second for each keystroke in a mapping. - " You may find that too short with the above typemaps. If so, you should - " either turn off mapping timeouts via 'notimeout'. - " - "set notimeout - " - " Or, you can keep timeouts, by uncommenting the timeoutlen line below, - " with your own personal favorite value (in milliseconds): - " - "set timeoutlen=4000 - " - " Either way, since mapping timeout settings by default also set the - " timeouts for multicharacter 'keys codes' (like ), you should also - " set ttimeout and ttimeoutlen: otherwise, you will experience strange - " delays as vim waits for a keystroke after you hit ESC (it will be - " waiting to see if the ESC is actually part of a key code like ). - " - "set ttimeout - " - " personally, I find a tenth of a second to work well for key code - " timeouts. If you experience problems and have a slow terminal or network - " connection, set it higher. If you don't set ttimeoutlen, the value for - " timeoutlent (default: 1000 = 1 second, which is sluggish) is used. - " - "set ttimeoutlen=100 - -endif - - diff --git a/.vimrc b/.vimrc index 8faef1d..1bc2263 100644 --- a/.vimrc +++ b/.vimrc @@ -91,11 +91,23 @@ noremap :Files " 'i' includes: find files that include the filename under cursor " 'd' called: find functions that function under cursor calls -noremap s :cs find s =expand("") -noremap g :cs find g =expand("") -noremap c :cs find c =expand("") -noremap t :cs find t =expand("") -noremap e :cs find e =expand("") -noremap i :cs find i =expand("") -noremap f :cs find f =expand("") -noremap d :cs find d =expand("") +if has("cscope") + set csto=0 + set cst + set nocsverb + if filereadable("cscope.out") + cs add cscope.out + elseif $CSCOPE_DB + cs add $CSCOPE_DB + endif + set csverb +endif + +nmap cs :cs find s =expand("") +nmap cg :cs find g =expand("") +nmap cc :cs find c =expand("") +nmap ct :cs find t =expand("") +nmap ce :cs find e =expand("") +nmap ci :cs find i =expand("") +nmap cf :cs find f =expand("") +nmap cd :cs find d =expand("") -- cgit v1.2.3 From cba68be4f36e9a1d34bc7a2d88ceda7a08ea0ddd Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 13 May 2022 13:47:14 +0200 Subject: update --- .vimrc | 25 ++++++++++++++++++++++--- bin/gauth | 4 ++-- bin/start_godoc | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.vimrc b/.vimrc index 8faef1d..9a12605 100644 --- a/.vimrc +++ b/.vimrc @@ -1,7 +1,9 @@ " General vim defaults " set background= -set t_te= t_ti= ls=1 ruler +"set t_te= t_ti= +set ls=1 ruler set ai ts=4 sw=4 noet +set mouse=a syntax off filetype on filetype plugin on @@ -40,7 +42,7 @@ autocmd FileType go nmap p :cprevious autocmd FileType go nmap a :cclose " autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 -let g:netrw_browsex_viewer = "open" +let g:netrw_browsex_viewer = "xdg-open" let g:netrw_gx = "" let g:netrw_banner = 0 @@ -74,7 +76,7 @@ hi SpellBad gui=undercurl noremap n :bn noremap :bd -noremap o :!open & +noremap o :!xdg-open & noremap :tag noremap :Files @@ -99,3 +101,20 @@ noremap e :cs find e =expand("") noremap i :cs find i =expand("") noremap f :cs find f =expand("") noremap d :cs find d =expand("") + + +function! CloseOnLast() + let cnt = 0 + for i in range(0, bufnr("$")) + if buflisted(i) + let cnt += 1 + endif + endfor + if cnt <= 1 + q + else + bd + endif +endfunction + +"noremap :call CloseOnLast() diff --git a/bin/gauth b/bin/gauth index b18f73d..169fd3b 100755 --- a/bin/gauth +++ b/bin/gauth @@ -1,8 +1,8 @@ #!/bin/sh # Use backup from andOTP -# cat ~/.otp_accounts.json | -gpg -qd ~/.otp_accounts.json.gpg 2>/dev/null | +#gpg -qd ~/.otp_accounts.json.gpg 2>/dev/null | +cat ~/.otp_accounts.json | jq -r '.[] | "\(.label) \(.secret)"' | while read -r l s; do echo "$l $(oathtool --totp -b "$s")" diff --git a/bin/start_godoc b/bin/start_godoc index 15bb70a..6433377 100755 --- a/bin/start_godoc +++ b/bin/start_godoc @@ -1,3 +1,3 @@ #!/bin/sh -/Users/marc/go/bin/godoc >/tmp/godoc.out 2>&1 & +/home/marc/go/bin/godoc >/tmp/godoc.out 2>&1 & -- cgit v1.2.3 From 6c3f8a99905545cea8e36434ec01455ad8ce355f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 21 May 2022 09:05:56 +0200 Subject: update --- .config/i3/config | 1 + .i3status.conf | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/i3/config b/.config/i3/config index 5284bcc..468fdfc 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -85,6 +85,7 @@ for_window [class="MuPDF"] floating enable for_window [class="Org.gnome.Software"] floating enable for_window [class="Pavucontrol"] floating enable for_window [title="QEMU"] floating enable +for_window [class="RSS Guard"] floating enable for_window [class="Signal"] floating enable for_window [class="Slack"] floating enable for_window [class="Spotify"] floating enable diff --git a/.i3status.conf b/.i3status.conf index 7590d2b..411a648 100644 --- a/.i3status.conf +++ b/.i3status.conf @@ -93,8 +93,9 @@ memory { cpu_temperature 0 { format = "🌡%degrees °C" #path = "/sys/class/hwmon/hwmon0/temp1_input" - path = "/sys/class/hwmon/hwmon6/temp1_input" + #path = "/sys/class/hwmon/hwmon6/temp1_input" #path = "/sys/class/hwmon/hwmon7/temp1_input" + #path = "/sys/class/hwmon/hwmon8/temp1_input" } tztime local { -- cgit v1.2.3 From 96f5dc439ef6f91ba50ae842d4e5cb86c92a3553 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 14 Jun 2022 17:37:01 +0200 Subject: update --- .i3status.conf | 3 +- bin/md2html | 193 +++++++++++++++++++++++++++------------------------------ 2 files changed, 95 insertions(+), 101 deletions(-) diff --git a/.i3status.conf b/.i3status.conf index 411a648..6cc7210 100644 --- a/.i3status.conf +++ b/.i3status.conf @@ -46,7 +46,8 @@ ethernet _first_ { battery all { last_full_capacity = true integer_battery_capacity = true - format = "%status %percentage %remaining" +# format = "%status %percentage %remaining" + format = "%status %percentage %remaining %consumption" status_chr = "⚡🔋" status_bat = "🔋" status_unk = "? UNK" diff --git a/bin/md2html b/bin/md2html index 35e1d72..7be4aaa 100755 --- a/bin/md2html +++ b/bin/md2html @@ -1,43 +1,42 @@ #!/usr/bin/awk -f # md2html.awk -# by: Jesus Galan (yiyus) , May 2009 # Usage: # md2html file.md > file.html # Options: -v esc=false to not escape html -function newblock(nblock){ - if(text) - print "<" block ">" text ""; - text = ""; - block = nblock ? nblock : "p"; +function newblock(nblock) { + if (text) + print "<" block ">" text "" + text = "" + block = nblock ? nblock : "p" } -function subinline(tgl, inl){ - while(match($0, tgl)){ +function subinline(tgl, inl) { + while (match($0, tgl)){ if (inline[ni] == inl) - ni -= sub(tgl, ""); + ni -= sub(tgl, "") else if (sub(tgl, "<" inl ">")) - inline[++ni] = inl; + inline[++ni] = inl } } -function dolink(href, lnk){ +function dolink(href, lnk) { # Undo escaped html in uris - gsub(/&/, "\\&", href); - gsub(/</, "<", href); - gsub(/>/, ">", href); + gsub(/&/, "\\&", href) + gsub(/</, "<", href) + gsub(/>/, ">", href) # & can be tricky, and not standard: - gsub(/&/, "\\\\\\&", href); - gsub(/&/, "\\\\\\&", lnk); - return "" lnk ""; + gsub(/&/, "\\\\\\&", href) + gsub(/&/, "\\\\\\&", lnk) + return "" lnk "" } BEGIN { ni = 0; # inlines nl = 0; # nested lists - text = ""; - block = "p"; + text = "" + block = "p" } # Escape html @@ -49,128 +48,122 @@ esc != "false" { # Horizontal rules (_ is not in markdown) /^[ ]*([-*_] ?)+[ ]*$/ && text == "" { - print "
"; - next; + print "
" + next } # Tables (not in markdown) # Syntax: # Right Align| Center Align |Left Align /([ ]\|)|(\|[ ])/ { - if(block != "table") - newblock("table"); - nc = split($0, cells, "|"); - $0 = "\n"; - for(i = 1; i <= nc; i++){ - align = "left"; - if(sub(/^[ ]+/, "", cells[i])){ - if(sub(/[ ]+$/, "", cells[i])) - align = "center"; + if (block != "table") + newblock("table") + nc = split($0, cells, "|") + $0 = "\n" + for (i = 1; i <= nc; i++){ + align = "left" + if (sub(/^[ ]+/, "", cells[i])){ + if (sub(/[ ]+$/, "", cells[i])) + align = "center" else - align = "right"; + align = "right" } - sub(/[ ]+$/,"", cells[i]); - $0 = $0 "" cells[i] "\n"; + sub(/[ ]+$/,"", cells[i]) + $0 = $0 "" cells[i] "\n" } - $0 = $0 ""; + $0 = $0 "" } # Ordered and unordered (possibly nested) lists /^[ ]*([*+-]|(([0-9]+[\.-]?)+))[ ]/ { - newblock("li"); - nnl = 1; - while(match($0, /^[ ]/)){ - sub(/^[ ]/,""); - nnl++; + newblock("li") + nnl = 1 + while (match($0, /^[ ]/)){ + sub(/^[ ]/,"") + nnl++ } - while(nl > nnl) - print ""; - while(nl < nnl){ - list[++nl] = "ol"; - if(match($0, /^[*+-]/)) - list[nl] = "ul"; - print "<" list[nl] ">"; + while (nl > nnl) + print "" + while (nl < nnl){ + list[++nl] = "ol" + if (match($0, /^[*+-]/)) + list[nl] = "ul" + print "<" list[nl] ">" } - sub(/^([*+-]|(([0-9]+[\.-]?)+))[ ]/,""); + sub(/^([*+-]|(([0-9]+[\.-]?)+))[ ]/,"") } # Multi line list items block == "li" { - sub(/^( *)|( *)/,""); + sub(/^( *)|( *)/,"") } # Code blocks /^( | )/ { - if(block != "code") - newblock("code"); - sub(/^( | )/, ""); - text = text $0 "\n"; - next; + if (block != "code") + newblock("code") + sub(/^( | )/, "") + text = text $0 "\n" + next } -# Paragraph +# Paragraphs /^$/ { - newblock(); - while(nl > 0) - print ""; + newblock() + while (nl > 0) + print "" } -# Setex-style Headers -# (Plus h3 with underscores.) -/^=+$/ { - block = "h" 1; - next; -} - -/^-+$/ { - block = "h" 2; - next; +# Headers +/^#/ { + newblock() + match($0, /#+/) + n = RLENGTH + if (n > 6) + n = 6 + text = substr($0, RLENGTH + 1) + block = "h" n + next } -/^_+$/ { - block = "h" 3; - next; +# Alternate headers (underlined) +/^=+$/ { + block = "h" 1 + next } -# Atx-style headers -/^#/ { - newblock(); - match($0, /#+/); - n = RLENGTH; - if(n > 6) - n = 6; - text = substr($0, RLENGTH + 1); - block = "h" n; - next; +/^-+$/ { + block = "h" 2 + next } -// { +{ # Images - while(match($0, /!\[[^\]]+\]\([^\)]+\)/)){ - split(substr($0, RSTART, RLENGTH), a, /(!\[)|\)|(\]\()/); - sub(/!\[[^\]]+\]\([^\)]+\)/, "\"""); + while (match($0, /!\[[^\]]+\]\([^\)]+\)/)){ + split(substr($0, RSTART, RLENGTH), a, /(!\[)|\)|(\]\()/) + sub(/!\[[^\]]+\]\([^\)]+\)/, "\""") } # Links - while(match($0, /\[[^\]]+\]\([^\)]+\)/)){ - split(substr($0, RSTART, RLENGTH), a, /[\[\)]|(\]\()/); - sub(/\[[^\]]+\]\([^\)]+\)/, dolink(a[3], a[2])); + while (match($0, /\[[^\]]+\]\([^\)]+\)/)){ + split(substr($0, RSTART, RLENGTH), a, /[\[\)]|(\]\()/) + sub(/\[[^\]]+\]\([^\)]+\)/, dolink(a[3], a[2])) } # Auto links (uri matching is poor) - na = split($0, a, /(^\()|[ ]|([,\.\)]([ ]|$))/); - for(i = 1; i <= na; i++) - if(match(a[i], /^(((https?|ftp|file|news|irc):\/\/)|(mailto:)).+$/)) - sub(a[i], dolink(a[i], a[i])); + na = split($0, a, /(^\()|[ ]|([,\.\)]([ ]|$))/) + for (i = 1; i <= na; i++) + if (match(a[i], /^(((https?|ftp|file|news|irc):\/\/)|(mailto:)).+$/)) + sub(a[i], dolink(a[i], a[i])) # Inline - subinline("(\\*\\*)|(__)", "strong"); - subinline("\\*", "em"); - subinline("`", "code"); - text = text (text ? " " : "") $0; + subinline("(\\*\\*)|(__)", "strong") + subinline("\\*", "em") + subinline("`", "code") + text = text (text ? " " : "") $0 } END { - while(ni > 0) - text = text ""; - newblock(); - while(nl > 0) - print ""; + while (ni > 0) + text = text "" + newblock() + while (nl > 0) + print "" } -- cgit v1.2.3 From 9bedd1ff5d11077241fa761a6988018c31c8d51b Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 21 Aug 2022 16:09:20 +0200 Subject: update --- .bashrc | 1 + .config/i3/config | 1 + .xinitrc | 1 + 3 files changed, 3 insertions(+) diff --git a/.bashrc b/.bashrc index 09ac7b2..60ed9e4 100644 --- a/.bashrc +++ b/.bashrc @@ -71,6 +71,7 @@ alias rvi='sudo vim' alias rxt='sudo xt' alias rxvi='sudo xvi' alias ww='vi ~/Wiki/home_page.md' +alias s='vi ~/Wiki/scratch.md' alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' #alias uc='systemctl --user' diff --git a/.config/i3/config b/.config/i3/config index 468fdfc..05fb6fd 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -64,6 +64,7 @@ for_window [class="Blueman-manager"] floating enable for_window [class="Chromium"] floating enable for_window [title="Task Manager - Chromium"] floating enable for_window [title="Gestionnaire de tâches – Chromium"] floating enable +for_window [class="DeltaChat"] floating enable for_window [instance="DOTTY"] floating enable for_window [class="discord"] floating enable for_window [class="Display"] floating enable diff --git a/.xinitrc b/.xinitrc index 2ab853e..c384f84 100644 --- a/.xinitrc +++ b/.xinitrc @@ -27,4 +27,5 @@ xsetroot -solid rgb:1/3/4 # Start window manager #exec fvwm +#lxpolkit exec i3 -- cgit v1.2.3 From 21d2bd0a3bebcec2cf6adab854d96196f59463ce Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 22 Aug 2022 15:04:00 +0200 Subject: update --- .config/i3/config | 2 ++ .vimrc | 2 +- bin/start_godoc | 4 +++- swift/boot/loader/entries/arch.conf | 5 +++++ swift/boot/loader/entries/arch2.conf | 7 +++++++ swift/boot/loader/loader.conf | 3 +++ swift/etc/X11/xorg.conf.d/10-input.conf | 6 ++++++ swift/etc/X11/xorg.conf.d/10-keyboard.conf | 6 ++++++ swift/etc/X11/xorg.conf.d/20-intel.conf | 4 ++++ swift/etc/fstab | 14 ++++++++++++++ swift/etc/qemu/bridge.conf | 1 + swift/etc/systemd/network/20-wired.network | 8 ++++++++ swift/etc/systemd/network/25-wireless.network | 8 ++++++++ swift/etc/systemd/network/bind.network | 5 +++++ swift/etc/systemd/network/bridge.netdev | 4 ++++ swift/etc/systemd/network/bridge.network | 5 +++++ swift/etc/systemd/resolved.conf | 3 +++ 17 files changed, 85 insertions(+), 2 deletions(-) create mode 100755 swift/boot/loader/entries/arch.conf create mode 100755 swift/boot/loader/entries/arch2.conf create mode 100755 swift/boot/loader/loader.conf create mode 100644 swift/etc/X11/xorg.conf.d/10-input.conf create mode 100644 swift/etc/X11/xorg.conf.d/10-keyboard.conf create mode 100644 swift/etc/X11/xorg.conf.d/20-intel.conf create mode 100644 swift/etc/fstab create mode 100644 swift/etc/qemu/bridge.conf create mode 100644 swift/etc/systemd/network/20-wired.network create mode 100644 swift/etc/systemd/network/25-wireless.network create mode 100644 swift/etc/systemd/network/bind.network create mode 100644 swift/etc/systemd/network/bridge.netdev create mode 100644 swift/etc/systemd/network/bridge.network create mode 100644 swift/etc/systemd/resolved.conf diff --git a/.config/i3/config b/.config/i3/config index 05fb6fd..ff15c0d 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -58,6 +58,7 @@ bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOU # enable floating mode for_window [class="Arandr"] floating enable +for_window [class="Asunder"] floating enable for_window [class="Brave-browser"] floating enable for_window [class="Blueberry.py"] floating enable for_window [class="Blueman-manager"] floating enable @@ -85,6 +86,7 @@ for_window [class="llpp"] floating enable for_window [class="MuPDF"] floating enable for_window [class="Org.gnome.Software"] floating enable for_window [class="Pavucontrol"] floating enable +for_window [class="Picard"] floating enable for_window [title="QEMU"] floating enable for_window [class="RSS Guard"] floating enable for_window [class="Signal"] floating enable diff --git a/.vimrc b/.vimrc index 858bc52..cf4a9e4 100644 --- a/.vimrc +++ b/.vimrc @@ -3,7 +3,7 @@ "set t_te= t_ti= set ls=1 ruler set ai ts=4 sw=4 noet -set mouse=a +"set mouse=a syntax off filetype on filetype plugin on diff --git a/bin/start_godoc b/bin/start_godoc index 6433377..c6a716b 100755 --- a/bin/start_godoc +++ b/bin/start_godoc @@ -1,3 +1,5 @@ #!/bin/sh -/home/marc/go/bin/godoc >/tmp/godoc.out 2>&1 & +# Start a godoc server on port 6060 + +exec /home/marc/go/bin/godoc >/tmp/godoc.out 2>&1 & diff --git a/swift/boot/loader/entries/arch.conf b/swift/boot/loader/entries/arch.conf new file mode 100755 index 0000000..5392c64 --- /dev/null +++ b/swift/boot/loader/entries/arch.conf @@ -0,0 +1,5 @@ +title Yoda Arch Linux +linux /vmlinuz-linux +initrd /intel-ucode.img +initrd /initramfs-linux.img +options root=/dev/disk/by-uuid/8c89d665-a17b-47da-aa19-4c855f134d54 net.ifnames=0 rw acpi_osi=Linux acpi_backlight=video diff --git a/swift/boot/loader/entries/arch2.conf b/swift/boot/loader/entries/arch2.conf new file mode 100755 index 0000000..69d70b6 --- /dev/null +++ b/swift/boot/loader/entries/arch2.conf @@ -0,0 +1,7 @@ +title Yoda2 Arch Linux +linux /vmlinuz-linux +initrd /intel-ucode.img +initrd /initramfs-linux.img +#options root=/dev/disk/by-uuid/8c89d665-a17b-47da-aa19-4c855f134d54 net.ifnames=0 rw acpi_osi=Linux acpi_backlight=video +options root=/dev/disk/by-uuid/fd0bd5d9-abfd-46e2-bbec-cc5042c19507 net.ifnames=0 rw acpi_osi=Linux acpi_backlight=video +#options root=/dev/disk/by-uuid/fd0bd5d9-abfd-46e2-bbec-cc5042c19507 net.ifnames=0 rw acpi_osi=Linux acpi_backlight=video snd_sof_intel_hda_common.hda_model=alc255-acer diff --git a/swift/boot/loader/loader.conf b/swift/boot/loader/loader.conf new file mode 100755 index 0000000..340ea34 --- /dev/null +++ b/swift/boot/loader/loader.conf @@ -0,0 +1,3 @@ +default arch2 +timeout 4 +console-mode max diff --git a/swift/etc/X11/xorg.conf.d/10-input.conf b/swift/etc/X11/xorg.conf.d/10-input.conf new file mode 100644 index 0000000..d719095 --- /dev/null +++ b/swift/etc/X11/xorg.conf.d/10-input.conf @@ -0,0 +1,6 @@ +Section "InputClass" + Identifier "HP 3 button mouse" + Driver "libinput" + Option "ScrollMethod" "button" + Option "ScrollButton" "2" +EndSection diff --git a/swift/etc/X11/xorg.conf.d/10-keyboard.conf b/swift/etc/X11/xorg.conf.d/10-keyboard.conf new file mode 100644 index 0000000..131f8f3 --- /dev/null +++ b/swift/etc/X11/xorg.conf.d/10-keyboard.conf @@ -0,0 +1,6 @@ +Section "InputClass" + Identifier "Keyboard Defaults" + MatchIsKeyboard "yes" + Option "XkbLayout" "fr" + Option "XkbOptions" "caps:super,altwin:menu_win" +EndSection diff --git a/swift/etc/X11/xorg.conf.d/20-intel.conf b/swift/etc/X11/xorg.conf.d/20-intel.conf new file mode 100644 index 0000000..28e460c --- /dev/null +++ b/swift/etc/X11/xorg.conf.d/20-intel.conf @@ -0,0 +1,4 @@ +Section "ServerLayout" + Identifier "Main" + Option "Xinerama" "0" +EndSection diff --git a/swift/etc/fstab b/swift/etc/fstab new file mode 100644 index 0000000..00d3167 --- /dev/null +++ b/swift/etc/fstab @@ -0,0 +1,14 @@ +# /dev/nvme1n1p5 +UUID=fd0bd5d9-abfd-46e2-bbec-cc5042c19507 / xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 1 + +# /dev/nvme1n1p1 +UUID=120F-B472 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 + +# /dev/nvme1n1p3 +UUID=E23C1C4C3C1C1DDB /mnt/windows ntfs-3g gid=1000,uid=1000,dmask=022,fmask=133,noauto 0 0 + +# /dev/nvme0n1p1 +UUID=8c89d665-a17b-47da-aa19-4c855f134d54 /data xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 2 + +# Sony walkman NW-A55L external flash +/dev/sdb1 /mnt/sdb1 exfat noauto,gid=20,uid=501,dmask=002,fmask=113 0 0 diff --git a/swift/etc/qemu/bridge.conf b/swift/etc/qemu/bridge.conf new file mode 100644 index 0000000..a573665 --- /dev/null +++ b/swift/etc/qemu/bridge.conf @@ -0,0 +1 @@ +allow virbr0 diff --git a/swift/etc/systemd/network/20-wired.network b/swift/etc/systemd/network/20-wired.network new file mode 100644 index 0000000..9ac4295 --- /dev/null +++ b/swift/etc/systemd/network/20-wired.network @@ -0,0 +1,8 @@ +[Match] +Name=e* + +[Network] +DHCP=ipv4 + +[DHCP] +RouteMetric=10 diff --git a/swift/etc/systemd/network/25-wireless.network b/swift/etc/systemd/network/25-wireless.network new file mode 100644 index 0000000..3bb9c39 --- /dev/null +++ b/swift/etc/systemd/network/25-wireless.network @@ -0,0 +1,8 @@ +[Match] +Name=wl* + +[Network] +DHCP=ipv4 + +[DHCP] +RouteMetric=20 diff --git a/swift/etc/systemd/network/bind.network b/swift/etc/systemd/network/bind.network new file mode 100644 index 0000000..c0313fe --- /dev/null +++ b/swift/etc/systemd/network/bind.network @@ -0,0 +1,5 @@ +[Match] +Name=wl* + +[Network] +Bridge=br0 diff --git a/swift/etc/systemd/network/bridge.netdev b/swift/etc/systemd/network/bridge.netdev new file mode 100644 index 0000000..fe9c2ad --- /dev/null +++ b/swift/etc/systemd/network/bridge.netdev @@ -0,0 +1,4 @@ +[NetDev] +Name=br0 +Kind=bridge +MACAddress=3c:f0:11:73:77:51 diff --git a/swift/etc/systemd/network/bridge.network b/swift/etc/systemd/network/bridge.network new file mode 100644 index 0000000..684ce83 --- /dev/null +++ b/swift/etc/systemd/network/bridge.network @@ -0,0 +1,5 @@ +[Match] +Name=br0 + +[Network] +Address=10.0.2.1/24 diff --git a/swift/etc/systemd/resolved.conf b/swift/etc/systemd/resolved.conf new file mode 100644 index 0000000..186c2ec --- /dev/null +++ b/swift/etc/systemd/resolved.conf @@ -0,0 +1,3 @@ +[Resolve] +DNSSEC=no +DNSOverTLS=no -- cgit v1.2.3 From 56c37d482ac00e003690605ff3d50fb0528322c5 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 22 Aug 2022 16:18:05 +0200 Subject: update --- swift/etc/X11/xorg.conf.d/10-input.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/swift/etc/X11/xorg.conf.d/10-input.conf b/swift/etc/X11/xorg.conf.d/10-input.conf index d719095..ae48884 100644 --- a/swift/etc/X11/xorg.conf.d/10-input.conf +++ b/swift/etc/X11/xorg.conf.d/10-input.conf @@ -3,4 +3,5 @@ Section "InputClass" Driver "libinput" Option "ScrollMethod" "button" Option "ScrollButton" "2" + Option "NaturalScrolling" "on" EndSection -- cgit v1.2.3 From ae63ac14a53f3a1eae825e985709aa183e522980 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 22 Aug 2022 16:30:00 +0200 Subject: update --- .xsession | 1 + 1 file changed, 1 insertion(+) diff --git a/.xsession b/.xsession index 278c5fc..ea74ab4 100755 --- a/.xsession +++ b/.xsession @@ -4,6 +4,7 @@ eval $(ssh-agent) +# See also /etc/X11/xorg.conf.d/10-input.conf # 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 -- cgit v1.2.3 From 8eb6076d992378ef9fbdd54fd46ed2be88d9d1a3 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 23 Aug 2022 10:17:37 +0200 Subject: update --- .config/i3/config | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/i3/config b/.config/i3/config index ff15c0d..ac85a15 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -57,6 +57,7 @@ bindsym $mod+KP_Enter exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ to bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status # enable floating mode +for_window [class="aft-linux-qt"] floating enable for_window [class="Arandr"] floating enable for_window [class="Asunder"] floating enable for_window [class="Brave-browser"] floating enable -- cgit v1.2.3 From abff7fda707925805a9e598d05774ab654b7bc96 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 24 Aug 2022 14:13:35 +0200 Subject: update --- .gitconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitconfig b/.gitconfig index 11f0d14..7e38bd0 100644 --- a/.gitconfig +++ b/.gitconfig @@ -11,8 +11,11 @@ [user] email = mvertes@free.fr name = Marc Vertes + signinkey = DF3DEEB6285CE0B5CD4E95C3C3C0303496E733B9 [pull] rebase = false +[push] + autoSetupRemote = true [hub] protocol = ssh [init] -- cgit v1.2.3 From 55b6de7eb5ad16ddcd293cb2d717d327c5c15e77 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 25 Aug 2022 09:00:13 +0200 Subject: update --- swift/etc/udev/rules.d/95-hdmi-plug.rules | 5 +++++ swift/etc/udev/rules.d/hdmi.rules | 1 + 2 files changed, 6 insertions(+) create mode 100644 swift/etc/udev/rules.d/95-hdmi-plug.rules create mode 100644 swift/etc/udev/rules.d/hdmi.rules diff --git a/swift/etc/udev/rules.d/95-hdmi-plug.rules b/swift/etc/udev/rules.d/95-hdmi-plug.rules new file mode 100644 index 0000000..465eada --- /dev/null +++ b/swift/etc/udev/rules.d/95-hdmi-plug.rules @@ -0,0 +1,5 @@ +ACTION=="change", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" + +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="25a4", ATTRS{idProduct}=="9311", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" + +ACTION=="remove", SUBSYSTEMS=="usb", ATTRS{idVendor}=="25a4", ATTRS{idProduct}=="9311", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" diff --git a/swift/etc/udev/rules.d/hdmi.rules b/swift/etc/udev/rules.d/hdmi.rules new file mode 100644 index 0000000..ec06147 --- /dev/null +++ b/swift/etc/udev/rules.d/hdmi.rules @@ -0,0 +1 @@ +KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/marc/.Xauthority", RUN+="/home/marc/bin/hdmi" -- cgit v1.2.3 From bbe7b2670d2900dfdd260447b5d79eead21427d7 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 25 Aug 2022 17:41:44 +0200 Subject: update --- .config/i3/config | 1 + swift/etc/modprobe.d/swift5.conf | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 swift/etc/modprobe.d/swift5.conf diff --git a/.config/i3/config b/.config/i3/config index ac85a15..7f094d2 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -87,6 +87,7 @@ for_window [class="llpp"] floating enable for_window [class="MuPDF"] floating enable for_window [class="Org.gnome.Software"] floating enable for_window [class="Pavucontrol"] floating enable +for_window [class="Pcmanfm"] floating enable for_window [class="Picard"] floating enable for_window [title="QEMU"] floating enable for_window [class="RSS Guard"] floating enable diff --git a/swift/etc/modprobe.d/swift5.conf b/swift/etc/modprobe.d/swift5.conf new file mode 100644 index 0000000..bda0f22 --- /dev/null +++ b/swift/etc/modprobe.d/swift5.conf @@ -0,0 +1,10 @@ +#options snd_hda_intel model=dell-headset-multi +#options snd_hda_intel power_save=1 +#options snd-intel-dspcfg dsp_driver=1 +options snd_sof_intel_hda_common hda_model=alc255-acer + +options i915 enable_fbc=1 +options i915 enable_psr=1 disable_power_well=0 +options i915 modeset=1 + +#blacklist snd_soc_skl -- cgit v1.2.3 From 5e90fa775e4c654d5383e7a14876dde51ee94913 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 26 Aug 2022 15:45:27 +0200 Subject: update --- .config/i3/config | 5 +- .fvwm2rc | 5 +- .local/share/applications/thunderbird.desktop | 173 ++++++++++++++++++++++++++ .xsession | 3 +- 4 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 .local/share/applications/thunderbird.desktop diff --git a/.config/i3/config b/.config/i3/config index 7f094d2..563bd4c 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -37,7 +37,7 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 000000 --nofork # Notification daemon (see ~/.config/dunst/dunstrc for configuration) exec --no-startup-id dunst -bindsym $mod+a exec --no-startup-id dunstctl action +#bindsym $mod+a exec --no-startup-id dunstctl action bindsym $mod+c exec --no-startup-id dunstctl context bindsym $mod+n exec --no-startup-id dunstctl close bindsym $mod+twosuperior exec --no-startup-id dunstctl history-pop @@ -95,11 +95,11 @@ for_window [class="Signal"] floating enable for_window [class="Slack"] floating enable for_window [class="Spotify"] floating enable for_window [class="Thunderbird"] floating enable +for_window [class="UXTerm"] floating enable for_window [class="vlc"] floating enable for_window [instance="wish"] floating enable for_window [class="wpa_gui"] floating enable for_window [class="XVroot"] floating enable -#for_window [class="XTerm"] floating enable for_window [class="zoom"] floating enable bindsym button3 floating toggle @@ -109,6 +109,7 @@ floating_modifier $mod # start a terminal bindsym $mod+Return exec --no-startup-id xt +bindsym $mod+a exec --no-startup-id uxterm # kill focused window bindsym $mod+Shift+a kill diff --git a/.fvwm2rc b/.fvwm2rc index fac2b23..e8b061b 100644 --- a/.fvwm2rc +++ b/.fvwm2rc @@ -127,8 +127,9 @@ AddToMenu "Utilities" + "&Xterm" Exec exec xt + "&Black Xterm" Exec exec bxt + "&Top" Exec exec xt -T Top -n Top -e /bin/top -+ "&Web" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache +#+ "&Web" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache #+ "&Web" Exec exec brave ++ "&Web" Exec exec firefox #+ "&Firefox" Exec exec firefox #+ "&Chromium" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache + "&Mail" Exec exec thunderbird @@ -138,7 +139,7 @@ AddToMenu "Utilities" + "&System" Popup Settings + "&Desktop" Popup Desktop-Apps + "M&ultimedia" Popup Multimedia -+ "ssh bip" Exec exec uxterm -j -sl 500 -cr red -e mosh bip +#+ "ssh bip" Exec exec uxterm -j -sl 500 -cr red -e mosh bip #+ "ssh dev.ugrid.net" Exec exec uxterm -j -sl 500 -cr red -e ssh dev.ugrid.net + "" Nop + "&Quit" Popup Quit-Verify diff --git a/.local/share/applications/thunderbird.desktop b/.local/share/applications/thunderbird.desktop new file mode 100644 index 0000000..e1e8dc0 --- /dev/null +++ b/.local/share/applications/thunderbird.desktop @@ -0,0 +1,173 @@ +[Desktop Entry] +Name=Thunderbird +Comment=Send and receive mail with Thunderbird +Comment[ast]=Lleer y escribir corréu electrónicu +Comment[ca]=Llegiu i escriviu correu +Comment[cs]=Čtení a psaní pošty +Comment[da]=Skriv/læs e-post/nyhedsgruppe med Mozilla Thunderbird +Comment[de]=E-Mails und Nachrichten mit Thunderbird lesen und schreiben +Comment[el]=Διαβάστε και γράψτε γράμματα με το Mozilla Thunderbird +Comment[es]=Lea y escriba correos y noticias con Thunderbird +Comment[fi]=Lue ja kirjoita sähköposteja +Comment[fr]=Lire et écrire des courriels +Comment[gl]=Lea e escriba correo electrónico +Comment[he]=קריאה/כתיבה של דוא״ל/חדשות באמצעות Mozilla Thunderbird +Comment[hr]=Čitajte/šaljite e-poštu s Thunderbird +Comment[hu]=Levelek írása és olvasása a Thunderbirddel +Comment[it]=Per leggere e scrivere email +Comment[ja]=メールの読み書き +Comment[ko]=Mozilla Thunderbird 메일/뉴스 읽기 및 쓰기 클라이언트 +Comment[nl]=E-mail/nieuws lezen en schrijven met Mozilla Thunderbird +Comment[pl]=Czytanie i wysyłanie e-maili +Comment[pt_BR]=Leia e escreva suas mensagens +Comment[ru]=Читайте и пишите письма +Comment[sk]=Čítajte a píšte poštu pomocou programu Thunderbird +Comment[sv]=Läs och skriv e-post +Comment[ug]=ئېلخەت ۋە خەۋەرلەرنى Mozilla Thunderbird دا كۆرۈش ۋە يېزىش +Comment[uk]=Читання та написання листів +Comment[vi]=Đọc và soạn thư điện tử +Comment[zh_CN]=阅读邮件或新闻 +Comment[zh_TW]=以 Mozilla Thunderbird 讀寫郵件或新聞 +GenericName=Mail Client +GenericName[ast]=Client de correu +GenericName[ca]=Client de correu +GenericName[cs]=Poštovní klient +GenericName[da]=E-postklient +GenericName[de]=E-Mail-Anwendung +GenericName[el]=Λογισμικό αλληλογραφίας +GenericName[es]=Cliente de correo +GenericName[fi]=Sähköpostiohjelma +GenericName[fr]=Client de messagerie +GenericName[gl]=Cliente de correo electrónico +GenericName[he]=לקוח דוא״ל +GenericName[hr]=Klijent e-pošte +GenericName[hu]=Levelezőkliens +GenericName[it]=Client email +GenericName[ja]=電子メールクライアント +GenericName[ko]=메일 클라이언트 +GenericName[nl]=E-mailprogramma +GenericName[pl]=Klient poczty +GenericName[pt_BR]=Cliente de E-mail +GenericName[ru]=Почтовый клиент +GenericName[sk]=Poštový klient +GenericName[ug]=ئېلخەت دېتالى +GenericName[uk]=Поштова програма +GenericName[vi]=Phần mềm khách quản lý thư điện tử +GenericName[zh_CN]=邮件新闻客户端 +GenericName[zh_TW]=郵件用戶端 +Exec=env MOZ_USE_XINPUT2=1 /usr/lib/thunderbird/thunderbird %u +Terminal=false +Type=Application +Icon=thunderbird +Categories=Network;Email; +MimeType=message/rfc822;x-scheme-handler/mailto;application/x-xpinstall; +StartupNotify=true +Actions=ComposeMessage;OpenAddressBook; + +[Desktop Action ComposeMessage] +Name=Write new message +Name[ar]=اكتب رسالة جديدة +Name[ast]=Redactar mensaxe nuevu +Name[be]=Напісаць новы ліст +Name[bg]=Съставяне на ново съобщение +Name[br]=Skrivañ ur gemennadenn nevez +Name[ca]=Escriu un missatge nou +Name[cs]=Napsat novou zprávu +Name[da]=Skriv en ny meddelelse +Name[de]=Neue Nachricht verfassen +Name[el]=Σύνταξη νέου μηνύματος +Name[es_AR]=Escribir un nuevo mensaje +Name[es_ES]=Redactar nuevo mensaje +Name[et]=Kirjuta uus kiri +Name[eu]=Idatzi mezu berria +Name[fi]=Kirjoita uusi viesti +Name[fr]=Rédiger un nouveau message +Name[fy_NL]=Skriuw in nij berjocht +Name[ga_IE]=Scríobh teachtaireacht nua +Name[gd]=Sgrìobh teachdaireachd ùr +Name[gl]=Escribir unha nova mensaxe +Name[he]=כתיבת הודעה חדשה +Name[hr]=Piši novu poruku +Name[hu]=Új üzenet írása +Name[hy_AM]=Գրել նոր նամակ +Name[is]=SKrifa nýjan póst +Name[it]=Scrivi nuovo messaggio +Name[ja]=新しいメッセージを作成する +Name[ko]=새 메시지 작성 +Name[lt]=Rašyti naują laišką +Name[nb_NO]=Skriv ny melding +Name[nl]=Nieuw bericht aanmaken +Name[nn_NO]=Skriv ny melding +Name[pl]=Nowa wiadomość +Name[pt_BR]=Nova mensagem +Name[pt_PT]=Escrever nova mensagem +Name[rm]=Scriver in nov messadi +Name[ro]=Scrie un mesaj nou +Name[ru]=Создать новое сообщение +Name[si]=නව ලිපියක් ලියන්න +Name[sk]=Nová e-mailová správa +Name[sl]=Sestavi novo sporočilo +Name[sq]=Shkruani mesazh të ri +Name[sr]=Писање нове поруке +Name[sv_SE]=Skriv ett nytt meddelande +Name[ta_LK]=புதிய செய்தியை எழுதுக +Name[tr]=Yeni ileti yaz +Name[uk]=Написати нового листа +Name[vi]=Viết thư mới +Name[zh_CN]=编写新消息 +Name[zh_TW]=寫一封新訊息 +Exec=env MOZ_USE_XINPUT2=1 /usr/lib/thunderbird/thunderbird -compose + +[Desktop Action OpenAddressBook] +Name=Open address book +Name[ar]=افتح دفتر العناوين +Name[ast]=Abrir llibreta de direiciones +Name[be]=Адкрыць адрасную кнігу +Name[bg]=Отваряне на адресник +Name[br]=Digeriñ ur c'harned chomlec'hioù +Name[ca]=Obre la llibreta d'adreces +Name[cs]=Otevřít Adresář +Name[da]=Åbn adressebog +Name[de]=Adressbuch öffnen +Name[el]=Άνοιγμα ευρετηρίου διευθύνσεων +Name[es_AR]=Abrir libreta de direcciones +Name[es_ES]=Abrir libreta de direcciones +Name[et]=Ava aadressiraamat +Name[eu]=Ireki helbide-liburua +Name[fi]=Avaa osoitekirja +Name[fr]=Ouvrir un carnet d'adresses +Name[fy_NL]=Iepenje adresboek +Name[ga_IE]=Oscail leabhar seoltaí +Name[gd]=Fosgail leabhar-sheòlaidhean +Name[gl]=Abrir a axenda de enderezos +Name[he]=פתיחת ספר כתובות +Name[hr]=Otvori adresar +Name[hu]=Címjegyzék megnyitása +Name[hy_AM]=Բացել Հասցեագիրքը +Name[is]=Opna nafnaskrá +Name[it]=Apri rubrica +Name[ja]=アドレス帳を開く +Name[ko]=주소록 열기 +Name[lt]=Atverti adresų knygą +Name[nb_NO]=Åpne adressebok +Name[nl]=Adresboek openen +Name[nn_NO]=Opne adressebok +Name[pl]=Książka adresowa +Name[pt_BR]=Catálogo de endereços +Name[pt_PT]=Abrir livro de endereços +Name[rm]=Avrir il cudeschet d'adressas +Name[ro]=Deschide agenda de contacte +Name[ru]=Открыть адресную книгу +Name[si]=ලිපින පොත විවෘත කරන්න +Name[sk]=Otvoriť adresár +Name[sl]=Odpri adressar +Name[sq]=Hapni libër adresash +Name[sr]=Отвори адресар +Name[sv_SE]=Öppna adressboken +Name[ta_LK]=முகவரி பத்தகத்தை திறக்க +Name[tr]=Adres defterini aç +Name[uk]=Відкрити адресну книгу +Name[vi]=Mở sổ địa chỉ +Name[zh_CN]=打开通讯录 +Name[zh_TW]=開啟通訊錄 +Exec=env MOZ_USE_XINPUT2=1 /usr/lib/thunderbird/thunderbird -addressbook diff --git a/.xsession b/.xsession index ea74ab4..6d4b699 100755 --- a/.xsession +++ b/.xsession @@ -17,7 +17,8 @@ hdmi xrdb ~/.Xresources #xsetroot -solid rgb:3/4/5 -xsetroot -solid rgb:1/3/4 +#xsetroot -solid rgb:1/3/4 +feh --bg-fill ~/night1.jpg #feh --bg-fill ~/Downloads/Alaska_Range.jpg #conky #slock -- cgit v1.2.3 From 68c376b472b62b72487e8b4ec93a93453e0382c1 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 26 Aug 2022 20:05:54 +0200 Subject: update --- bin/vcat | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 bin/vcat diff --git a/bin/vcat b/bin/vcat new file mode 100755 index 0000000..7c162d4 --- /dev/null +++ b/bin/vcat @@ -0,0 +1,8 @@ +#!/bin/sh + +# Use vim to cat a file. +# Useful if file is vim-encrypted (password silently expected). + +trap "stty '$(stty -g)'" EXIT +stty -echo +vim -es '+%p' '+:q!' "$1" -- cgit v1.2.3 From 8f53ffef1295dabee8fd296a5f5cc9c849935af0 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 27 Aug 2022 15:25:58 +0200 Subject: update --- .config/i3/config | 4 ++-- bin/gauth | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 563bd4c..470f819 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -37,7 +37,7 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 000000 --nofork # Notification daemon (see ~/.config/dunst/dunstrc for configuration) exec --no-startup-id dunst -#bindsym $mod+a exec --no-startup-id dunstctl action +bindsym $mod+a exec --no-startup-id dunstctl action bindsym $mod+c exec --no-startup-id dunstctl context bindsym $mod+n exec --no-startup-id dunstctl close bindsym $mod+twosuperior exec --no-startup-id dunstctl history-pop @@ -109,7 +109,7 @@ floating_modifier $mod # start a terminal bindsym $mod+Return exec --no-startup-id xt -bindsym $mod+a exec --no-startup-id uxterm +bindsym $mod+t exec --no-startup-id uxterm # kill focused window bindsym $mod+Shift+a kill diff --git a/bin/gauth b/bin/gauth index 169fd3b..2da5ee2 100755 --- a/bin/gauth +++ b/bin/gauth @@ -1,8 +1,8 @@ #!/bin/sh # Use backup from andOTP -#gpg -qd ~/.otp_accounts.json.gpg 2>/dev/null | -cat ~/.otp_accounts.json | +#cat ~/.otp_accounts.json | +gpg -qd ~/.otp_accounts.json.gpg 2>/dev/null | jq -r '.[] | "\(.label) \(.secret)"' | while read -r l s; do echo "$l $(oathtool --totp -b "$s")" -- cgit v1.2.3 From 96d801cb25616b3004661ba8c5684a94b1a5968f Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 28 Aug 2022 12:17:38 +0200 Subject: update --- .gtkrc-2.0 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gtkrc-2.0 diff --git a/.gtkrc-2.0 b/.gtkrc-2.0 new file mode 100644 index 0000000..4c7c7e8 --- /dev/null +++ b/.gtkrc-2.0 @@ -0,0 +1,3 @@ +gtk-icon-theme-name = "Adwaita" +gtk-theme-name = "Adwaita" +gtk-font-name = "Liberation Sans 9" -- cgit v1.2.3 From b5bfa659d79895d3217377aea14ff14eb31a6319 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 31 Aug 2022 23:36:21 +0200 Subject: update --- .config/gtk-3.0/settings.ini | 2 ++ .config/i3/config | 2 +- bin/update_hosts | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.config/gtk-3.0/settings.ini b/.config/gtk-3.0/settings.ini index a3da8ab..30af16a 100644 --- a/.config/gtk-3.0/settings.ini +++ b/.config/gtk-3.0/settings.ini @@ -1,2 +1,4 @@ [Settings] +gtk-icon-theme-name = Adwaita +gtk-theme-name = Adwaita gtk-font-name = Liberation Sans 9 diff --git a/.config/i3/config b/.config/i3/config index 470f819..b59ded5 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -94,7 +94,7 @@ for_window [class="RSS Guard"] floating enable for_window [class="Signal"] floating enable for_window [class="Slack"] floating enable for_window [class="Spotify"] floating enable -for_window [class="Thunderbird"] floating enable +for_window [class="thunderbird"] floating enable for_window [class="UXTerm"] floating enable for_window [class="vlc"] floating enable for_window [instance="wish"] floating enable diff --git a/bin/update_hosts b/bin/update_hosts index 40ec470..74bf25b 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -7,9 +7,11 @@ echo 'Checking from https://github.com/StevenBlack/hosts:' lsd=$(curl -s 'https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1' | jq -r '.[0].commit.committer.date') -echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" +#echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" +echo "last source update: $(date --date="$lsd")" echo "last local update: $(date -r /etc/hosts)" -[ $(date -j -f "%FT%TZ" "$lsd" +%s) -lt $(date -r /etc/hosts +%s) ] && echo 'Nothing to do' && exit +# [ $(date -j -f "%FT%TZ" "$lsd" +%s) -lt $(date -r /etc/hosts +%s) ] && echo 'Nothing to do' && exit +[ $(date --date="$lsd" +%s) -lt $(date -r /etc/hosts +%s) ] && echo 'Nothing to do' && exit cd /etc cp -p hosts hosts.old -- cgit v1.2.3 From f70f37cfc0e59f9d3710bcf34d7cb9e0b9ad5c00 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 4 Sep 2022 22:13:46 +0200 Subject: update --- .config/i3/config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/i3/config b/.config/i3/config index b59ded5..f819e94 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -69,6 +69,7 @@ for_window [title="Gestionnaire de tâches – Chromium"] floating enable for_window [class="DeltaChat"] floating enable for_window [instance="DOTTY"] floating enable for_window [class="discord"] floating enable +for_window [class="easyeffects"] floating enable for_window [class="Display"] floating enable for_window [class="Feedreader"] floating enable for_window [class="feh"] floating enable @@ -80,20 +81,25 @@ for_window [class="Ghb"] floating enable for_window [class="Gitk"] floating enable for_window [class="gnuplot_qt"] floating enable for_window [instance="gxditview"] floating enable +for_window [class="index"] floating enable for_window [class="Keybase"] floating enable for_window [class="libreoffice"] floating enable for_window [class="Liferea"] floating enable for_window [class="llpp"] floating enable for_window [class="MuPDF"] floating enable +for_window [class="io.elementary.music"] floating enable +for_window [class="org.gnome.Music"] floating enable for_window [class="Org.gnome.Software"] floating enable for_window [class="Pavucontrol"] floating enable for_window [class="Pcmanfm"] floating enable for_window [class="Picard"] floating enable for_window [title="QEMU"] floating enable +for_window [class="Quodlibet"] floating enable for_window [class="RSS Guard"] floating enable for_window [class="Signal"] floating enable for_window [class="Slack"] floating enable for_window [class="Spotify"] floating enable +for_window [class="Tauon Music Box"] floating enable for_window [class="thunderbird"] floating enable for_window [class="UXTerm"] floating enable for_window [class="vlc"] floating enable -- cgit v1.2.3 From 99897ccd92f80a180d1640413016e85b1594672a Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 4 Sep 2022 22:27:12 +0200 Subject: add sennheise_px100ii equalizer --- casque/sennheiser_px100ii/ParametricEQ.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 casque/sennheiser_px100ii/ParametricEQ.txt diff --git a/casque/sennheiser_px100ii/ParametricEQ.txt b/casque/sennheiser_px100ii/ParametricEQ.txt new file mode 100644 index 0000000..eed7ac5 --- /dev/null +++ b/casque/sennheiser_px100ii/ParametricEQ.txt @@ -0,0 +1,11 @@ +Preamp: -6.5 dB +Filter 1: ON PK Fc 23 Hz Gain 6.3 dB Q 0.95 +Filter 2: ON PK Fc 162 Hz Gain -3.6 dB Q 0.66 +Filter 3: ON PK Fc 6208 Hz Gain 4.1 dB Q 3.63 +Filter 4: ON PK Fc 7884 Hz Gain 4.8 dB Q 2.31 +Filter 5: ON PK Fc 20428 Hz Gain 2.2 dB Q 0.14 +Filter 6: ON PK Fc 685 Hz Gain 0.9 dB Q 1.75 +Filter 7: ON PK Fc 1940 Hz Gain -2.8 dB Q 1.56 +Filter 8: ON PK Fc 2635 Hz Gain 3.4 dB Q 3.46 +Filter 9: ON PK Fc 3997 Hz Gain 3.0 dB Q 2.57 +Filter 10: ON PK Fc 4436 Hz Gain -5.7 dB Q 6.16 -- cgit v1.2.3 From df883d962dd99845eeb941b6a82365cba4da6438 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 4 Sep 2022 23:37:45 +0200 Subject: update --- .config/i3/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index f819e94..9069684 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -56,7 +56,7 @@ bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ to bindsym $mod+KP_Enter exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status -# enable floating mode +# enable floating mode and border for_window [class="aft-linux-qt"] floating enable for_window [class="Arandr"] floating enable for_window [class="Asunder"] floating enable @@ -69,7 +69,7 @@ for_window [title="Gestionnaire de tâches – Chromium"] floating enable for_window [class="DeltaChat"] floating enable for_window [instance="DOTTY"] floating enable for_window [class="discord"] floating enable -for_window [class="easyeffects"] floating enable +for_window [class="easyeffects"] floating enable border normal for_window [class="Display"] floating enable for_window [class="Feedreader"] floating enable for_window [class="feh"] floating enable -- cgit v1.2.3 From 0ee47251a9078cbc0678e419a7cb3d67e5434573 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 4 Sep 2022 23:42:32 +0200 Subject: add gtk4 settings --- .config/gtk-4.0/settings.ini | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .config/gtk-4.0/settings.ini diff --git a/.config/gtk-4.0/settings.ini b/.config/gtk-4.0/settings.ini new file mode 100644 index 0000000..30af16a --- /dev/null +++ b/.config/gtk-4.0/settings.ini @@ -0,0 +1,4 @@ +[Settings] +gtk-icon-theme-name = Adwaita +gtk-theme-name = Adwaita +gtk-font-name = Liberation Sans 9 -- cgit v1.2.3 From 37613ac0ac5475a1b7e7754cededf7eaa2f9ba70 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 12 Sep 2022 11:51:06 +0200 Subject: update --- .local/share/applications/lock.desktop | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .local/share/applications/lock.desktop diff --git a/.local/share/applications/lock.desktop b/.local/share/applications/lock.desktop new file mode 100644 index 0000000..f34faa6 --- /dev/null +++ b/.local/share/applications/lock.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Name=Lock Screen +Exec=loginctl lock-session +Terminal=true -- cgit v1.2.3 From bd71cbb5a7a50f3c548ed5989e843151978f7ccb Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 22 Sep 2022 10:25:07 +0200 Subject: update --- .local/share/applications/wpa_gui.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/share/applications/wpa_gui.desktop b/.local/share/applications/wpa_gui.desktop index 29542af..1955a23 100644 --- a/.local/share/applications/wpa_gui.desktop +++ b/.local/share/applications/wpa_gui.desktop @@ -2,7 +2,7 @@ Version=1.0 Name=wpa_gui Comment=Graphical user interface for wpa_supplicant -Exec=sudo wpa_gui -i wlan0 +Exec=wpa_gui -i wlan0 Icon=wpa_gui GenericName=wpa_supplicant user interface Terminal=false -- cgit v1.2.3 From 2757d8c1a282957ca9faf852a8652d16387ac41e Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 22 Sep 2022 19:06:30 +0200 Subject: update --- .bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 60ed9e4..b8f2d75 100644 --- a/.bashrc +++ b/.bashrc @@ -138,7 +138,7 @@ meteo() { [ -f "/usr/share/fzf/key-bindings.bash" ] && . "/usr/share/fzf/key-bindings.bash" # 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 -- cgit v1.2.3 From e7896c409cbcd41b980fa487c312fef986af00ec Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 26 Sep 2022 17:29:45 +0200 Subject: update --- .config/i3/config | 3 +++ .fvwm2rc | 1 + 2 files changed, 4 insertions(+) diff --git a/.config/i3/config b/.config/i3/config index 9069684..f642364 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -96,6 +96,9 @@ for_window [class="Picard"] floating enable for_window [title="QEMU"] floating enable for_window [class="Quodlibet"] floating enable for_window [class="RSS Guard"] floating enable +#for_window [class="Navigator"] floating enable +for_window [class="SeaMonkey"] floating enable +#for_window [window_role="browser"] floating enable for_window [class="Signal"] floating enable for_window [class="Slack"] floating enable for_window [class="Spotify"] floating enable diff --git a/.fvwm2rc b/.fvwm2rc index e8b061b..1159092 100644 --- a/.fvwm2rc +++ b/.fvwm2rc @@ -102,6 +102,7 @@ AddToMenu "Desktop-Apps" + "&Keybase" Exec exec keybase-gui + "S&ignal" Exec exec signal-desktop + "&Slack" Exec exec slack ++ "Sea&Monkey" Exec exec seamonkey + "&Zoom" Exec exec zoom DestroyMenu "Settings" -- cgit v1.2.3 From 0a294a82b2cf29a46cc926ceefebd2dcd34a0ab7 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 27 Sep 2022 15:10:44 +0200 Subject: add bin/w3 --- bin/w3 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 bin/w3 diff --git a/bin/w3 b/bin/w3 new file mode 100755 index 0000000..52a6408 --- /dev/null +++ b/bin/w3 @@ -0,0 +1,6 @@ +#!/bin/sh + +cols=$(stty -a|awk -F "[ ;]" '{print $9; exit}') +stty cols 72 +w3m "${@:-https://ddg.gg/lite/}" +stty cols "$cols" -- cgit v1.2.3 From 88199deb1a7e2ab390d392593d9499173b1190ba Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 28 Sep 2022 08:49:02 +0200 Subject: update --- bin/w3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/w3 b/bin/w3 index 52a6408..90cc29c 100755 --- a/bin/w3 +++ b/bin/w3 @@ -1,6 +1,6 @@ #!/bin/sh cols=$(stty -a|awk -F "[ ;]" '{print $9; exit}') -stty cols 72 +[ $cols -gt 72 ] && stty cols 72 w3m "${@:-https://ddg.gg/lite/}" stty cols "$cols" -- cgit v1.2.3 From abaaf4b6a33c497f233fd797272ba36152eb6961 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 29 Sep 2022 15:16:15 +0200 Subject: yoda: slight improvements --- .config/i3/config | 1 + bin/byo | 9 ++++++--- bin/yoda | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index f642364..6220086 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -108,6 +108,7 @@ for_window [class="UXTerm"] floating enable for_window [class="vlc"] floating enable for_window [instance="wish"] floating enable for_window [class="wpa_gui"] floating enable +for_window [class="Xdialog"] floating enable for_window [class="XVroot"] floating enable for_window [class="zoom"] floating enable diff --git a/bin/byo b/bin/byo index 93bb7f0..33ba3b7 100755 --- a/bin/byo +++ b/bin/byo @@ -2,23 +2,26 @@ # Backup to yoda [ "$USER" = root ] || exec sudo "$0" "$@" -usage='Usage: byo [-cdk] [/dev/sda2] +usage='Usage: byo [-cdkx] [/dev/sda2] Backup local disk to yoda external disk. Options: -c close and umount yoda -d dedupe yoda -k do not umount and close yoda + -x enable debug traces ' -while getopts :Ccdk opt; do +while getopts :Ccdkx opt; do case $opt in - (C|c|d|k) eval "opt$opt=$opt" ;; + (C|c|d|k|x) eval "opt$opt=$opt" ;; (*) printf %s "$usage"; exit 1 ;; esac done shift $((OPTIND - 1)) +[ "$optx" ] && set -x + dev=$1 yoda_uuid='8c463221-6bb7-414e-9060-c9570bb3a6bb' [ "$dev" ] || dev=$(blkid --uuid "$yoda_uuid") diff --git a/bin/yoda b/bin/yoda index 8ff9e81..a5d5c5b 100755 --- a/bin/yoda +++ b/bin/yoda @@ -138,12 +138,13 @@ EOT cat > /mnt/etc/locale.gen << \EOT en_US.UTF-8 UTF-8 +en_GB.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 EOT echo yoda > /mnt/etc/hostname echo 'KEYMAP=fr-latin1' > /mnt/etc/vconsole.conf - echo 'LANG=en_US.UTF-8' > /mnt/etc/locale.conf + echo 'LANG=en_GB.UTF-8' > /mnt/etc/locale.conf ln -sf /usr/share/zoneinfo/Europe/Paris /mnt/etc/localtime cat > /mnt/etc/systemd/network/20-wired.network << \EOT @@ -171,6 +172,7 @@ EOT cat > /mnt/etc/systemd/resolved.conf << \EOT [Resolve] DNSSEC=no +DNSOverTLS=no EOT packages="linux linux-firmware intel-ucode amd-ucode sof-firmware \ -- cgit v1.2.3 From 06ba4aa1a24be8fbb3a16f9e509f1dad00208df4 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 30 Sep 2022 12:13:54 +0200 Subject: update --- .Xresources | 3 ++ .w3m/config | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .w3m/keymap | 1 + .xsession | 2 +- README.md | 23 +++++++++ 5 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 .w3m/config create mode 100644 .w3m/keymap create mode 100644 README.md diff --git a/.Xresources b/.Xresources index b3589ed..8fc5281 100644 --- a/.Xresources +++ b/.Xresources @@ -1,3 +1,6 @@ +! Better to use multiples of 96 +Xft.dpi: 96 + ! uncomment following to display corretly using font 10x20 ! URxvt.boldFont: URxvt.transparent: false diff --git a/.w3m/config b/.w3m/config new file mode 100644 index 0000000..74a71ed --- /dev/null +++ b/.w3m/config @@ -0,0 +1,163 @@ +tabstop 8 +indent_incr 4 +pixel_per_char 9 +pixel_per_line 13 +frame 1 +target_self 0 +open_tab_blank 0 +open_tab_dl_list 0 +display_link 0 +display_link_number 0 +decode_url 0 +display_lineinfo 0 +ext_dirlist 1 +dirlist_cmd file:///$LIB/dirlist.cgi +use_dictcommand 1 +dictcommand file:///$LIB/w3mdict.cgi +multicol 0 +alt_entity 0 +graphic_char 0 +display_borders 0 +disable_center 0 +fold_textarea 0 +display_ins_del 1 +ignore_null_img_alt 1 +view_unseenobject 0 +display_image 1 +pseudo_inlines 1 +auto_image 1 +max_load_image 4 +ext_image_viewer 1 +image_scale 100 +inline_img_protocol 0 +imgdisplay w3mimgdisplay +image_map_list 1 +fold_line 0 +show_lnum 0 +show_srch_str 1 +label_topline 0 +nextpage_topline 0 +color 1 +basic_color terminal +anchor_color blue +image_color green +form_color red +mark_color cyan +bg_color terminal +active_style 0 +active_color cyan +visited_anchor 0 +visited_color magenta +pagerline 10000 +use_history 1 +history 100 +save_hist 1 +confirm_qq 0 +close_tab_back 0 +mark 0 +emacs_like_lineedit 0 +space_autocomplete 0 +vi_prec_num 0 +mark_all_pages 0 +wrap_search 0 +ignorecase_search 1 +use_mouse 1 +reverse_mouse 0 +relative_wheel_scroll 0 +relative_wheel_scroll_ratio 30 +fixed_wheel_scroll_count 5 +clear_buffer 1 +decode_cte 0 +auto_uncompress 0 +preserve_timestamp 1 +keymap_file keymap +document_root +personal_document_root +cgi_bin +index_file +mime_types ~/.mime.types, /usr/etc/mime.types +mailcap ~/.w3m/mailcap, /usr/etc/w3m/mailcap +urimethodmap ~/.w3m/urimethodmap, /usr/etc/w3m/urimethodmap +editor /usr/bin/vi +mailto_options 1 +mailer /usr/bin/mail +extbrowser /usr/bin/firefox +extbrowser2 +extbrowser3 +extbrowser4 +extbrowser5 +extbrowser6 +extbrowser7 +extbrowser8 +extbrowser9 +bgextviewer 1 +use_lessopen 0 +passwd_file ~/.w3m/passwd +disable_secret_security_check 0 +ftppasswd +ftppass_hostnamegen 1 +pre_form_file ~/.w3m/pre_form +siteconf_file ~/.w3m/siteconf +user_agent +no_referer 0 +cross_origin_referer 1 +accept_language en;q=1.0 +accept_encoding gzip, compress, bzip, bzip2, deflate, br +accept_media text/html, text/*;q=0.5, image/* +argv_is_url 1 +retry_http 1 +default_url 1 +follow_redirection 10 +meta_refresh 0 +localhost_only 0 +dns_order 0 +nntpserver +nntpmode +max_news 50 +use_proxy 1 +http_proxy +https_proxy +gopher_proxy +ftp_proxy +no_proxy +noproxy_netaddr 1 +no_cache 0 +ssl_forbid_method 2, 3, t, 5 +ssl_min_version +ssl_cipher +ssl_verify_server 1 +ssl_cert_file +ssl_key_file +ssl_ca_path +ssl_ca_file +ssl_ca_default 1 +use_cookie 1 +show_cookie 0 +accept_cookie 1 +accept_bad_cookie 0 +cookie_reject_domains +cookie_accept_domains +cookie_avoid_wrong_number_of_dots +display_charset UTF-8 +document_charset UTF-8 +auto_detect 2 +system_charset UTF-8 +follow_locale 1 +ext_halfdump 0 +use_wide 1 +use_combining 1 +east_asian_width 0 +use_language_tag 1 +ucs_conv 1 +pre_conv 0 +search_conv 1 +fix_width_conv 1 +use_gb12345_map 0 +use_jisx0201 0 +use_jisc6226 0 +use_jisx0201k 0 +use_jisx0212 0 +use_jisx0213 0 +strict_iso2022 1 +gb18030_as_ucs 0 +simple_preserve_space 0 diff --git a/.w3m/keymap b/.w3m/keymap new file mode 100644 index 0000000..d53ab11 --- /dev/null +++ b/.w3m/keymap @@ -0,0 +1 @@ +keymap M-/ COMMAND "GOTO https://duckduckgo.com/lite/; NEXT_LINK; GOTO_LINK" diff --git a/.xsession b/.xsession index 6d4b699..25e7837 100755 --- a/.xsession +++ b/.xsession @@ -18,7 +18,7 @@ hdmi xrdb ~/.Xresources #xsetroot -solid rgb:3/4/5 #xsetroot -solid rgb:1/3/4 -feh --bg-fill ~/night1.jpg +feh --bg-fill ~/Pictures/night1.jpg #feh --bg-fill ~/Downloads/Alaska_Range.jpg #conky #slock diff --git a/README.md b/README.md new file mode 100644 index 0000000..36af6d0 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# Dotfiles + +Configuration files, stored in a bare git repository. Avoid symlinks and extra tooling + +Use: + + git init --bare ~/dotfiles + alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' + +Au lieu de +dotfiles config status.showUntrackedFiles no + cat ~/.gitignore : + * + +On other machine, to reconstruct: + git clone --bare git@bip.im:dotfiles dotfiles + alias dotfiles as above + dotfiles checkout +remove files in the way if necessary + +Manage one branch per computer if necessary. + +If a change is for all, do it on master, then: dotfiles merge master -- cgit v1.2.3 From 9f8cb54bd99b89a2f07bba4f4d1f761fd853b195 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 30 Sep 2022 12:16:05 +0200 Subject: update --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 36af6d0..0c83b01 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,23 @@ Use: alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME' Au lieu de -dotfiles config status.showUntrackedFiles no - cat ~/.gitignore : + + dotfiles config status.showUntrackedFiles no + +`cat ~/.gitignore` : + * On other machine, to reconstruct: + git clone --bare git@bip.im:dotfiles dotfiles alias dotfiles as above dotfiles checkout + remove files in the way if necessary Manage one branch per computer if necessary. -If a change is for all, do it on master, then: dotfiles merge master +If a change is for all, do it on master, then: + + dotfiles merge master -- cgit v1.2.3 From 5b201b3fcd94c8bad917e2b45dbb1105cb060cdb Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 1 Oct 2022 12:41:24 +0200 Subject: update --- .Xresources | 1 + .config/i3/config | 6 ++++-- .screenrc | 2 ++ bin/backup | 26 +++++++++++++++++--------- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.Xresources b/.Xresources index 8fc5281..ec47c2e 100644 --- a/.Xresources +++ b/.Xresources @@ -21,6 +21,7 @@ URxvt.keysym.C-Next: font-size:decrease !URxvt.background: black xterm*termName: xterm-256color +xterm*internalBorder: 4 xterm*VT100.Translations: #override \ Ctrl Next: smaller-vt-font() \n\ Ctrl Prior: larger-vt-font() \n diff --git a/.config/i3/config b/.config/i3/config index 6220086..1740966 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -120,6 +120,7 @@ floating_modifier $mod # start a terminal bindsym $mod+Return exec --no-startup-id xt bindsym $mod+t exec --no-startup-id uxterm +bindsym $mod+Shift+t exec --no-startup-id xtb # kill focused window bindsym $mod+Shift+a kill @@ -133,9 +134,10 @@ bindsym --release button2 kill # installed. #bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'" #bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'" -bindsym $mod+d exec --no-startup-id i3-dmenu-desktop +#bindsym $mod+d exec --no-startup-id i3-dmenu-desktop #bindsym F1 exec --no-startup-id i3-dmenu-desktop -entry-type=command -bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Fixed-12'" +#bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Fixed-12'" +bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Fixed-12'" # Use playerctl to control media player from keyboard bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause diff --git a/.screenrc b/.screenrc index 3337674..1a802d2 100644 --- a/.screenrc +++ b/.screenrc @@ -1 +1,3 @@ startup_message off +defmousetrack on +mousetrack on diff --git a/bin/backup b/bin/backup index d682849..9e73703 100755 --- a/bin/backup +++ b/bin/backup @@ -1,5 +1,7 @@ #!/bin/sh +# A backup a day keeps the doctor away. + usage() { echo "Usage: $0 [-nv] [[[user@]host]:dir] @@ -34,13 +36,19 @@ BACKUP=${1:-$BACKUP} ignore="$HOME/.backupignore" volumes="$HOME" [ -f "$ignore" ] && ignore="--exclude-from=$ignore" || ignore= -last=$(rsync --list-only "$BACKUP/" 2>/dev/null | awk '{r=$NF} END {print r}') -case $last in -([12]*) opt_link=--link-dest=../$last;; -(*) opt_link=;; -esac - -date=$(date +%Y-%m-%d-%H%M%S) +now=$(date +%F) +opt_link='' +past=$(rsync --list-only "$BACKUP/" 2>/dev/null | awk '{print $NF}' | sort -r) +for f in $past +do + case $f in + ([0-9][0-9][0-9][0-9]-*) ;; + (*) continue ;; + esac + [ "$f" = "$now" ] && continue + opt_link="--link-dest=../$f" + break +done -echo "# Backup $volumes to $BACKUP/$date" -exec rsync -HSxa$optv $ignore $opt_link $volumes "$BACKUP/$date" +echo "# Backup $volumes to $BACKUP/$now" +exec rsync -HSXxa$optv $ignore $opt_link $volumes "$BACKUP/$now" -- cgit v1.2.3 From d30fd8ea96799196035cb53a1374a50dd967fedf Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 3 Oct 2022 13:24:45 +0200 Subject: update --- .mbsyncrc | 38 +++++++++++++++++++++++++++ .mutt/free | 8 ++++++ .mutt/muttrc | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ swift/etc/nsswitch.conf | 19 ++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 .mbsyncrc create mode 100644 .mutt/free create mode 100644 .mutt/muttrc create mode 100644 swift/etc/nsswitch.conf diff --git a/.mbsyncrc b/.mbsyncrc new file mode 100644 index 0000000..dcfe913 --- /dev/null +++ b/.mbsyncrc @@ -0,0 +1,38 @@ +IMAPStore free-remote +Host imap.free.fr +SSLType IMAPS +User mvertes@free.fr +PassCmd "pass email/mvertes@free.fr" + +MaildirStore free-local +Path ~/Mail/free/ +Inbox ~/Mail/free/INBOX +Subfolders Verbatim + +Channel free +Far :free-remote: +Near :free-local: +Create Both +Expunge Both +Patterns * +SyncState * + +IMAPStore gmail-remote +Host imap.gmail.com +SSLType IMAPS +AuthMechs LOGIN +User marc.vertes@traefik.io +PassCmd "pass email/marc.vertes@traefik.io" + +MaildirStore gmail-local +Path ~/Mail/gmail/ +Inbox ~/Mail/gmail/INBOX +Subfolders Verbatim + +Channel gmail +Far :gmail-remote: +Near :gmail-local: +Create Both +Expunge Both +Patterns * !"[Gmail]/All Mail" !"[Gmail]/Important" !"[Gmail]/Starred" !"[Gmail]/Bin" +SyncState * diff --git a/.mutt/free b/.mutt/free new file mode 100644 index 0000000..4694401 --- /dev/null +++ b/.mutt/free @@ -0,0 +1,8 @@ +set folder = "~/Mail/free/" +set spoolfile = "+INBOX" +set postponed = "+Drafts" +set trash = "+Trash" +set record = "" + +set from = "mvertes@free.fr" +set realname = "Marc Vertes" diff --git a/.mutt/muttrc b/.mutt/muttrc new file mode 100644 index 0000000..817065b --- /dev/null +++ b/.mutt/muttrc @@ -0,0 +1,68 @@ +set folder=~/Mail/free +set spoolfile=+/INBOX +set header_cache=~/.cache/mutt +auto_view text/html +alternative_order text/plain text/enriched text/html + +color normal black default + +color hdrdefault red default +color signature blue default +color indicator black brightyellow +color error brightred default +color status white blue +color tree red default # the thread tree in the index menu +color tilde magenta default +color message blue default +color markers cyan default +color attachment brightmagenta default +color search black green # how to hilite searches in the pager +color quoted blue default # quoted text +color quoted1 magenta default +color quoted2 red default +color quoted3 green default +color quoted4 cyan default +color quoted5 blue default +color quoted6 magenta default +color quoted7 red default +color quoted8 green default +color quoted9 cyan default +color underline brightgreen default +color index green default ~F + +color header red default ^(From|Subject): +# point out url's +color body black default "((ftp|http|https)://|(file|news):|www\\.)[-a-z0-9_.:]*[a-z0-9](/[^][{} \t\n\r\"<>()]*[^][{} \t\n\r\"<>().,:!])?/?" +color body cyan default [-a-z_0-9.]+@[-a-z_0-9.]+ # e-mail addresses + +# smilies and the like +color body brightgreen default "<[Gg]>" +color body brightgreen default "<[Bb][Gg]>" +# see also the variables smileys +color body black yellow ">?[;:][-^]?[][)(><}{|/DP][)}]*" + +# +# Mono +# + +mono normal none # normal text +mono indicator reverse # actual message +mono tree none # thread arrows +mono status reverse # status line +#mono error bold +mono error standout +mono message none # info messages +mono quoted bold +mono signature none +mono attachment underline # MIME attachments +mono search reverse # search matches +mono tilde none # ~ at bottom of msg +mono markers bold # + at beginning of wrapped lines +mono hdrdefault none # default header lines +mono bold bold # hilite bold patterns in body +mono underline underline # hilite underlined patterns in body +mono header bold "^(from|subject):" +mono body underline "((ftp|http|https)://|(file|news):|www\\.)[-a-z0-9_.:]*[a-z0-9](/[^][{} \t\n\r\"<>()]*[^][{} \t\n\r\"<>().,:!])?/?" +mono body underline "[-a-z_0-9.]+@[-a-z_0-9.]+" +mono body bold "(^| )\\*[-a-z0-9äöüß*]+\\*[,.?]?[ \n]" +mono body underline "(^| )_[-a-z0-9äöüß_]+_[,.?]?[ \n]" diff --git a/swift/etc/nsswitch.conf b/swift/etc/nsswitch.conf new file mode 100644 index 0000000..392c640 --- /dev/null +++ b/swift/etc/nsswitch.conf @@ -0,0 +1,19 @@ +# Name Service Switch configuration file. +# See nsswitch.conf(5) for details. + +passwd: files systemd +group: files [SUCCESS=merge] systemd +shadow: files + +publickey: files + +# hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns +hosts: mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns +networks: files + +protocols: files +services: files +ethers: files +rpc: files + +netgroup: files -- cgit v1.2.3 From 5ea00546c6ee925235226871ab76ce9b08981029 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 4 Oct 2022 20:26:49 +0200 Subject: update --- swift/etc/resolv.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 swift/etc/resolv.conf diff --git a/swift/etc/resolv.conf b/swift/etc/resolv.conf new file mode 100644 index 0000000..a336b7f --- /dev/null +++ b/swift/etc/resolv.conf @@ -0,0 +1 @@ +nameserver 9.9.9.9 -- cgit v1.2.3 From aee3773f166f25475394cd0fe3fb7be7e818698d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 5 Oct 2022 19:02:09 +0200 Subject: update --- .config/i3/config | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/i3/config b/.config/i3/config index 1740966..4c8973d 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -68,6 +68,7 @@ for_window [title="Task Manager - Chromium"] floating enable for_window [title="Gestionnaire de tâches – Chromium"] floating enable for_window [class="DeltaChat"] floating enable for_window [instance="DOTTY"] floating enable +for_window [instance="LEFTY text view"] floating enable for_window [class="discord"] floating enable for_window [class="easyeffects"] floating enable border normal for_window [class="Display"] floating enable -- cgit v1.2.3 From af0fca8574d84d172e5fb1165f3e35ed86f0f148 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 7 Oct 2022 09:36:01 +0200 Subject: update --- .config/i3/config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index 4c8973d..c9a93bb 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -124,9 +124,9 @@ bindsym $mod+t exec --no-startup-id uxterm bindsym $mod+Shift+t exec --no-startup-id xtb # kill focused window -bindsym $mod+Shift+a kill -bindsym $mod+w kill -bindsym --release button2 kill +bindsym $mod+q kill +#bindsym $mod+w kill +bindsym --release $mod+button2 kill # start dmenu (a program launcher) #bindsym $mod+d exec dmenu_run @@ -201,7 +201,7 @@ bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle # focus the parent container -bindsym $mod+q focus parent +#bindsym $mod+q focus parent # focus the child container #bindsym $mod+d focus child -- cgit v1.2.3 From 0ef432a3c4a933016eccee7ddeddf77bd4955746 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 9 Oct 2022 12:33:42 +0200 Subject: update --- .backupignore | 3 +++ swift/etc/backupignore | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 swift/etc/backupignore diff --git a/.backupignore b/.backupignore index bffc095..d44fbac 100644 --- a/.backupignore +++ b/.backupignore @@ -1,6 +1,9 @@ .*[Cc]ache/ *[Cc]ache/ CacheStorage/ +kernel-build/ +kernel-build.old/ +src/kernel.org/ go/pkg/ gopath/pkg/ sigfox/vm/ diff --git a/swift/etc/backupignore b/swift/etc/backupignore new file mode 100644 index 0000000..693cfa4 --- /dev/null +++ b/swift/etc/backupignore @@ -0,0 +1,32 @@ +# file patterns to be excluded from backup +/backup +.history/ +.cache/ +.cargo/ +.rustup/ +.npm/ +Cache/ +cache/ +GPUCache +CacheStorage +go/pkg/ +keybase/ +sdk/ +tmp/ +kernel-build/ +kernel-build.old/ +.xsession-errors +/var/lib/docker +/var/lib/flatpak +/var/lib/systemd/coredump/ +.config/chromium/ +.config/discord/ +.config/Slack/ +.config/Signal/ +.config/spotify/ +.mozilla/firefox/ +.thunderbird/xgfazjt1.default/ImapMail/ +.thunderbird/xgfazjt1.default/global-messages-db.sqlite +*.journal +*.log +*.o -- cgit v1.2.3 From 6ab619d6c1ab7bd5356898b5f87ea65cf2ca821d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 10 Oct 2022 16:33:54 +0200 Subject: update --- .config/bat/config | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .config/bat/config diff --git a/.config/bat/config b/.config/bat/config new file mode 100644 index 0000000..4143a20 --- /dev/null +++ b/.config/bat/config @@ -0,0 +1,27 @@ +# This is `bat`s configuration file. Each line either contains a comment or +# a command-line option that you want to pass to `bat` by default. You can +# run `bat --help` to get a list of all possible configuration options. + +# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes` +# for a list of all available themes +#--theme="TwoDark" +#--theme="GitHub" +--theme="ansi" + +# Enable this to use italic text on the terminal. This is not supported on all +# terminal emulators (like tmux, by default): +#--italic-text=always + +# Uncomment the following line to disable automatic paging: +#--paging=never + +# Uncomment the following line if you are using less version >= 551 and want to +# enable mouse scrolling support in `bat` when running inside tmux. This might +# disable text selection, unless you press shift. +#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse" + +# Syntax mappings: map a certain filename pattern to a language. +# Example 1: use the C++ syntax for Arduino .ino files +# Example 2: Use ".gitignore"-style highlighting for ".ignore" files +#--map-syntax "*.ino:C++" +#--map-syntax ".ignore:Git Ignore" -- cgit v1.2.3 From 6aa36aad93b61538befff7b8c1454e73b93de8c0 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 17 Oct 2022 18:24:04 +0200 Subject: update --- .config/i3/config | 1 + bin/fv | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/i3/config b/.config/i3/config index c9a93bb..e0e8c9b 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -110,6 +110,7 @@ for_window [class="vlc"] floating enable for_window [instance="wish"] floating enable for_window [class="wpa_gui"] floating enable for_window [class="Xdialog"] floating enable +for_window [class="Xournalpp"] floating enable for_window [class="XVroot"] floating enable for_window [class="zoom"] floating enable diff --git a/bin/fv b/bin/fv index 5662ed3..1f54bdc 100755 --- a/bin/fv +++ b/bin/fv @@ -3,4 +3,4 @@ #exec fzf --multi --preview-window=right:66% --preview 'cat {1}' exec fzf --ansi --multi --preview-window=right:75% \ --bind=left:preview-page-up --bind=right:preview-page-down \ - --preview 'cat {1}' + --preview 'bat --color always {1}' -- cgit v1.2.3 From a13224ab0c00d6524710f8477d9efdf661296ca3 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 1 Nov 2022 12:08:28 +0100 Subject: update --- bin/wag | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100755 bin/wag diff --git a/bin/wag b/bin/wag new file mode 100755 index 0000000..4e0c802 --- /dev/null +++ b/bin/wag @@ -0,0 +1,291 @@ +#!/bin/sh + +## wag is a tool to generate static web sites + +unset CDPATH +export LC_ALL=C IFS=' +' + +cmd=$(command -v "$0") + +## help prints this program documentation +help() { awk '/^## / {print substr($0, 4)}' "$cmd"; } + +lipsum='Lorem ipsum dolor sit amet, consectetur adipiscing elit, +sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris +nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in +reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla +pariatur. Excepteur sint occaecat cupidatat non proident, sunt in +culpa qui officia deserunt mollit anim id est laborum.' + +# An overly simplified http request parser for static web sites. +http_request() { + read -r cmd uri proto + case $uri in */) uri="${uri}index.html" ;; esac + while true; do + read -r line || break + [ ${#line} = 0 ] && break + done + printf 'HTTP/1.1 200 OK\n\n' && cat "${uri#/}" +} + +md2h() { want="$2" got=$(echo "$1" | md2html -); } + +md2html() { + tmp=$(mktemp -u) + trap "rm -f '$tmp'" EXIT + { + cat "${1:--}" | tee "$tmp" | awk '/^[ ]*\[[^]]+\]:/' + cat "$tmp" + } | + awk ' + function newblock(nblock) { + if (text) + print "<" block ">" text "" + text = "" + out = 1 + block = nblock ? nblock : "p" + } + + function subinline(tgl, inl) { + while (match($0, tgl)) { + if (inline[ni] == inl) + ni -= sub(tgl, "") + else if (sub(tgl, "<" inl ">")) + inline[++ni] = inl + } + } + + function dolink(href, lnk) { + # Undo escaped html in uris + gsub(/&/, "\\&", href) + gsub(/</, "<", href) + gsub(/>/, ">", href) + # & can be tricky, and not standard: + gsub(/&/, "\\\\\\&", href) + gsub(/&/, "\\\\\\&", lnk) + return "" lnk "" + } + + BEGIN { + ni = 0 # inlines + nl = 0 # nested lists + out = 0 # 0 if no output so far + text = "" + block = "p" + } + + # Skip front matter. + out == 0 && $0 == "---" { + do + getline + while ($0 != "---") + next + } + + # Escape HTML. + esc != "false" { + gsub("&", "\\&") + gsub("<", "\\<") + gsub(">", "\\>") + } + + # Internal references. + match($0, /^[ ]*\[[^]]+\]:/) > 0 { + k = substr($0, RSTART+1, RLENGTH-3) + v = substr($0, RLENGTH+1) + sub(/^[ ]/, "", v) + sub(/[ ]$/, "", v) + ref[substr($0, RSTART+1, RLENGTH-3)] = v + next + } + + # Horizontal rules. + /^[ ]*([-*_] ?)+[ ]*$/ && text == "" { + print "
" + next + } + + # Tables. Syntax: + # Right Align| Center Align |Left Align + /([ ]\|)|(\|[ ])/ { + if (block != "table") + newblock("table") + nc = split($0, cells, "|") + $0 = "\n" + for (i = 1; i <= nc; i++) { + align = "left" + if (sub(/^[ ]+/, "", cells[i])) { + if (sub(/[ ]+$/, "", cells[i])) + align = "center" + else + align = "right" + } + sub(/[ ]+$/, "", cells[i]) + $0 = $0 "" cells[i] "\n" + } + $0 = $0 "" + } + + # Ordered and unordered (possibly nested) lists. + /^[ ]*([*+-]|(([0-9]+[.-]?)+))[ ]/ { + newblock("li") + nnl = 1 + while (match($0, /^[ ]/)) { + sub(/^[ ]/, "") + nnl++ + } + while (nl > nnl) + print "" + while (nl < nnl) { + list[++nl] = "ol" + if (match($0, /^[*+-]/)) + list[nl] = "ul" + print "<" list[nl] ">" + } + sub(/^([*+-]|(([0-9]+[.-]?)+))[ ]/, "") + } + + # Multi line list items. + block == "li" { + sub(/^( *)|( *)/, "") + } + + # Code blocks. + /^( | )/ { + if (block != "code") + newblock("code") + sub(/^( | )/, "") + text = text $0 "\n" + next + } + + # Paragraphs. + /^$/ { + newblock() + while (nl > 0) + print "" + } + + # Headers. + /^#+ / { + newblock() + match($0, /#+/) + n = RLENGTH + if (n > 6) + n = 6 + text = substr($0, RLENGTH + 1) + sub(/^ */, "", text) + block = "h" n + next + } + + # Alternate headers (underlined). + /^=+$/ { + block = "h" 1 + next + } + + /^-+$/ { + block = "h" 2 + next + } + + { + # Images. + while (match($0, /!\[[^]]+\]\([^)]+\)/)) { + split(substr($0, RSTART, RLENGTH), a, /(!\[)|\)|(\]\()/) + sub(/!\[[^]]+\]\([^)]+\)/, "\""") + } + # Links. + while (match($0, /\[[^]]+\]\([^)]+\)/)) { + split(substr($0, RSTART, RLENGTH), a, /[[)]|(\]\()/) + sub(/\[[^]]+\]\([^)]+\)/, dolink(a[3], a[2])) + } + # Internal references. + while (match($0, /\[[^]]+\]/)) { + k = substr($0, RSTART+1, RLENGTH-2) + sub(/\[[^]]+\]/, dolink(ref[k], k)) + } + # Auto links (uri matching is poor). + na = split($0, a, /(^\()|[ ]|([,.)]([ ]|$))/) + for (i = 1; i <= na; i++) + if (match(a[i], /^(((https?|ftp|file|news|irc):\/\/)|(mailto:)).+$/)) + sub(a[i], dolink(a[i], a[i])) + # Inline. + subinline("(\\*\\*)|(__)", "strong") + subinline("\\*", "em") + subinline("`", "code") + text = text (text ? " " : "") $0 + } + + END { + while (ni > 0) + text = text "" + newblock() + while (nl > 0) + print "" + }' +} + +#serve() { while true; do busybox nc -kl -p 1500 -e "$cmd http_request"; done; } +serve() { WAG_FUN=http_request busybox nc -kl -p 1500 -e "$cmd"; } + +test() { + fail=0 pass=0 skip=0 tfilter="$*" + + test_run md2h 'abc __def__ ghi' '

abc def ghi

' + test_run md2h 'abc **def** ghi' '

abc def ghi

' + test_run md2h 'abc *def* ghi' '

abc def ghi

' + test_run md2h 'abc ***def*** ghi' '

abc def ghi

' + test_run md2h 'abc `def` ghi' '

abc def ghi

' + test_run md2h '# h1' '

h1

' + test_run md2h '## h2' '

h2

' + test_run md2h 'h1 +==' '

h1

' + test_run md2h 'h2 +--' '

h2

' + test_run md2h 'abc [github] def' '

abc github def

' + test_run md2h 'abc [github](https://github.com) def' '

abc github def

' + test_run md2h 'abc [github] def + +[github]: https://github.com' '

abc github def

' + test_run md2h '--- +Title: front matter test +--- + +Hello [world]. + +--- +Bye. + +[world]: http://example.com' '

Hello world.

+
+

Bye.

' + + echo "Total: $((pass + fail + skip)), Passed: $pass, Failed: $fail, Skip: $skip" + return "$fail" +} + +test_run() { + eval "test_$1=\$((test_$1 + 1)); ti=\"\$test_$1\"" + [ "$tfilter" ] && + case "$1#$ti" in + $tfilter) ;; + *) skip=$((skip + 1)); return 0 ;; + esac + "$@" + [ "$got" = "$want" ] && { + pass=$((pass + 1)) + return 0 + } + fail=$((fail + 1)) + printf "%s FAIL\n Got: %s\n Want: %s\n" "$1#$ti" "$got" "$want" >&2 + return 1 +} + +[ "$WAG_FUN" ] && { $WAG_FUN; exit; } + +# Execute command line +[ "$1" ] || help && "$@" -- cgit v1.2.3 From 4489efe4b753a2edfad646c4b3506c95f2348813 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 15 Nov 2022 17:30:45 +0100 Subject: update --- .Xresources | 3 ++- .bashrc | 2 ++ .vim/pack/mvertes/install.sh | 2 ++ bin/wag | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.Xresources b/.Xresources index ec47c2e..274ee87 100644 --- a/.Xresources +++ b/.Xresources @@ -13,7 +13,8 @@ URxvt.cursorColor: red Urxvt.font: 6x13 !URxvt.font: xft:Mono:size=12 !URxvt.font: xft:Mono:size=10 -URxvt.letterSpace: -1 +!URxvt.letterSpace: 0 +URxvt.letterSpace: 0 URxvt.perl-ext-common: font-size URxvt.keysym.C-Prior: font-size:increase URxvt.keysym.C-Next: font-size:decrease diff --git a/.bashrc b/.bashrc index b8f2d75..926f90e 100644 --- a/.bashrc +++ b/.bashrc @@ -145,3 +145,5 @@ meteo() { eval "$(direnv hook bash)" #export GITHUB_TOKEN=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 + +set -o vi diff --git a/.vim/pack/mvertes/install.sh b/.vim/pack/mvertes/install.sh index 48d5950..90cd4b3 100755 --- a/.vim/pack/mvertes/install.sh +++ b/.vim/pack/mvertes/install.sh @@ -5,6 +5,8 @@ git@github.com:mvertes/vimki git@github.com:fatih/vim-go git@github.com:othree/xml.vim git@github.com:junegunn/fzf.vim +git@github.com:mattn/libcallex-vim +git@github.com:bytesnake/vim-graphical-preview ' ht='test -d doc && vim -c "helptags doc" -c "q"' diff --git a/bin/wag b/bin/wag index 4e0c802..a1542b6 100755 --- a/bin/wag +++ b/bin/wag @@ -1,6 +1,8 @@ #!/bin/sh ## wag is a tool to generate static web sites +## +## Commands: unset CDPATH export LC_ALL=C IFS=' @@ -8,6 +10,48 @@ export LC_ALL=C IFS=' cmd=$(command -v "$0") +dest=./public + +footer() { + : +} + +# front parses front matter +front() { + { + read a b && [ "$a" = "---" ] && [ "$b" = "" ] || return + while read a b; do + [ "$a" = "---" ] && [ "$b" = "" ] && break + eval "front_${a%:}=\"$b\"" + done + } < "$1" +} + +## gen generates site content from source files +gen() { + [ -d "$dest" ] || mkdir -p "$dest" + for f in *.md; do + [ "$f" = "*.md" ] && continue + g="$dest/${f%.md}.html" + [ "$f" -ot "$g" ] && continue + echo "f: $f $g" + front "$f" + { + header + md2html "$f" + footer + } > "$g" + done +} + +header() { + cat <<- EOT + $front_title + + + EOT +} + ## help prints this program documentation help() { awk '/^## / {print substr($0, 4)}' "$cmd"; } -- cgit v1.2.3 From 7883e56fadc6c8be32c455b69fd43dedb95c9d20 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 7 Dec 2022 14:53:33 +0100 Subject: update --- .bashrc | 5 ++++- .config/i3/config | 3 +++ .xsession | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 926f90e..adafe27 100644 --- a/.bashrc +++ b/.bashrc @@ -5,7 +5,7 @@ export PAGER=less export EDITOR=vim -export HISTIGNORE=ls:ps:history +export HISTIGNORE='sudo id:uname:date:exit:df:ll:ls:ps:pwd:top:history' export HISTCONTROL=ignoreboth:erasedups # no start space and duplicate entries export HISTSIZE=100000 # big big history export HISTFILESIZE=100000 # big big history @@ -147,3 +147,6 @@ eval "$(direnv hook bash)" #export GITHUB_TOKEN=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 set -o vi +bind -m vi-command ".":insert-last-argument +bind -m vi-command 'Control-l: clear-screen' +bind -m vi-insert 'Control-l: clear-screen' diff --git a/.config/i3/config b/.config/i3/config index e0e8c9b..6c871ae 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -77,6 +77,8 @@ for_window [class="feh"] floating enable for_window [class="firefox"] floating enable for_window [class="fluent-reader"] floating enable border normal for_window [class="Geeqie"] floating enable +for_window [class="Google-chrome"] floating enable +for_window [title="Google Chrome"] floating enable for_window [class="Gpicview"] floating enable for_window [class="Ghb"] floating enable for_window [class="Gitk"] floating enable @@ -86,6 +88,7 @@ for_window [class="index"] floating enable for_window [class="Keybase"] floating enable for_window [class="libreoffice"] floating enable for_window [class="Liferea"] floating enable +for_window [class="lagrange"] floating enable for_window [class="llpp"] floating enable for_window [class="MuPDF"] floating enable for_window [class="io.elementary.music"] floating enable diff --git a/.xsession b/.xsession index 25e7837..33a4251 100755 --- a/.xsession +++ b/.xsession @@ -26,3 +26,4 @@ feh --bg-fill ~/Pictures/night1.jpg # Start window manager #exec fvwm exec i3 +#exec cwm -- cgit v1.2.3 From 9dcf9d6a3fa8203cef7d57c8e811b300d4ecc97d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 11 Dec 2022 17:53:36 +0100 Subject: update --- swift/etc/sudoers.d/01_marc | 1 + 1 file changed, 1 insertion(+) create mode 100644 swift/etc/sudoers.d/01_marc diff --git a/swift/etc/sudoers.d/01_marc b/swift/etc/sudoers.d/01_marc new file mode 100644 index 0000000..9ae91f4 --- /dev/null +++ b/swift/etc/sudoers.d/01_marc @@ -0,0 +1 @@ +marc ALL=(ALL) NOPASSWD: ALL -- cgit v1.2.3 From 0a215cad87338787410af0df999d41c14f00c9e0 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 14 Jan 2023 18:32:46 +0100 Subject: update --- .bashrc | 2 + .forward | 1 + .xsession | 4 +- bin/dv | 653 +++++++++++---------------------------------- swift/etc/smtpd/smtpd.conf | 20 ++ 5 files changed, 180 insertions(+), 500 deletions(-) create mode 100644 .forward create mode 100644 swift/etc/smtpd/smtpd.conf diff --git a/.bashrc b/.bashrc index adafe27..739bdb2 100644 --- a/.bashrc +++ b/.bashrc @@ -104,6 +104,8 @@ export -f mosht ssht() { ssh -t "$@" -- tmux new -A; } export -f ssht +sshs() { ssh -t "$@" -- screen -d -R; } + mpvx() { mpv --vo=sixel --profile=sw-fast --really-quiet "$@"; } export -f mpvx diff --git a/.forward b/.forward new file mode 100644 index 0000000..b561804 --- /dev/null +++ b/.forward @@ -0,0 +1 @@ +marc mvertes@free.fr diff --git a/.xsession b/.xsession index 33a4251..08383ba 100755 --- a/.xsession +++ b/.xsession @@ -17,8 +17,8 @@ hdmi xrdb ~/.Xresources #xsetroot -solid rgb:3/4/5 -#xsetroot -solid rgb:1/3/4 -feh --bg-fill ~/Pictures/night1.jpg +xsetroot -solid rgb:1/3/4 +#feh --bg-fill ~/Pictures/night1.jpg #feh --bg-fill ~/Downloads/Alaska_Range.jpg #conky #slock diff --git a/bin/dv b/bin/dv index 0737295..39164db 100755 --- a/bin/dv +++ b/bin/dv @@ -1,556 +1,213 @@ #!/bin/sh -# Local dv (aka sim) +# - Usage: dv command [options] [args] +# - dv is a dumb version management tool. +# - Options: +# - -a num set ancestor level (default 1) +# - -n dry-run mode, no changes are made +# - -v verbose mode +# - Commands: -dv_version='dv-0.23 Copyright 2013-2014 Marc Vertes, Philippe Bergheaud' unset CDPATH export LC_ALL=C IFS=' ' - -anc() { - usage 'anc [Version]' 'print ancestor' && return - getdv .dv || die no item - case $1 in - (""|.|$PWD) - [ "$Opt_N" ] && Opt_N=$(($Opt_N - 1)) - [ "$Opt_N" ] && info anc $R2 $Opt_N || echo $R2 +version=dv-0.2 +dvlib=${DVLIB:-$HOME/dvlib} +script="$(cd "$(dirname "$0")" && pwd)/${0##*/}" +aopt=1 + +case $(uname -o) in + (Android|Linux) + diffopt='--color=always' + lsopt='-v --color' ;; - (*) info anc $1 ${Opt_N:-1};; - esac -} + (Darwin) + diffopt='--color=always' + lsopt='-G' + ;; + (*BSD) + ;; +esac -cache() { - isremote "$1" || return - o=$1 _d=$cacheprefix/$1; pd=${_d%/*}; ppd=${pd%/*} t=$pd/.${_d##*/} - [ -d "$ppd" ] || mkdir -p "$ppd" - [ -L "$ppd/.dv." ] || ln -s . "$ppd/.dv." - [ -f "$_d/.dv" ] && return - [ -d "$pd" ] || mkdir -p "$pd" - set -- $pd/*; shift $(($# - 1)) - [ -d "$1" ] && ropt="--link-dest=../${1##*/}" || ropt= - rsync -aDS $ropt "$o/" "$t" && mv "$t" "$_d" +# anc [-a num] [dir] - prints the current ancestor of dir or current. +anc() { + set -- "$(dvdir "$1")" + for _ in $(seq "$aopt"); do + set -- "$1/.dv/anc" + done + [ -L "$1" ] && readlink -f "$1" } -client() { - usage 'client [Version]' 'print clients' && return - getdv .dv || die no item +# clone [-nv] v1 [dir] - clones an iterm version into dir (default: item). +clone() { case $1 in - (""|.|$PWD) - while getpdir .dv .. - do - cd "$R1" - getdv ".dv" - [ "$OptM" ] && echo "$R2 -> $PWD" || echo "$R2" - ((Opt_N = Opt_N-1)) || break - done ;; - (*) info cli $1 ${Opt_N:-9999} | sort -u ;; + ('') die 'missing argument' ;; + (*[/.-]*) set -- "$(path "$1")" "$2" ;; + (*) set -- "$(head "$1")" "$2" ;; esac + [ "$2" ] || { set -- "$1" "${1##*/}"; set -- "$1" "${2%%-*}"; } + [ -d "$1" ] || die "not found: $1" + rsync ${vopt:+"$vopt"} ${nopt:+"$nopt"} -a "$1/" "$2/" + rm -f "$2/.dv/anc" && ln -s "$1" "$2/.dv/anc" } -clone() { - usage 'clone [-A Author] [-m Msg] Version [Dir]' \ - 'Copy version to dir' && return - [ "$1" ] || die missing argument - [ "$3" ] && die too many arguments - getpdir .dv . && root=$R1 && getdv $root/.dv && lib=$R1 item=${R2%/*} - new_version=${1##*/} - if [ "$new_version" = "$1" ] - then - getdv .dv && lib=$R1 new_item=${R2%/*} || die no item - else - v=${1%/$new_version} - new_item=${v##*/} - [ "$new_item" = "$v" ] || new_lib=${v%/$new_item} - fi - [ "$PWD" = "$root" ] && [ "$item" != "$new_item" ] && - die "already a clone of $item" - lib=${lib:-$new_lib} - [ "$lib" ] || die no lib - [ "$new_lib" -a "$new_lib" != "$lib" ] && die "already in lib: $lib" - if [ "$new_version" = 0 ] # Init item in lib - then - initlib "$lib" - getdvinfo "$lib" || die "could not lock $lib" - mkdir -p /tmp/dv.$$/$new_item/0 - dv_write $new_item/0 $new_item/0 >/tmp/dv.$$/$new_item/0/.dv - { cat /tmp/dv.$$/$new_item/0/.dv; echo; } >>/tmp/dv.$$/.dvinfo.0 - ln -f /tmp/dv.$$/.dvinfo.0 /tmp/dv.$$/.dvinfo.1 - rsync -a /tmp/dv.$$/ "$lib" - fi - if [ ! "$2" ] # Use the item name as default directory (a la git) - then - set -- "$1" "${1%/*}" - set -- "$1" "${2##*/}" - echo cloning into "$2" - fi - [ ! -d "$2" ] && mkdir "$2" - cd "$2" || die cannot chdir to "$2" - # Rename existing supplier directories to allow supplier symlinks - find . -name .dv | while read l - do - l=${l%/.dv} && [ "$l" = "." ] && continue - mv "$l" "$l.dvold" - done - # Sync from lib, starting from most client item, up to last supplier - d=. s=$new_item/$new_version - while [ "$d" ] - do - [ -L "$d" ] && { - rm -f "$d" - [ -d "$d.dvold" ] && mv "$d.dvold" "$d" - } - cache "$lib/$s" && pref=$cacheprefix/ || pref= - rsync -aDS "$pref$lib/$s/" "$d" - dv_header "$d" Anc "$s" - dv_header "$d" Lib "$lib" - # Find next symlink pointing to a supplier - d= l= - eval "$(find . -type l | while read -r l - do - f=$(readlink "$l") - case $f in - (*/.dv./*) echo "d=\"$l\" s=\"${f#*/.dv./}\"" - break;; - esac - done)" +# desc - prints the descendants of a version +desc() { + set -- "$(path "$1")" + set -- "$1" "${1%/*}" + set -- "$1" "${2##*/}" + for a in "$dvlib/$2"/*/.dv/anc*; do + [ "$a" -ef "$1" ] && echo "${a%/*/*}" done } -desc() { - usage 'desc [Version]' 'print descendants' && return - getdv .dv || die no item - case $1 in - (""|.|$PWD) ;; - (*) info desc $1 ;; - esac +die() { + echo "$@" >&2 + exit 1 } -die() { echo "$0: fatal: $@" >&2; exit 1; } - +# diff [-a num] [[v1] v2] - prints differences (default: current and ancestor). diff() { - usage 'diff [-x pat] [-F File] [V1 [V2]]' 'Print differences' && return - getpdir .dv && getdv "$R1/.dv" || die not in a clone - lib=$R1 item=${R2%/*} old=${R2#*/} - [ "$lib" = "" ] && [ -L "../../.dv." ] && lib=${PWD%/*/*} - if [ "$2" ] - then - case $2 in - (.) new=. new_is_clone=1 ;; - (*) new=$lib/$item/$2 ;; - esac - cache "$new" && np=$cacheprefix/ || np= - old=$lib/$item/$1 - elif [ "$1" ] - then - case $1 in - (.) new=. new_is_clone=1 ;; - (*) new=$lib/$item/$1 ;; - esac - cache "$new" && np=$cacheprefix/ || np= - getdv "$np$new/.dv" && old=${R1:-$lib}/$R2 + if [ "$2" ]; then + set -- "$(path "$2")" "$(path "$1")" + elif [ "$1" ]; then + set -- "$(path "$1")" "$(anc "$(path "$1")")" else - new=$PWD new_is_clone=1 - cache "$new" && np=$cacheprefix/ || np= - getdv "$np$new/.dv" && old=${R1:-$lib}/$R2 + set -- "$(dvdir)" "$(anc)" fi - cache "$old" && op=$cacheprefix/ || op= - [ "$Opts" ] || printf "old %s\nnew %s\n" "$old" "$new" - # Itemized diff for all suppliers, deepest first - cd "$np$new" && for f in $(find . -type f -name .dv | sort -r) - do - d=${f%/.dv} - [ "$d" = . ] && prefix= || prefix=${d#./}/ - getdv "$f" && cache "$lib/$R2" - [ "$new_is_clone" ] && dest=$np$d || dest=$prefix$d - diffdir "$op$lib/$R2" "$dest" - Optx="$Optx --exclude=${d##*/}" - done -} - -# Usage: diffdir oldpath newpath -# Print differences between 2 directories -diffdir() { - [ -f "$2/.dvignore" ] && xf=--exclude-from=$2/.dvignore || xf= - rsync -aDSniv $xf --delete --exclude=".dv.*/" $Optx "$2/" "$1" | - awk -v OptF="${OptF#./}" -v prefix=$prefix ' - NF == 0 {exit} - NR < 2 || /\/*\.dv$/ || /\/$/ {next} - # Match an itemized status for all versions of rsync -i - $1 !~ /^[<>ch.*][fdLDS+][.+?cstpoguaxz]+$/ {next} - {key = $1; file = substr($0, length(key) + 2)} - OptF && OptF != file {next} - key == "*deleting" {print "deleted " prefix file; next} - substr(key, 3, 7) == "+++++++" {print "created " prefix file; next} - { # Avoid false positive if only mtime is changed. - of = "'$1'/" file; gsub("'\''", "'\'\\\\\'\''", of) - nf = "'$2'/" file; gsub("'\''", "'\'\\\\\'\''", nf) - if (substr(key, 2, 1) == "L") { # Symlink - src = target = file - sub(/.* -> /, "", target); - sub(/ -> .*/, "", src); - "readlink '$2'/" src | getline otarget - if (target != otarget) - print "changed " src - } else if (system("cmp -s '\''" of "'\'\ \''" nf "'\''")) - print "changed " file - }' - # Or: scan key for file/link size, checksum or permission change - # rsync -c is required - #key ~ /[cps]/ { print "changed " prefix file }' + [ "$2" ] && command diff $diffopt -U 3 -x .dv "$2" "$1" | less -F } -dv_write() { - cat <<- EOT - From $(username) - Date: $(date +"%F %T %z") - Version: $1 - Anc: $2 - EOT - - [ "$OptA" ] && echo "Author: $OptA" - printf "\n%s\n" "$Optm" +# dvdir prints the dir containing .dv. +dvdir() { + set -- "$(realpath "${1:-.}")" + while [ "$1" ]; do + [ -d "$1/.dv" ] && echo "$1" && return + set -- "${1%/*}" + done } -dv_header() { - awk -v val="$3" '/^'$2':/ {print "'$2': " val; done = 1; next} - NF == 0 && done == 0 {print "'$2': " val; done = 1} - {print}' $1/.dv >$1/.dv.$$ && mv $1/.dv.$$ $1/.dv +# head - prints the branch head versions. +head() { + for v in "$dvlib/${1:-$(name)}/"*; do + [ "$(desc "$v")" ] || echo "$v" + done } -# Usage: getdv path -# Return lib in R1, anc in R2, version in R3 -getdv() { - R1= R2= - while read -r line - do +# help - prints this help text. +help() { + while read -r line; do case $line in - ("Lib: "*) R1=${line#Lib: };; - ("Anc: "*) R2=${line#Anc: };; - ("Version: "*) R3=${line#Version: };; + (\#*\ -\ *) ;; + (*) continue ;; esac - done <$1 - [ "$R1" -o "$R2" ] + set -- "${line% - *}" "${line#* - }" + [ "$1" = '#' ] || printf " %-26s" "${1#\# }" + echo "$2" + done < "$script" } -# Usage: getdvinfo lib -# Get exclusive write access to a dvlib, for new version commit -getdvinfo() { - [ -d /tmp/dv.$$ ] || mkdir /tmp/dv.$$ - [ "$Optn" ] && { rsync "$1/.dvinfo.1" /tmp/dv.$$/.dvinfo.0; return; } - t=0 - for i in 1 2 3 4 5 - do - rsync --remove-source-files "$1/.dvinfo.0" /tmp/dv.$$/ && break - t=$(($t + $i)) && sleep $t - done - test -f /tmp/dv.$$/.dvinfo.0 +# incv increments version. +incv() { + set -- "$1" "${1##*[-.a-z_A-Z]}" + set -- "${1%"$2"}" "$2" + echo "$1$(($2 + 1))" } -putdvinfo() { - [ "$Optn" ] && return - ln -f /tmp/dv.$$/.dvinfo.0 /tmp/dv.$$/.dvinfo.1 - rsync -a /tmp/dv.$$/.dvinfo.[01] "$1/" - isremote "$1" && cp /tmp/dv.$$/.dvinfo.0 "$cacheprefix/$1/" +# init - creates an initial clone in the current directory. +init() { + [ "$(dvdir)" ] && die "already initialized: $(dvdir)" + mkdir .dv } -# Usage: getpdir file [path] -# Return absolute parent dir of path or PWD containing file -getpdir() { - R1="$([ -d "${2:-.}" ] && cd "${2:-.}" && pwd)" - while [ "$R1" ] - do - [ -f "$R1/$1" ] && return || R1=${R1%/*} - done - return 1 -} +# ls [item] - lists dvlib. +ls() ( + cd "$dvlib" && command ls $lsopt "$@" +) -# Usage: getprd file [path] -# Return relative path to parent directory containing file -getprd() { - R2="$(cd "${2:-.}" && pwd)"; R2=${R2%/*} R1=.. - while [ "$R2" ] - do - [ -f "$R2/$1" ] && return || R2=${R2%/*} R1=$R1/.. - done - return 1 +# name prints the item name. +name() { + set -- "$(dvdir)" + [ "$1" ] && echo "${1##*/}" || die "not a dv item, no .dv found" } -info() { - usage info && return - case $2 in - (*:*) lib=${2%/*/*} ;; - (*) getpdir .dv && getdv $R1/.dv && lib=$R1 || die no dvlib found - esac - case $2 in # $2 specifies: - (*/*/*) v=${2%/*/*}; v=${2#$v/} ;; # lib/item/version - (*/*) v=$2 ;; # item/version - (*) v=${R2%/*}/$2 ;; # version +# path prints the version path, if exist. +path() { + case $1 in + (*/*|.) dvdir "$1"; return ;; + ([0-9]*) set -- "$(name)-$1" ;; esac - isremote "$lib" && { - p=$cacheprefix - [ -d "$p/$lib" ] || mkdir -p "$p/$lib" - [ "$Optl" ] || rsync -a "$lib/.dvinfo.1" "$p/$lib/" - } || p= - info_query $1 $v $3 <$p/$lib/.dvinfo.1 -} - -info_query() -{ - awk -v arg0=$1 -v arg1=$2 -v arg2=$3 ' - /^From / { - if (v) msg[v] = var["Body"] - delete var - var["From"] = substr($0, 6) - header = 1 - next - } - header == 1 && NF == 0 { - v = var["Version"]; a = var["Anc"]; s = var["Sup"] - if (a != v) { - anc[v] = a; desc[a] = desc[a] ? desc[a] " " v : v - } - n = split(s, as) - for (i = 1; i <= n; i++) { - cli[as[i]] = cli[as[i]] ? cli[as[i]] " " v : v - } - sup[v] = s; msg[v] = var["Msg"]; date[v] = var["Date"] - if (var["Root"]) root[v] = var["Root"] - header = 0 - next - } - header == 1 { - i = index($0, ":") - var[substr($0, 1, i-1)] = substr($0, i+2) - next - } - header == 0 { - if ($0 ~ />+From /) sub(/>/, "") - var["Body"] = var["Body"] ? var["Body"] "\n" $0 : $0 - } - END { - if (v) msg[v] = var["Body"] - if (arg0 == "graph") anc_graph() - else if (arg0 == "anc") query_anc(arg1, arg2) - else if (arg0 == "sup") query_sup(arg1, arg2) - else if (arg0 == "cli") query_cli(arg1, arg2) - else if (arg0 == "log") print msg[arg1] - else if (arg0 == "from") print from[arg1] - else if (arg0 == "date") print date[arg1] - else if (arg0 == "desc") printl(desc[arg1]) - } - function anc_graph() { - print "digraph G {" - for (v in anc) print "\"" anc[v] "\" -> \"" v "\"" - print "}" - } - function query_anc(v, n) { while (n-- > 0) v = anc[v]; print v } - function query_cli(v, n) { - while (n-- > 0 && v != "") { - num = split(v, av); v = "" - for (i = 1; i <= num; i++) { - printl(cli[av[i]]) - v = v ? v " " cli[av[i]] : cli[av[i]] - } - } - } - function query_sup(v, n) { - while (n-- > 0 && v != "") { - num = split(v, av); v = "" - for (i = 1; i <= num; i++) { - printl(sup[av[i]]) - v = v ? v " " sup[av[i]] : sup[av[i]] - } - } - } - function printl(l, i, n) { - n = split(l, al) - for (i = 1; i <= n; i++) - if (root[al[i]]) - print al[i] " -> '"$PWD/"'" root[al[i]] - else - print al[i] - }' + set -- "${1%%-*}" "${1#*-}" + [ -d "$dvlib/$1/$1-$2" ] && echo "$dvlib/$1/$1-$2" } -initlib() { - rsync --list-only "$1/.dv." >/dev/null 2>&1 && return - mkdir -p /tmp/dv.$$ - ln -s . /tmp/dv.$$/.dv. - >/tmp/dv.$$/.dvinfo.0 - >/tmp/dv.$$/.dvinfo.1 - chmod g+w /tmp/dv.$$/.dvinfo.[01] - rsync -a /tmp/dv.$$/ "$1" -} +# save [-nv] [v1] - creates a new version from clone. +save() { + [ "$1" ] && case $1 in (*[0-9]) ;; (*) die "invalid version: $1" ;; esac + set -- "$(dvdir)" "$(aopt=1 anc)" "$(name)" "${1#[a-zA-Z_]*-}" + set -- "$1" "$2" "$3" "${4:-$(incv "${2##*/[a-zA-Z_]*-}")}" + echo "$dvlib/$3/$3-$4" + command diff -q -x .dv "$2" "$1" >/dev/null 2>&1 && die 'no changes, abort' + [ "$nopt" ] && return -isremote() { case $1 in (*:*) return;; esac; return 1; } + # Update ancestor in clone then copy in dvlib. + rm -f "$1/.dv/anc" && [ "$2" ] && ln -s "../../${2##*/}" "$1/.dv/anc" + rsync ${vopt:+"$vopt"} -a ${2:+--link-dest="$2"} --mkpath "$1/" "$dvlib/$3/$3-$4/" -help_all() { - printf "$dv_version\nUsage: dv command [options] [args]\n" - Opth=1; for c in $Cmdlist; do $c; done + # After save, clone ancestor points to new saved version. + rm -f "$1/.dv/anc" && ln -s "$dvlib/$3/$3-$4" "$1/.dv/anc" } -newversion() { - [ "$OptV" ] && R1=$OptV && return - case $OptB in - ('') R1=$1 ;; - (*[-/]*) die 'illegal character [-/] in branch name' ;; - (*[0-9.]) die 'illegal end character [0-9.] in branch name' ;; - (*) case $1 in (*-${OptB}[1-9]*) R1=$1;; (*) R1=$1-${OptB}0;; esac ;; - esac - R2=${R1##*[!0-9]} - optb=$Optb - [ "$optb" ] && R3=.1 optb=${optb%b} || R3= R1=${R1%$R2}$(($R2 + 1)) - while [ "${optb}" ]; do optb=${optb%b} R3=.0$R3; done - R1=$R1$R3 - while grep -q "^Version: $item/$R1\$" /tmp/dv.$$/.dvinfo.0 - do - R2=${R1##*[!0-9]} - [ "$R2" ] && R1=${R1%$R2}$(($R2 - 1)).1 || R1=${R1}1 - done +# status - prints dv informations. +status() { + echo "lib: $dvlib" + set -- "$(dvdir)" "$(anc)" + [ "$1" ] || die "not a dv item, no .dv found" + echo "root: $1" + [ "$2" ] || die "no ancestor found, please save it first" + echo "anc: $2" + command diff -q -x .dv "$2" "$1" } -patch() { - usage 'patch [-x pat] [-F File] [Dir|Version]' \ - 'Print patch diff from ancestor' && return - diff "$@" | awk -v wdflag="-v${OptD:+3}${OptN:+1}${OptO:+2}" ' - { key = $1; file = substr($0, length(key) + 2) } - key == "old" { old = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next } - key == "new" { new = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next } - { - of = old "/" file; gsub("'\''", "'\'\\\\\'\''", of) - nf = new "/" file; gsub("'\''", "'\'\\\\\'\''", nf) - system("diff -Naup '\''" of "'\'\ \''" nf "'\''; echo") - }' +# sync [url] - synchronize a remote dvlib. +sync() { + set -- "${1:-$(cat "$dvlib/.url" 2>/dev/null)}" + [ "$1" ] || die "missing url" + [ "$(cat "$dvlib/.url" 2>/dev/null)" = "$1" ] || echo "$1" > "$dvlib/.url" + rsync ${vopt:+"$vopt"} ${nopt:+"$nopt"} -aH --mkpath "$1/" "$dvlib/" + rsync ${vopt:+"$vopt"} ${nopt:+"$nopt"} -aH --mkpath "$dvlib/" "$1/" } -save() { - usage 'save [-bln] [-A Author] [-m msg] [-x pat] [-B Branch|-V Version] [Dir]'\ - 'Save dir into a new version' && return - [ "$2" ] && die 'too many arguments' - getpdir .dv "$1" || die "not in a clone: ${1:-$PWD}" && root=$R1 - cd "$root" - getdv .dv && lib=$R1 && getdvinfo "$lib" - # Process supplier subdirs from the deepest up to "." (most client) - for d in $(find . -type f -name .dv | sort -r) - do - d=${d%/.dv} - cd "$root/$d" - OptF= save1 "$d" && nanc=$R1 && echo $nanc - [ "$d" = . ] && continue # not a supplier, done - - # Replace supplier subdir by symlink in lib - getprd .dv && s=$R1/../.dv./$nanc - t=${d##*/}; t=.dv.$t - mv "$root/$d" "$root/${d%/*}/$t" - ln -s "$s" "$root/$d" - done - putdvinfo "$lib" - # Restore supplier subdirs and remove links to lib, deepest first - find . -type d -name ".dv.*" | sort -r | while read d - do - t=${d##*/.dv.}; t=${d%/*}/$t - rm -f "$t" && mv "$d" "$t" - done +# version - prints the current version of dv. +version() { + echo "$version" } -save1() { - getdv .dv && lib=$R1 anc=$R2 && item=${anc%/*} old=${anc#*/} - [ "$(diffdir "$lib/$anc" .)" ] || { R1=$anc; return; } - newversion $old && new=$item/$R1 - [ "$Optn" ] || dv_write "$new" "$anc" >.dv - # Compute list of direct suppliers, for caching in .dvinfo.0 - lsup=$(find . -type l | while read -r l - do - case $l in (*/.dv.*) continue ;; esac - f=$(readlink "$l") - case $f in (*/.dv./*) printf "%s " ${f#*/.dv./} ;; esac - done) - [ ! "$Optn" ] && [ "$lsup" ] && dv_header . Sup "$lsup" - { cat .dv; echo; } >>/tmp/dv.$$/.dvinfo.0 - [ -f ".dvignore" ] && xf=--exclude-from=.dvignore || xf= - rsync -aDS$Optn$Optv --link-dest=../$old $xf --exclude=".dv.*/" \ - ./ "$lib/$new" - R1=$new - [ "$Optn" ] && return - isremote "$lib" && rsync -aDS --link-dest=../$old --exclude=".dv.*/" \ - ./ "$cacheprefix/$lib/$new" - dv_header . Anc "$new" - dv_header . Lib "$lib" -} - -supplier() { - usage 'supplier [Version]' 'print suppliers' && return - getdv .dv || die no item +# Main program starts here. +[ "$DVDEBUG" ] && set -x || case $1 in - (""|.|$PWD) # create a temporary dvinfo file, query it - V=$R2; find . -name .dv | - while read dv - do - [ "$dv" = "./.dv" ] && continue - # get the supplier - getdv "$dv"; v=$R2; dv=${dv%/.dv} - # get the client - getpdir .dv "${dv%/*}"; getdv "$R1/.dv" - # declare the client as supplier - printf "From \nVersion: %s\nSup: %s\n" "$v" "$R2" - [ "$OptM" ] && echo "Root: ${dv#./}"; echo - done | info_query cli $V ${Opt_N:-9999} ;; - (*) info sup $1 ${Opt_N:-9999} ;; - esac | sort -u -} - -usage() { [ "$Opth" ] && printf " %-34s %s\n" "$1" "$2"; } - -username() { - case $(uname -s) in - (Darwin) id -P | awk -v FS=: '{print $8}' ;; - (*) awk -v FS=[:,] '/^'$USER':/ {print $5; exit}' /etc/passwd ;; + (anc|clone|desc|diff|head|help|init|ls|path|save|status|sync|version) ;; + (*) help; exit 1;; esac -} - -wdiff() { - usage 'wdiff [-DNO] [-x pat] [-F File] [Dir|Version]' \ - 'Print word diffs from ancestor' && return - diff "$@" | - awk -v wdflag="-v${OptD:+3}${OptN:+1}${OptO:+2}" ' - { key = $1; file = substr($0, length(key) + 2) } - key == "old" { old = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next } - key == "new" { new = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next } - { - of = old "/" file; gsub("'\''", "'\'\\\\\'\''", of) - nf = new "/" file; gsub("'\''", "'\'\\\\\'\''", nf) - system("wd " wdflag " '\''" of "'\'\ \''" nf "'\''; echo") - }' | less -FCimnqGrX -j5 -h0 +/'\[0' -} - -cacheprefix=$HOME/.cache/dv -Cmdlist='anc client clone desc diff info patch save supplier wdiff' -while getopts :nvV opt # Parse global options -do +cmd="$1" +shift +while getopts :a:nv opt; do case $opt in - (V) echo "$dv_version"; exit ;; - (*) help_all; exit ;; + (a) aopt="$OPTARG" ;; + (n) nopt=-n ;; + (v) vopt=-v ;; + (*) help; exit ;; esac done shift $((OPTIND - 1)) -[ $1 ] && C=$1 && shift 1 || { help_all; exit 1; } -for c in $Cmdlist -do - case $c in - ($C|_$C) cmd=$c; break;; - ($C*) [ $cmd ] && die ambiguous command $C || cmd=$c;; - esac -done -while getopts :0123456789A:bB:F:hl:m:MnNOsvV:x: opt # Parse command options -do - case $opt in - ([0-9]) Opt_N=$Opt_N$opt;; - ([bhlnMNOsv]) eval Opt$opt=\${Opt$opt}$opt ;; - ([ABFmV]) eval Opt$opt=\$OPTARG ;; - (x) Optx="$Optx --exclude=$OPTARG" ;; - (*) Opth=1; $cmd; exit 1;; - esac -done -shift $(($OPTIND - 1)) -trap "rm -rf /tmp/dv.$$" EXIT -[ "$cmd" ] || die "no command \"$C\"" && $cmd "$@" +$cmd "$@" + +# Todo: +# * a function to squash a branch in the trunk +# * merge another ancestor (use anc0, anc1, ...) +# * vendor management +# * show graphs (dot) +# * sync: dvlib sync / mirror: resolve conflict by branching +# * rename version. +# * .dvignore +# * make dvlib versions immutable. diff --git a/swift/etc/smtpd/smtpd.conf b/swift/etc/smtpd/smtpd.conf new file mode 100644 index 0000000..ac4dabf --- /dev/null +++ b/swift/etc/smtpd/smtpd.conf @@ -0,0 +1,20 @@ +# $OpenBSD: smtpd.conf,v 1.10 2018/05/24 11:40:17 gilles Exp $ + +# This is the smtpd server system-wide configuration file. +# See smtpd.conf(5) for more information. + +table aliases file:/etc/smtpd/aliases +table secrets file:/etc/smtpd/secrets + +# To accept external mail, replace with: listen on all +# +listen on localhost + +action "local" maildir alias +action "relay" relay host smtps://mvertes@smtp.free.fr auth + +# Uncomment the following to accept external mail for domain "example.org" +# +# match from any for domain "example.org" action "local" +match for local action "local" +match for any action "relay" -- cgit v1.2.3 From 6bfaa0bd5de54bd8c9225832a83a6d606a84bbb5 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 14 Feb 2023 22:51:50 +0100 Subject: update --- .Xresources | 1 + .config/i3/config | 2 +- .fvwm2rc | 22 ++++++++++++---------- .xsession | 4 ++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.Xresources b/.Xresources index 274ee87..4ca3ee9 100644 --- a/.Xresources +++ b/.Xresources @@ -24,6 +24,7 @@ URxvt.keysym.C-Next: font-size:decrease xterm*termName: xterm-256color xterm*internalBorder: 4 xterm*VT100.Translations: #override \ + F11: fullscreen(toggle) \n\ Ctrl Next: smaller-vt-font() \n\ Ctrl Prior: larger-vt-font() \n ! Meta minus: smaller-vt-font() \n\ diff --git a/.config/i3/config b/.config/i3/config index 6c871ae..0c7c3d3 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -95,7 +95,7 @@ for_window [class="io.elementary.music"] floating enable for_window [class="org.gnome.Music"] floating enable for_window [class="Org.gnome.Software"] floating enable for_window [class="Pavucontrol"] floating enable -for_window [class="Pcmanfm"] floating enable +for_window [class="pcmanfm-qt"] floating enable for_window [class="Picard"] floating enable for_window [title="QEMU"] floating enable for_window [class="Quodlibet"] floating enable diff --git a/.fvwm2rc b/.fvwm2rc index 1159092..84a402c 100644 --- a/.fvwm2rc +++ b/.fvwm2rc @@ -94,7 +94,7 @@ AddToMenu "Module-Popup" DestroyMenu "Desktop-Apps" AddToMenu "Desktop-Apps" -+ "&Brave" Exec exec brave +#+ "&Brave" Exec exec brave + "&Chromium" Exec exec chromium + "&Discord" Exec exec discord + "&Firefox" Exec exec firefox @@ -108,15 +108,17 @@ AddToMenu "Desktop-Apps" DestroyMenu "Settings" AddToMenu "Settings" + "&Display" Exec exec arandr -+ "&Keyboard" Exec exec setxkbmap fr -+ "&Power" Exec exec sudo xt -e powertop +#+ "&Keyboard" Exec exec setxkbmap fr ++ "&Power" Exec exec xt -e sudo powertop + "&Sound" Exec exec pavucontrol -+ "&Wifi" Exec exec sudo wpa_gui -i wlo1 ++ "&Wifi" Exec exec wpa_gui -i wlan0 DestroyMenu "Multimedia" AddToMenu "Multimedia" ++ "&Asunder" Exec exec asunder + "&Geeqie" Exec exec geeqie -+ "&Molotov" Exec exec molotov +#+ "&Molotov" Exec exec molotov + "&Quodlibet" Exec exec quodlibet + "&Spotify" Exec exec spotify + "&Vlc" Exec exec vlc @@ -126,14 +128,14 @@ AddToMenu "Utilities" #+ "&Top" Exec exec uxterm -T Top -n Top -e top #+ "&Xterm" Exec exec urxvtc +sb -sl 500 -j -ls -cr red + "&Xterm" Exec exec xt -+ "&Black Xterm" Exec exec bxt ++ "&Black Xterm" Exec exec xtb ++ "File manager" Exec exec pcmanfm-qt + "&Top" Exec exec xt -T Top -n Top -e /bin/top #+ "&Web" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache #+ "&Web" Exec exec brave -+ "&Web" Exec exec firefox -#+ "&Firefox" Exec exec firefox -#+ "&Chromium" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache -+ "&Mail" Exec exec thunderbird ++ "&Firefox" Exec exec firefox ++ "&Chromium" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache ++ "T&hunderbird" Exec exec thunderbird #+ "xclipboard" Exec exec xclipboard #+ "" Nop + "" Nop diff --git a/.xsession b/.xsession index 08383ba..804c3cd 100755 --- a/.xsession +++ b/.xsession @@ -24,6 +24,6 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -#exec fvwm -exec i3 +exec fvwm +#exec i3 #exec cwm -- cgit v1.2.3 From 5ce6dc90f8a078cfa46bdbba630ba07f0a167de6 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 14 Feb 2023 23:57:52 +0100 Subject: update --- .fvwm2rc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.fvwm2rc b/.fvwm2rc index 84a402c..d9e203c 100644 --- a/.fvwm2rc +++ b/.fvwm2rc @@ -98,8 +98,10 @@ AddToMenu "Desktop-Apps" + "&Chromium" Exec exec chromium + "&Discord" Exec exec discord + "&Firefox" Exec exec firefox -+ "&LibreOffice" Exec exec libreoffice ++ "&Google Chrome" Exec exec google-chrome-stable + "&Keybase" Exec exec keybase-gui ++ "&LibreOffice" Exec exec libreoffice ++ "&RSS Guard" Exec exec rssguard + "S&ignal" Exec exec signal-desktop + "&Slack" Exec exec slack + "Sea&Monkey" Exec exec seamonkey -- cgit v1.2.3 From abe00380ff8b708b890371c73116e1006ea05178 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 11 Mar 2023 16:11:37 +0100 Subject: update --- .bashrc | 8 ++++---- .config/i3/config | 2 +- .i3status.conf | 9 ++++++++- .xsession | 6 +++--- bin/lt | 1 + 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.bashrc b/.bashrc index 739bdb2..23a8084 100644 --- a/.bashrc +++ b/.bashrc @@ -148,7 +148,7 @@ meteo() { eval "$(direnv hook bash)" #export GITHUB_TOKEN=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 -set -o vi -bind -m vi-command ".":insert-last-argument -bind -m vi-command 'Control-l: clear-screen' -bind -m vi-insert 'Control-l: clear-screen' +#set -o vi +#bind -m vi-command ".":insert-last-argument +#bind -m vi-command 'Control-l: clear-screen' +#bind -m vi-insert 'Control-l: clear-screen' diff --git a/.config/i3/config b/.config/i3/config index 0c7c3d3..d898633 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -44,7 +44,7 @@ bindsym $mod+twosuperior exec --no-startup-id dunstctl history-pop # pulse audio systray icon -exec --no-startup-id pasystray +# exec --no-startup-id pasystray # Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status diff --git a/.i3status.conf b/.i3status.conf index 6cc7210..31c0a8d 100644 --- a/.i3status.conf +++ b/.i3status.conf @@ -22,6 +22,7 @@ order += "disk /" order += "cpu_usage" #order += "load" order += "memory" +order += "volume master" order += "cpu_temperature 0" order += "tztime local" @@ -33,7 +34,7 @@ read_file hostname { wireless _first_ { #format_up = "🌐 %essid %quality" #format_up = "📶 %essid %quality" - format_up = "📡 %essid %quality" + format_up = "📡 %essid %signal %bitrate" format_down = "📡 down" } @@ -104,3 +105,9 @@ tztime local { format = "%a %d %b %H:%M:%S" #format = "📅 %a %d %b ⌚ %H:%M:%S" } + +volume master { + format = "🎜 %volume" + format_muted = "🎜 mute (%volume)" + device = "pulse:alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink" +} diff --git a/.xsession b/.xsession index 804c3cd..f4d42ec 100755 --- a/.xsession +++ b/.xsession @@ -10,7 +10,7 @@ eval $(ssh-agent) 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 +# Better use /etc/X11/xorg.conf.d/10-keyboard.conf for hot plugged keyboards #setxkbmap fr #xk hdmi @@ -24,6 +24,6 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -exec fvwm -#exec i3 +#exec fvwm +exec i3 #exec cwm diff --git a/bin/lt b/bin/lt index f09f3b7..2a182f7 100755 --- a/bin/lt +++ b/bin/lt @@ -36,6 +36,7 @@ ca() { pp() { pp_s=$1 pp_b=$2 R1='' while true; do + ! [ "$pp_s" ] && R1='' && return [ "$pp_b" = "$pp_s" ] && break pp_s=${pp_s%/*} [ "$R1" ] && R1=$R1/.. || R1=.. -- cgit v1.2.3 From c6a598df705fd3dcc1d3e8ef0c6d42a68e647dc3 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 23 Mar 2023 22:36:12 +0100 Subject: update --- .Xresources | 4 +++- .profile | 2 +- .xsession | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.Xresources b/.Xresources index 4ca3ee9..3745cc9 100644 --- a/.Xresources +++ b/.Xresources @@ -26,7 +26,9 @@ xterm*internalBorder: 4 xterm*VT100.Translations: #override \ F11: fullscreen(toggle) \n\ Ctrl Next: smaller-vt-font() \n\ - Ctrl Prior: larger-vt-font() \n + Ctrl Prior: larger-vt-font() \n\ + Shift Ctrl C: copy-selection(CLIPBOARD) \n\ + Shift Ctrl V: insert-selection(CLIPBOARD) \n ! Meta minus: smaller-vt-font() \n\ ! Meta equal: larger-vt-font() \n xterm*cursorColor: red diff --git a/.profile b/.profile index 4de3901..90091ca 100644 --- a/.profile +++ b/.profile @@ -1,6 +1,6 @@ # ~/.profile -PATH=~/bin:$PATH:~/go/bin +PATH=~/bin:~/mu/bin:$PATH:~/go/bin [ "${SHELL##*/}" = bash ] && . ~/.bashrc diff --git a/.xsession b/.xsession index f4d42ec..005713f 100755 --- a/.xsession +++ b/.xsession @@ -24,6 +24,6 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -#exec fvwm -exec i3 +exec fvwm +#exec i3 #exec cwm -- cgit v1.2.3 From b04d54fc52df277b189c2d794241c49c2ab61fb4 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sat, 14 Oct 2023 14:24:47 +0200 Subject: update --- .config/sway/config | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++ .fvwm2rc | 7 ++- .xsession | 4 +- bin/idot | 4 -- bin/status2 | 27 +++++++++ 5 files changed, 197 insertions(+), 9 deletions(-) create mode 100644 .config/sway/config delete mode 100755 bin/idot create mode 100755 bin/status2 diff --git a/.config/sway/config b/.config/sway/config new file mode 100644 index 0000000..561f443 --- /dev/null +++ b/.config/sway/config @@ -0,0 +1,164 @@ +# xwayland disable + +input * { + xkb_layout "fr" +} + +input xkb_model "pc101" + +bar { + status_command i3status +} + +output * bg #103040 solid_color + +# output eDP-1 scale 1.25 + +input "1739:52544:SYNA7DAB:00_06CB:CD40_Touchpad" { + tap enabled + natural_scroll enabled +} + +font Monospace 9 + +set $mod Mod4 + +bindsym $mod+q kill +bindsym $mod+Return exec --no-startup-id foot +#bindsym $mod+d exec --no-startup-id bemenu-run +bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="bemenu -i -fn 'Mono-12'" + +for_window [app_id="google-chrome"] floating enable +for_window [class="firefox"] floating enable +for_window [class="thunderbird"] floating enable + +# change focus +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+m focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+m move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+z layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +#bindsym $mod+q focus parent + +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+ampersand workspace number $ws1 +bindsym $mod+eacute workspace number $ws2 +bindsym $mod+quotedbl workspace number $ws3 +bindsym $mod+apostrophe workspace number $ws4 +bindsym $mod+parenleft workspace number $ws5 +bindsym $mod+minus workspace number $ws6 +bindsym $mod+egrave workspace number $ws7 +bindsym $mod+underscore workspace number $ws8 +bindsym $mod+ccedilla workspace number $ws9 +bindsym $mod+agrave workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+ampersand move container to workspace number $ws1 +bindsym $mod+Shift+eacute move container to workspace number $ws2 +bindsym $mod+Shift+quotedbl move container to workspace number $ws3 +bindsym $mod+Shift+apostrophe move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+minus move container to workspace number $ws6 +bindsym $mod+Shift+egrave move container to workspace number $ws7 +bindsym $mod+Shift+underscore move container to workspace number $ws8 +bindsym $mod+Shift+ccedilla move container to workspace number $ws9 +bindsym $mod+Shift+agrave move container to workspace number $ws10 + +# Cycle through active workspaces +bindsym $mod+Tab workspace next +bindsym $mod+Shift+Tab workspace prev + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +# bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" +bindsym $mod+Ctrl+backspace exec killall sway + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym m resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Move a workspace to a different monitor +bindsym $mod+greater move workspace to output right +bindsym $mod+less move workspace to output left + diff --git a/.fvwm2rc b/.fvwm2rc index d9e203c..e3aea63 100644 --- a/.fvwm2rc +++ b/.fvwm2rc @@ -42,8 +42,9 @@ Style "gkrellm" NoTitle, Sticky, WindowListSkip, CirculateSkip # AddToFunc "StartFunction" -+ "I" Module FvwmPager 0 0 -+ "I" Exec dunst ++ I Module FvwmPager 0 0 ++ I Exec status2 ++ I Exec dunst #+ "I" Exec xsetroot -solid rgb:3/4/5 #+ "I" Exec setxkbmap fr #+ "I" Exec synclient VertScrollDelta=-114 @@ -327,7 +328,7 @@ Key Escape A C WindowList *FvwmPagerFont fixed *FvwmPagerHilight #c3c3c3 *FvwmPagerGeometry 80x60-1-1 -*FvwmPagerLabel 0 "swift" +*FvwmPagerLabel 0 "arch" *FvwmPagerSmallFont 5x8 #------------------ Identify diff --git a/.xsession b/.xsession index 005713f..f4d42ec 100755 --- a/.xsession +++ b/.xsession @@ -24,6 +24,6 @@ xsetroot -solid rgb:1/3/4 #slock # Start window manager -exec fvwm -#exec i3 +#exec fvwm +exec i3 #exec cwm diff --git a/bin/idot b/bin/idot deleted file mode 100755 index 44387e8..0000000 --- a/bin/idot +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# dot -Gsize=9 -Nshape=box -Nstyle=rounded -Tsvg | convert -- - sixel:/dev/tty -# dot -Gsize=9 -Nfontname=Helvetica -Tsvg | convert -- - sixel:/-dev/tty -dot -Gsize=9 -Nfontname=Arial -Tpng | icat - /dev/tty diff --git a/bin/status2 b/bin/status2 new file mode 100755 index 0000000..1b7ea55 --- /dev/null +++ b/bin/status2 @@ -0,0 +1,27 @@ +#!/bin/sh + +ip() { + while read -r w1 w2 w3; do + [ $w1 = /32 ] && [ $w2 = host ] && [ $ip != 127.0.0.1 ] && break + ip=$w2 + done < /proc/net/fib_trie +} + +power() { + while read -r line; do + case $line in POWER_SUPPLY_CAPACITY*) power=${line#*=}% && break;; esac + done < /sys/class/power_supply/BAT0/uevent +} + +status() { + power + ip + sound="$(pamixer --get-volume-human)" + clock="$(date +'%a %d %b %H:%M')" +} + +while true; do + status && echo "$ip , power $power , sound $sound , $clock" + sleep 17 +done | +root-tail -g '500x20-80-0' -fn '-*-fixed-medium-*-*-*-15-*-*-*-*-*-*-*' --color grey70 - -- cgit v1.2.3 From 5c1c6ba70c7f8e251e1ab8fd72105e7749fb8a69 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 16 May 2024 12:32:27 +0200 Subject: update --- .config/foot/foot.ini | 11 +++++++++++ .config/sway/config | 3 ++- .profile | 6 +++--- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .config/foot/foot.ini diff --git a/.config/foot/foot.ini b/.config/foot/foot.ini new file mode 100644 index 0000000..6dfa4f5 --- /dev/null +++ b/.config/foot/foot.ini @@ -0,0 +1,11 @@ +[main] +#font=Mono:size=9 +font=MiscFixed:pixelsize=14 +pad=2x0 center + +[cursor] +color=ffffff ff0000 + +[colors] +background=ffffff +foreground=000000 diff --git a/.config/sway/config b/.config/sway/config index 561f443..d41c208 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -25,8 +25,9 @@ set $mod Mod4 bindsym $mod+q kill bindsym $mod+Return exec --no-startup-id foot +#bindsym $mod+Return exec --no-startup-id xt #bindsym $mod+d exec --no-startup-id bemenu-run -bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="bemenu -i -fn 'Mono-12'" +bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="bemenu -i -fn 'Mono-12' --hf '#00ff00' --tf '#00ff00'" for_window [app_id="google-chrome"] floating enable for_window [class="firefox"] floating enable diff --git a/.profile b/.profile index 90091ca..3b15a21 100644 --- a/.profile +++ b/.profile @@ -5,8 +5,8 @@ PATH=~/bin:~/mu/bin:$PATH:~/go/bin [ "${SHELL##*/}" = bash ] && . ~/.bashrc # Last action: auto start X11 when logged on first console -#case $HOSTNAME in -#([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startx ;; -#esac +# case $HOSTNAME in +# ([sS]wift|yoda) [ "$(tty)" != /dev/tty1 ] || exec startxfce4 ;; +# esac tabs -4 -- cgit v1.2.3 From 6a2ac34349f0a91fcdc0f0d7ae5b62e912ea7c4d Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 16 May 2024 23:30:07 +0200 Subject: update --- .config/foot/foot.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/foot/foot.ini b/.config/foot/foot.ini index 6dfa4f5..f9451a1 100644 --- a/.config/foot/foot.ini +++ b/.config/foot/foot.ini @@ -1,6 +1,7 @@ [main] #font=Mono:size=9 -font=MiscFixed:pixelsize=14 +#font=MiscFixed:pixelsize=14 +font=Misc MiscFixed:pixelsize=13 pad=2x0 center [cursor] -- cgit v1.2.3 From 016f1100df9df22ad29a08b21b1df7067008db5b Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 13 Jun 2024 09:31:31 +0200 Subject: update aerc --- .config/aerc/aerc.conf | 751 ++++++++++++++++++++++++++++++++++++++++++++++ .config/aerc/binds.conf | 177 +++++++++++ .config/aerc/stylesets/mv | 5 + .config/sway/config | 4 +- 4 files changed, 936 insertions(+), 1 deletion(-) create mode 100644 .config/aerc/aerc.conf create mode 100644 .config/aerc/binds.conf create mode 100644 .config/aerc/stylesets/mv diff --git a/.config/aerc/aerc.conf b/.config/aerc/aerc.conf new file mode 100644 index 0000000..fb471fc --- /dev/null +++ b/.config/aerc/aerc.conf @@ -0,0 +1,751 @@ +# +# aerc main configuration + +[general] +# +# Used as a default path for save operations if no other path is specified. +# ~ is expanded to the current user home dir. +# +#default-save-path= + +# If set to "gpg", aerc will use system gpg binary and keystore for all crypto +# operations. If set to "internal", the internal openpgp keyring will be used. +# If set to "auto", the system gpg will be preferred unless the internal +# keyring already exists, in which case the latter will be used. +# +# Default: auto +#pgp-provider=auto + +# By default, the file permissions of accounts.conf must be restrictive and +# only allow reading by the file owner (0600). Set this option to true to +# ignore this permission check. Use this with care as it may expose your +# credentials. +# +# Default: false +#unsafe-accounts-conf=false + +# Output log messages to specified file. A path starting with ~/ is expanded to +# the user home dir. When redirecting aerc's output to a file using > shell +# redirection, this setting is ignored and log messages are printed to stdout. +# +#log-file= + +# Only log messages above the specified level to log-file. Supported levels +# are: trace, debug, info, warn and error. When redirecting aerc's output to +# a file using > shell redirection, this setting is ignored and the log level +# is forced to trace. +# +# Default: info +#log-level=info + +# Set the $TERM environment variable used for the embedded terminal. +# +# Default: xterm-256color +#term=xterm-256color + +# Display OSC8 strings in the embedded terminal +# +# Default: false +#enable-osc8=false + +# Default shell command to use for :menu. This will be executed with sh -c and +# will run in an popover dialog. +# +# Any occurrence of %f will be replaced by a temporary file path where the +# command is expected to write output lines to be consumed by :menu. Otherwise, +# the lines will be read from the command's standard output. +# +# Examples: +# default-menu-cmd=fzf +# default-menu-cmd=fzf --multi +# default-menu-cmd=dmenu -l 20 +# default-menu-cmd=ranger --choosefiles=%f +# +#default-menu-cmd= + +[ui] +# +# Describes the format for each row in a mailbox view. This is a comma +# separated list of column names with an optional align and width suffix. After +# the column name, one of the '<' (left), ':' (center) or '>' (right) alignment +# characters can be added (by default, left) followed by an optional width +# specifier. The width is either an integer representing a fixed number of +# characters, or a percentage between 1% and 99% representing a fraction of the +# terminal width. It can also be one of the '*' (auto) or '=' (fit) special +# width specifiers. Auto width columns will be equally attributed the remaining +# terminal width. Fit width columns take the width of their contents. If no +# width specifier is set, '*' is used by default. +# +# Default: date<20,name<17,flags>4,subject<* +#index-columns=date<20,name<17,flags>4,subject<* + +# +# Each name in index-columns must have a corresponding column-$name setting. +# All column-$name settings accept golang text/template syntax. See +# aerc-templates(7) for available template attributes and functions. +# +# Here are some examples to show the To field instead of the From field for +# an email (modifying column-name): +# +# 1. a generic one +# column-name={{ .Peer | names | join ", " }} +# 2. based upon the selected folder +# column-name={{if match .Folder "^(Gesendet|Sent)$"}}{{index (.To | names) 0}}{{else}}{{index (.From | names) 0}}{{end}} +# +# Default settings +#column-date={{.DateAutoFormat .Date.Local}} +#column-name={{index (.From | names) 0}} +#column-flags={{.Flags | join ""}} +#column-subject={{.ThreadPrefix}}{{if .ThreadFolded}}{{printf "{%d}" .ThreadCount}}{{end}}{{.Subject}} + +# +# String separator inserted between columns. When the column width specifier is +# an exact number of characters, the separator is added to it (i.e. the exact +# width will be fully available for the column contents). +# +# Default: " " +#column-separator=" " + +# +# See time.Time#Format at https://godoc.org/time#Time.Format +# +# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time) +#timestamp-format=2006-01-02 03:04 PM +timestamp-format=2006-01-02 15:04 + +# +# Index-only time format for messages that were received/sent today. +# If this is not specified, timestamp-format is used instead. +# +#this-day-time-format= + +# +# Index-only time format for messages that were received/sent within the last +# 7 days. If this is not specified, timestamp-format is used instead. +# +#this-week-time-format= + +# +# Index-only time format for messages that were received/sent this year. +# If this is not specified, timestamp-format is used instead. +# +#this-year-time-format= + +# +# Width of the sidebar, including the border. +# +# Default: 20 +#sidebar-width=20 + +# +# Message to display when viewing an empty folder. +# +# Default: (no messages) +#empty-message=(no messages) + +# Message to display when no folders exists or are all filtered +# +# Default: (no folders) +#empty-dirlist=(no folders) +# +# Value to set {{.Subject}} template to when subject is empty. +# +# Default: (no subject) +#empty-subject=(no subject) + +# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel +# +# Default: false +mouse-enabled=true + +# +# Ring the bell when new messages are received +# +# Default: true +#new-message-bell=true + +# +# Template to use for Account tab titles +# +# Default: {{.Account}} +#tab-title-account={{.Account}} + +# Marker to show before a pinned tab's name. +# +# Default: ` +#pinned-tab-marker='`' + +# Template for the left side of the directory list. +# See aerc-templates(7) for all available fields and functions. +# +# Default: {{.Folder}} +#dirlist-left={{.Folder}} + +# Template for the right side of the directory list. +# See aerc-templates(7) for all available fields and functions. +# +# Default: {{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}} +#dirlist-right={{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}} + +# Delay after which the messages are actually listed when entering a directory. +# This avoids loading messages when skipping over folders and makes the UI more +# responsive. If you do not want that, set it to 0s. +# +# Default: 200ms +#dirlist-delay=200ms + +# Display the directory list as a foldable tree that allows to collapse and +# expand the folders. +# +# Default: false +#dirlist-tree=false + +# If dirlist-tree is enabled, set level at which folders are collapsed by +# default. Set to 0 to disable. +# +# Default: 0 +#dirlist-collapse=0 + +# List of space-separated criteria to sort the messages by, see *sort* +# command in *aerc*(1) for reference. Prefixing a criterion with "-r " +# reverses that criterion. +# +# Example: "from -r date" +# +#sort= + +# Moves to next message when the current message is deleted +# +# Default: true +#next-message-on-delete=true + +# Automatically set the "seen" flag when a message is opened in the message +# viewer. +# +# Default: true +#auto-mark-read=true + +# The directories where the stylesets are stored. It takes a colon-separated +# list of directories. If this is unset or if a styleset cannot be found, the +# following paths will be used as a fallback in that order: +# +# ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets +# ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets +# /usr/local/share/aerc/stylesets +# /usr/share/aerc/stylesets +# +#stylesets-dirs= + +# Uncomment to use box-drawing characters for vertical and horizontal borders. +# +# Default: " " +#border-char-vertical=" " +#border-char-horizontal=" " + +# Sets the styleset to use for the aerc ui elements. +# +# Default: default +#styleset-name=default +styleset-name=mv + +# Activates fuzzy search in commands and their arguments: the typed string is +# searched in the command or option in any position, and need not be +# consecutive characters in the command or option. +# +# Default: false +#fuzzy-complete=false + +# How long to wait after the last input before auto-completion is triggered. +# +# Default: 250ms +#completion-delay=250ms + +# The minimum required characters to allow auto-completion to be triggered after +# completion-delay. +# +# Setting this to "manual" disables automatic completion, leaving only the +# manually triggered completion with the $complete key (see aerc-binds(5) for +# more details). +# +# Default: 1 +#completion-min-chars=1 + +# +# Global switch for completion popovers +# +# Default: true +#completion-popovers=true + +# Uncomment to use UTF-8 symbols to indicate PGP status of messages +# +# Default: ASCII +#icon-unencrypted= +#icon-encrypted=✔ +#icon-signed=✔ +#icon-signed-encrypted=✔ +#icon-unknown=✘ +#icon-invalid=⚠ + +# Reverses the order of the message list. By default, the message list is +# ordered with the newest (highest UID) message on top. Reversing the order +# will put the oldest (lowest UID) message on top. This can be useful in cases +# where the backend does not support sorting. +# +# Default: false +#reverse-msglist-order = false + +# Reverse display of the mesage threads. Default order is the the intial +# message is on the top with all the replies being displayed below. The +# reverse option will put the initial message at the bottom with the +# replies on top. +# +# Default: false +#reverse-thread-order=false + +# Sort the thread siblings according to the sort criteria for the messages. If +# sort-thread-siblings is false, the thread siblings will be sorted based on +# the message UID in ascending order. This option is only applicable for +# client-side threading with a backend that enables sorting. Note that there's +# a performance impact when sorting is activated. +# +# Default: false +#sort-thread-siblings=false + +#[ui:account=foo] +# +# Enable a threaded view of messages. If this is not supported by the backend +# (IMAP server or notmuch), threads will be built by the client. +# +# Default: false +#threading-enabled=false + +# Force client-side thread building +# +# Default: false +#force-client-threads=false + +# Show thread context enables messages which do not match the current query (or +# belong to the current mailbox) to be shown for context. These messages can be +# styled separately using "msglist_thread_context" in a styleset. This feature +# is not supported by all backends +# +# Default: false +#show-thread-context=false + +# Debounce client-side thread building +# +# Default: 50ms +#client-threads-delay=50ms + +# +# Thread prefix customization: + +# +# Customize the thread prefix appearance by selecting the arrow head. +# +# Default: ">" +#thread-prefix-tip = ">" + +# +# Customize the thread prefix appearance by selecting the arrow indentation. +# +# Default: " " +#thread-prefix-indent = " " + +# +# Customize the thread prefix appearance by selecting the vertical extension of +# the arrow. +# +# Default: "│" +#thread-prefix-stem = "│" + +# +# Customize the thread prefix appearance by selecting the horizontal extension +# of the arrow. +# +# Default: "" +#thread-prefix-limb = "" + +# +# Customize the thread prefix appearance by selecting the folded thread +# indicator. +# +# Default: "" +#thread-prefix-folded = "" + +# +# Customize the thread prefix appearance by selecting the unfolded thread +# indicator. +# +# Default: "" +#thread-prefix-unfolded = "" + +# +# Customize the thread prefix appearance by selecting the first child connector. +# +# Default: "" +#thread-prefix-first-child = "" + +# +# Customize the thread prefix appearance by selecting the connector used if +# the message has siblings. +# +# Default: "├─" +#thread-prefix-has-siblings = "├─" + +# +# Customize the thread prefix appearance by selecting the connector used if the +# message has no parents and no children. +# +# Default: "" +#thread-prefix-lone = "" + +# +# Customize the thread prefix appearance by selecting the connector used if the +# message has no parents and has children. +# +# Default: "" +#thread-prefix-orphan = "" + +# +# Customize the thread prefix appearance by selecting the connector for the last +# sibling. +# +# Default: "└─" +#thread-prefix-last-sibling = "└─" + +# +# Customize the reversed thread prefix appearance by selecting the connector for +# the last sibling. +# +# Default: "┌─" +#thread-prefix-last-sibling-reverse = "┌─" + +# +# Customize the reversed thread prefix appearance by selecting the first child +# connector. +# +# Default: "" +#thread-prefix-first-child-reverse = "" + +# +# Customize the reversed thread prefix appearance by selecting the connector +# used if the message has no parents and has children. +# +# Default: "" +#thread-prefix-orphan-reverse = "" + +[statusline] +# +# Describes the format for the status line. This is a comma separated list of +# column names with an optional align and width suffix. See [ui].index-columns +# for more details. To completely mute the status line except for push +# notifications, explicitly set status-columns to an empty string. +# +# Default: left<*,center:=,right>* +#status-columns=left<*,center:=,right>* + +# +# Each name in status-columns must have a corresponding column-$name setting. +# All column-$name settings accept golang text/template syntax. See +# aerc-templates(7) for available template attributes and functions. +# +# Default settings +#column-left=[{{.Account}}] {{.StatusInfo}} +#column-center={{.PendingKeys}} +#column-right={{.TrayInfo}} + +# +# String separator inserted between columns. +# See [ui].column-separator for more details. +# +#column-separator=" " + +# Specifies the separator between grouped statusline elements. +# +# Default: " | " +#separator=" | " + +# Defines the mode for displaying the status elements. +# Options: text, icon +# +# Default: text +#display-mode=text + +[viewer] +# +# Specifies the pager to use when displaying emails. Note that some filters +# may add ANSI codes to add color to rendered emails, so you may want to use a +# pager which supports ANSI codes. +# +# Default: less -Rc +#pager=less -Rc + +# +# If an email offers several versions (multipart), you can configure which +# mimetype to prefer. For example, this can be used to prefer plaintext over +# html emails. +# +# Default: text/plain,text/html +#alternatives=text/plain,text/html + +# +# Default setting to determine whether to show full headers or only parsed +# ones in message viewer. +# +# Default: false +#show-headers=false + +# +# Layout of headers when viewing a message. To display multiple headers in the +# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if +# none of their specified headers are present in the message. +# +# Default: From|To,Cc|Bcc,Date,Subject +#header-layout=From|To,Cc|Bcc,Date,Subject + +# Whether to always show the mimetype of an email, even when it is just a single part +# +# Default: false +#always-show-mime=false + +# Define the maximum height of the mimetype switcher before a scrollbar is used. +# The height of the mimetype switcher is restricted to half of the display +# height. If the provided value for the height is zero, the number of parts will +# be used as the height of the type switcher. +# +# Default: 0 +#max-mime-height = 0 + +# Parses and extracts http links when viewing a message. Links can then be +# accessed with the open-link command. +# +# Default: true +#parse-http-links=true + +[compose] +# +# Specifies the command to run the editor with. It will be shown in an embedded +# terminal, though it may also launch a graphical window if the environment +# supports it. Defaults to $EDITOR, or vi. +#editor= + +# +# When set, aerc will create and read .eml files for composing that have +# non-standard \n linebreaks. This is only relevant if the used editor does not +# support CRLF linebreaks. +# +#lf-editor=false + +# +# Default header fields to display when composing a message. To display +# multiple headers in the same row, separate them with a pipe, e.g. "To|From". +# +# Default: To|From,Subject +#header-layout=To|From,Subject + +# +# Edit headers into the text editor instead than separate fields. +# +# When this is true, address-book-cmd is not supported and address completion +# is left to the editor itself. Also, displaying multiple headers on the same +# line is not possible. +# +# Default: false +#edit-headers=false + +# +# Specifies the command to be used to tab-complete email addresses. Any +# occurrence of "%s" in the address-book-cmd will be replaced with what the +# user has typed so far. +# +# The command must output the completions to standard output, one completion +# per line. Each line must be tab-delimited, with an email address occurring as +# the first field. Only the email address field is required. The second field, +# if present, will be treated as the contact name. Additional fields are +# ignored. +# +# This parameter can also be set per account in accounts.conf. +address-book-cmd=abook --mutt-query "%s" + +# Specifies the command to be used to select attachments. Any occurrence of +# '%s' in the file-picker-cmd will be replaced with the argument +# to :attach -m . Any occurence of '%f' will be replaced by the +# location of a temporary file, from which aerc will read the selected files. +# +# If '%f' is not present, the command must output the selected files to +# standard output, one file per line. If it is present, then aerc does not +# capture the standard output and instead reads the files from the temporary +# file which should have the same format. +#file-picker-cmd= + +# +# Allow to address yourself when replying +# +# Default: true +#reply-to-self=true + +# Warn before sending an email with an empty subject. +# +# Default: false +#empty-subject-warning=false + +# +# Warn before sending an email that matches the specified regexp but does not +# have any attachments. Leave empty to disable this feature. +# +# Uses Go's regexp syntax, documented at https://golang.org/s/re2syntax. The +# "(?im)" flags are set by default (case-insensitive and multi-line). +# +# Example: +# no-attachment-warning=^[^>]*attach(ed|ment) +# +#no-attachment-warning= + +# +# When set, aerc will generate "format=flowed" bodies with a content type of +# "text/plain; format=flowed" as described in RFC3676. This format is easier to +# handle for some mailing software, and generally just looks like ordinary +# text. To actually make use of this format's features, you'll need support in +# your editor. +# +#format-flowed=false + +[multipart-converters] +# +# Converters allow to generate multipart/alternative messages by converting the +# main text/plain part into any other MIME type. Only exact MIME types are +# accepted. The commands are invoked with sh -c and are expected to output +# valid UTF-8 text. +# +# Example (obviously, this requires that you write your main text/plain body +# using the markdown syntax): +#text/html=pandoc -f markdown -t html --standalone + +[filters] +# +# Filters allow you to pipe an email body through a shell command to render +# certain emails differently, e.g. highlighting them with ANSI escape codes. +# +# The commands are invoked with sh -c. The following folders are prepended to +# the system $PATH to allow referencing filters from their name only: +# +# ${XDG_CONFIG_HOME:-~/.config}/aerc/filters +# ~/.local/libexec/aerc/filters +# ${XDG_DATA_HOME:-~/.local/share}/aerc/filters +# $PREFIX/libexec/aerc/filters +# $PREFIX/share/aerc/filters +# /usr/libexec/aerc/filters +# /usr/share/aerc/filters +# +# If you want to run a program in your default $PATH which has the same name +# as a builtin filter (e.g. /usr/bin/colorize), use its absolute path. +# +# The following variables are defined in the filter command environment: +# +# AERC_MIME_TYPE the part MIME type/subtype +# AERC_FORMAT the part content type format= parameter +# AERC_FILENAME the attachment filename (if any) +# AERC_SUBJECT the message Subject header value +# AERC_FROM the message From header value +# +# The first filter which matches the email's mimetype will be used, so order +# them from most to least specific. +# +# You can also match on non-mimetypes, by prefixing with the header to match +# against (non-case-sensitive) and a comma, e.g. subject,text will match a +# subject which contains "text". Use header,~regex to match against a regex. +# +text/plain=colorize +text/calendar=calendar +message/delivery-status=colorize +message/rfc822=colorize +#text/html=pandoc -f html -t plain | colorize +text/html=html | colorize +#text/*=bat -fP --file-name="$AERC_FILENAME" +#application/x-sh=bat -fP -l sh +#image/*=catimg -w $(tput cols) - +#subject,~Git(hub|lab)=lolcat -f +#from,thatguywhodoesnothardwraphismessages=wrap -w 100 | colorize + +# This special filter is only used to post-process email headers when +# [viewer].show-headers=true +# By default, headers are piped directly into the pager. +# +.headers=colorize + +[openers] +# +# Openers allow you to specify the command to use for the :open and :open-link +# actions on a per-MIME-type basis. The :open-link URL scheme is used to +# determine the MIME type as follows: x-scheme-handler/. +# +# {} is expanded as the temporary filename or URL to be opened with proper +# shell quoting. If it is not encountered in the command, the filename/URL will +# be appended to the end of the command. The command will then be executed with +# `sh -c`. +# +# Like [filters], openers support basic shell globbing. The first opener which +# matches the part's MIME type (or URL scheme handler MIME type) will be used, +# so order them from most to least specific. +# +# Examples: +# x-scheme-handler/irc=hexchat +# x-scheme-handler/http*=printf '%s' {} | wl-copy +# text/html=surf -dfgms +# text/plain=gvim {} +125 +# message/rfc822=thunderbird + +[hooks] +# +# Hooks are triggered whenever the associated event occurs. + +# +# Executed when a new email arrives in the selected folder +#mail-received=notify-send "[$AERC_ACCOUNT/$AERC_FOLDER] New mail from $AERC_FROM_NAME" "$AERC_SUBJECT" + +# +# Executed when mail is deleted from a folder +#mail-deleted=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" & + +# +# Executed when aerc adds mail to a folder +#mail-added=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" & + +# +# Executed when aerc starts +#aerc-startup=aerc :terminal calcurse && aerc :next-tab + +# +# Executed when aerc shuts down. +#aerc-shutdown= + +[templates] +# Templates are used to populate email bodies automatically. +# + +# The directories where the templates are stored. It takes a colon-separated +# list of directories. If this is unset or if a template cannot be found, the +# following paths will be used as a fallback in that order: +# +# ${XDG_CONFIG_HOME:-~/.config}/aerc/templates +# ${XDG_DATA_HOME:-~/.local/share}/aerc/templates +# /usr/local/share/aerc/templates +# /usr/share/aerc/templates +# +#template-dirs= + +# The default template to be used for new messages. +# +# default: new_message +#new-message=new_message + +# The default template to be used for quoted replies. +# +# default: quoted_reply +#quoted-reply=quoted_reply + +# The default template to be used for forward as body. +# +# default: forward_as_body +#forwards=forward_as_body diff --git a/.config/aerc/binds.conf b/.config/aerc/binds.conf new file mode 100644 index 0000000..4c2efa4 --- /dev/null +++ b/.config/aerc/binds.conf @@ -0,0 +1,177 @@ +# Binds are of the form = +# To use '=' in a key sequence, substitute it with "Eq": "" +# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit + = :prev-tab + = :prev-tab + = :next-tab + = :next-tab +\[t = :prev-tab +\]t = :next-tab + = :term +? = :help keys + = :prompt 'Quit?' quit + = :prompt 'Quit?' quit + = :suspend + +[messages] +q = :prompt 'Quit?' quit + +j = :next + = :next + = :next 50% + = :next 100% + = :next 100% + +k = :prev + = :prev + = :prev 50% + = :prev 100% + = :prev 100% +g = :select 0 +G = :select -1 + +J = :next-folder + = :next-folder +K = :prev-folder + = :prev-folder +H = :collapse-folder + = :collapse-folder +L = :expand-folder + = :expand-folder + +v = :mark -t + = :mark -t:next +V = :mark -v + +T = :toggle-threads +zc = :fold +zo = :unfold +za = :fold -t +zM = :fold -a +zR = :unfold -a + = :fold -t + + = :view +d = :prompt 'Really delete this message?' 'delete-message' +D = :delete +a = :archive flat +A = :unmark -a:mark -T:archive flat + +C = :compose +m = :compose + +rr = :reply -a +rq = :reply -aq +Rr = :reply +Rq = :reply -q + +c = :cf +$ = :term +! = :term +| = :pipe + +/ = :search +\ = :filter +n = :next-result +N = :prev-result + = :clear + +s = :split +S = :vsplit + +pl = :patch list +pa = :patch apply +pd = :patch drop +pb = :patch rebase +pt = :patch term +ps = :patch switch + +[messages:folder=Drafts] + = :recall + +[view] +/ = :toggle-key-passthrough/ +q = :close +O = :open +o = :open +S = :save +| = :pipe +D = :delete +A = :archive flat + + = :open-link + +f = :forward +rr = :reply -a +rq = :reply -aq +Rr = :reply +Rq = :reply -q + +H = :toggle-headers + = :prev-part + = :prev-part + = :next-part + = :next-part +J = :next + = :next +K = :prev + = :prev + +[view::passthrough] +$noinherit = true +$ex = + = :toggle-key-passthrough + +[compose] +# Keybindings used when the embedded terminal is not selected in the compose +# view +$noinherit = true +$ex = +$complete = + = :prev-field + = :prev-field + = :next-field + = :next-field + = :switch-account -p + = :switch-account -p + = :switch-account -n + = :switch-account -n + = :next-field + = :prev-field + = :prev-tab + = :prev-tab + = :next-tab + = :next-tab + +[compose::editor] +# Keybindings used when the embedded terminal is selected in the compose view +$noinherit = true +$ex = + = :prev-field + = :prev-field + = :next-field + = :next-field + = :prev-tab + = :prev-tab + = :next-tab + = :next-tab + +[compose::review] +# Keybindings used when reviewing a message to be sent +y = :send +n = :abort +v = :preview +p = :postpone +q = :choose -o d discard abort -o p postpone postpone +e = :edit +a = :attach +d = :detach + +[terminal] +$noinherit = true +$ex = + + = :prev-tab + = :next-tab + = :prev-tab + = :next-tab diff --git a/.config/aerc/stylesets/mv b/.config/aerc/stylesets/mv new file mode 100644 index 0000000..189e28d --- /dev/null +++ b/.config/aerc/stylesets/mv @@ -0,0 +1,5 @@ +warning.fg=orange +statusline_warning.fg=orange + +[viewer] +url.fg=purple diff --git a/.config/sway/config b/.config/sway/config index d41c208..4a42299 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -27,7 +27,9 @@ bindsym $mod+q kill bindsym $mod+Return exec --no-startup-id foot #bindsym $mod+Return exec --no-startup-id xt #bindsym $mod+d exec --no-startup-id bemenu-run -bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="bemenu -i -fn 'Mono-12' --hf '#00ff00' --tf '#00ff00'" +#bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="bemenu -i -fn 'Mono-12' --hf '#00ff00' --tf '#00ff00'" +bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="wmenu-run" +#bindsym $mod+d exec --no-startup-id wemenu-run for_window [app_id="google-chrome"] floating enable for_window [class="firefox"] floating enable -- cgit v1.2.3 From 4dbdd1560aaf915b6f9072a5599975cff4c0aa26 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Thu, 12 Sep 2024 23:14:17 +0200 Subject: update --- .bashrc | 1 + .config/sway/config | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 23a8084..c18128f 100644 --- a/.bashrc +++ b/.bashrc @@ -10,6 +10,7 @@ export HISTCONTROL=ignoreboth:erasedups # no start space and duplicate entries export HISTSIZE=100000 # big big history export HISTFILESIZE=100000 # big big history shopt -s histappend # append to history, don't overwrite it +stty -ixon # disable Ctrl-S # Save and reload the history after each command finishes #export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" diff --git a/.config/sway/config b/.config/sway/config index 4a42299..3419359 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -28,8 +28,9 @@ bindsym $mod+Return exec --no-startup-id foot #bindsym $mod+Return exec --no-startup-id xt #bindsym $mod+d exec --no-startup-id bemenu-run #bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="bemenu -i -fn 'Mono-12' --hf '#00ff00' --tf '#00ff00'" -bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="wmenu-run" +#bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="wmenu-run" #bindsym $mod+d exec --no-startup-id wemenu-run +bindsym $mod+d exec --no-startup-id fuzzel -T foot for_window [app_id="google-chrome"] floating enable for_window [class="firefox"] floating enable -- cgit v1.2.3 From 4fc3fb1fb1b7f3d4df6c86b45615139c3d9263ed Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 20 Sep 2024 15:25:42 +0200 Subject: add yay config --- .config/yay/config.json | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .config/yay/config.json diff --git a/.config/yay/config.json b/.config/yay/config.json new file mode 100644 index 0000000..f330f41 --- /dev/null +++ b/.config/yay/config.json @@ -0,0 +1,50 @@ +{ + "aururl": "https://aur.archlinux.org", + "aurrpcurl": "https://aur.archlinux.org/rpc?", + "buildDir": "/home/marc/.cache/yay", + "editor": "", + "editorflags": "", + "makepkgbin": "makepkg", + "makepkgconf": "", + "pacmanbin": "pacman", + "pacmanconf": "/etc/pacman.conf", + "redownload": "no", + "answerclean": "yes", + "answerdiff": "yes", + "answeredit": "", + "answerupgrade": "", + "gitbin": "git", + "gpgbin": "gpg", + "gpgflags": "", + "mflags": "", + "sortby": "votes", + "searchby": "name-desc", + "gitflags": "", + "removemake": "ask", + "sudobin": "sudo", + "sudoflags": "", + "version": "12.3.5", + "requestsplitn": 150, + "completionrefreshtime": 7, + "maxconcurrentdownloads": 1, + "bottomup": true, + "sudoloop": false, + "timeupdate": false, + "devel": false, + "cleanAfter": true, + "keepSrc": false, + "provides": true, + "pgpfetch": true, + "cleanmenu": true, + "diffmenu": true, + "editmenu": false, + "combinedupgrade": true, + "useask": false, + "batchinstall": false, + "singlelineresults": false, + "separatesources": true, + "debug": false, + "rpc": true, + "doubleconfirm": true, + "rebuild": "no" +} -- cgit v1.2.3 From 6d506e0b30569c547f41f6d6334a1b5133774da4 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Sun, 19 Jan 2025 18:22:57 +0100 Subject: updqte --- .bashrc | 2 +- .profile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index c18128f..da5d096 100644 --- a/.bashrc +++ b/.bashrc @@ -5,7 +5,7 @@ export PAGER=less export EDITOR=vim -export HISTIGNORE='sudo id:uname:date:exit:df:ll:ls:ps:pwd:top:history' +export HISTIGNORE='sudo id:uname:date:exit:df:ll:ls:ps:pwd:tc:top:history' export HISTCONTROL=ignoreboth:erasedups # no start space and duplicate entries export HISTSIZE=100000 # big big history export HISTFILESIZE=100000 # big big history diff --git a/.profile b/.profile index 3b15a21..eabc26e 100644 --- a/.profile +++ b/.profile @@ -10,3 +10,5 @@ PATH=~/bin:~/mu/bin:$PATH:~/go/bin # esac tabs -4 + +[ "$(tty)" != /dev/tty1 ] || exec dbus-run-session sway -- cgit v1.2.3