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 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 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 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 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 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