summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2025-07-06 18:09:06 +0200
committerMarc Vertes <mvertes@free.fr>2025-07-06 18:09:06 +0200
commit9ac115e05f82ebb2a8998f91a32d8efdac6c659d (patch)
tree891209f4b1a5377875968eb087b2362abf99c833
parentcd3dfb2203f091d7781fac890e039eb5ca10ade1 (diff)
update
-rw-r--r--.bashrc9
-rw-r--r--.bkignore1
-rw-r--r--.vimrc1
-rwxr-xr-xbin/bk24
4 files changed, 23 insertions, 12 deletions
diff --git a/.bashrc b/.bashrc
index 317bdb6..68eedfc 100644
--- a/.bashrc
+++ b/.bashrc
@@ -42,8 +42,10 @@ case $OS in
;;
esac
-p() { [ -f "$1" -a ! -x "$1" ] && less "$1" || "$@" 2>&1 | less; }
-export -f p
+# Exported functions
+d() { date +%F; }
+p() { [ -f "$1" -a ! -x "$1" ] && less "$1" || "$@" 2>&1 | less; }
+export -f d p
[ "$OS" = alpine ] && export MANPAGER='vim +MANPAGER --not-a-term'
@@ -57,7 +59,7 @@ alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date
alias apk='doas apk'
alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME'
alias dy='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi'
-alias f2fa='2fa -list | fzf | xargs 2fa -clip'
+alias 2fz='2fa -list | fzf | xargs 2fa -clip'
alias fd='find . -iname'
alias gdt='dlv test -- -test.v -test.run'
alias gob='go build'
@@ -100,6 +102,7 @@ eval "$(fzf --bash)" >/dev/null
# Handle missing commands, unless already provided.
type -t command_not_found_handle >/dev/null || command_not_found_handle() {
+ local pkgs
case $OS in
(alpine) pkgs=$(apk list -Pq "cmd:$1" | awk '{print $2}') ;;
(arch) pkgs=$(pkgfile -b "$1") ;;
diff --git a/.bkignore b/.bkignore
index c630139..a3a55f2 100644
--- a/.bkignore
+++ b/.bkignore
@@ -1,3 +1,4 @@
+Library/Application Support/Arc/User Data/Safe Browsing
Library/AppleMediaServices
Library/CloudStorage
Library/Containers/com.apple.Batteries.BatteriesAvocadoWidgetExtension
diff --git a/.vimrc b/.vimrc
index 7348b9c..7351794 100644
--- a/.vimrc
+++ b/.vimrc
@@ -65,6 +65,7 @@ autocmd BufNewFile,BufRead *.gno setlocal noexpandtab tabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead *.gno set filetype=gno
autocmd Filetype go set mp=go\ build
+autocmd Filetype sh compiler shellcheck
let g:netrw_browsex_viewer = "open"
let g:netrw_gx = "<cWORD>"
diff --git a/bin/bk b/bin/bk
index ed76199..e313962 100755
--- a/bin/bk
+++ b/bin/bk
@@ -1,15 +1,21 @@
-#!/bin/sh
+#!/bin/sh -e
-# Daily backup script.
+# Daily backup script. Perform once per day with a cron like:
+# 55 18 * * * /Users/marc/bin/bk >/tmp/bk.out 2>&1
-dest=${BK:-/Volumes/sandisk4}/backup/$(hostname -s)
-day=$(date +%A)
+error() { echo "$@" >&2; return 1; }
+
+
+dest="${BK:-/Volumes/sandisk4}/backup/$(hostname -s)"
+day="$(date +%A)"
+
+test -d "$dest" || error "$dest not available"
# Clear previous week incremental backup
-mkdir $HOME/emptydir
-rsync --delete -a $HOME/emptydir/ $dest/$day/
-rmdir $HOME/emptydir
+mkdir "$HOME/emptydir"
+rsync --delete -a "$HOME/emptydir/" "$dest/$day/"
+rmdir "$HOME/emptydir"
# Now backup
-rsync --delete --delete-excluded --exclude-from=$HOME/.bkignore \
- --backup --backup-dir=${dest#*:}/$(date +%A) -av $HOME $dest/current
+rsync --delete --delete-excluded --exclude-from="$HOME/.bkignore" \
+ --backup --backup-dir="${dest#*:}/$(date +%A)" -av "$HOME" "$dest/current"