2 TL;DR : #
3 "watchdogs" #
inotify
1sudo pacman -S inotify-tools
2which inotifywait
3inotifywait --version
4```1
5
6alternatives
7
8**entr**
9
10```bash
11# install
12sudo pacman -Qs entr
13# eg
14ls ~/blog-local/*.md | entr -r rsync -av --exclude='.~*' ~/blog-local/ ~/blog-remote/
15# cons
16# needs eg `ls` -- no auto detect
systemd.path
watch dirs -> trigger service
see https://eog.prose.sh/cmp.cmd..systemd.path..watch.dir.and.sync
3 delete lines #
whole lines beginning with <
1^<.*\n?
2# ^ = start of line
3# < = literal <
4# .* = rest of line
5# \n? = also remove the newline so you don’t leave blank lines
delete any empty line (even lines with spaces):
1^\s*\n
2# ^\s* matches zero or more whitespace chars from the start of the line
3# \n removes the actual newline
only truly empty lines (no spaces):
1^\n
3 find foo OR bar #
1find . \( -name "*.htm" -o -name "*.html" \)
2
3# alternative
4find . -regex '.*\.html?'
Escape parentheses to prevent shell from eating them.
3 mpv #
1
2_useragent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
3
4mpv --user-agent="$_useragent" <URL>
5
6# or
7cat << EOG >> ~/.config/mpv/mpv.conf
8user-agent="_useragent"
9EOG
3 YAML #
https://developers.machinemetrics.com/docs/adapter-scripts/yaml
array inline
1#
2tags: [feature, announcement]
is same as
1tags:
2 - feature
3 - announcement
Indent w/ min. 2 spaces. But NO TABS allowed!!
1authors: # = key
2 - name: Alice # = object / map
3 role: writer # belongs to this object
4 socials:
5 twitter: alice42
6
7 - name: Bob
8...
1authors =
2[
3 { name: "Alice", role: "writer", socials: {twitter:"alice42"} },
4 { name: "Bob", role: "editor", socials: {twitter:"bob_edit"} }
5]
Tips
indentation 2 spaces at each level.
.
2 Rsync w/ links but NOT copying these files #
| Flag | Meaning | Effect |
|---|---|---|
-L / --copy-links |
Dereference | Replaces link with file; fails if file excluded |
--copy-unsafe-links |
Only copy safe ones | Skips links outside tree |
--safe-links |
Don’t copy links pointing outside | Skips many absolute links |
--no-links |
Don’t copy links | Obviously drops symlinks |
--links # default in -a
remove /storage/static-e1b9045b-d89a-4dbb-8a90-addcee48aac4/prose: directory not empty
This is exactly what --delete is supposed to do — it’s just catastrophically dangerous when the source list is incomplete.
✔ Golden Rule: NEVER run --delete with shell globs (foo*, *.md, etc.)
You must always give rsync a directory as the source.
✔ Correct + safe way to do “only sync foo*, and delete remote foo* not local”
We need to: . sync only files matching foo* . delete remote foo* that don’t exist locally . NOT delete unrelated files
The safe way is to use filters, not shell globs.
! Correct method: use --include / --exclude filters
