diff options
| author | Marc Vertes <mvertes@free.fr> | 2025-07-06 18:09:06 +0200 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2025-07-06 18:09:06 +0200 |
| commit | 9ac115e05f82ebb2a8998f91a32d8efdac6c659d (patch) | |
| tree | 891209f4b1a5377875968eb087b2362abf99c833 | |
| parent | cd3dfb2203f091d7781fac890e039eb5ca10ade1 (diff) | |
update
| -rw-r--r-- | .bashrc | 9 | ||||
| -rw-r--r-- | .bkignore | 1 | ||||
| -rw-r--r-- | .vimrc | 1 | ||||
| -rwxr-xr-x | bin/bk | 24 |
4 files changed, 23 insertions, 12 deletions
@@ -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") ;; @@ -1,3 +1,4 @@ +Library/Application Support/Arc/User Data/Safe Browsing Library/AppleMediaServices Library/CloudStorage Library/Containers/com.apple.Batteries.BatteriesAvocadoWidgetExtension @@ -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>" @@ -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" |
