moving stuff arounf

This commit is contained in:
2026-10-14 11:50:01 +01:00
parent 1903d58092
commit ddbcf49464
7 changed files with 1 additions and 4 deletions
+24
View File
@@ -0,0 +1,24 @@
# Clipboard handy snippets
## tmux remote session wl-copy style
insert this into bashrc on remote computer
```
clip() {
local input
if [ -t 0 ]; then
input="$*"
else
input=$(cat)
fi
printf "\033]52;c;%s\007" "$(echo -n "$input" | base64)" > "$(tmux display-message -p '#{client_tty}')"
}
```
you can then do something like `clip "literal string"`
and you have `literal string` in your clipboard on the remote host also, this is assuming you use tmux on in a ssh session, and this script is in .bashrc on the remote machine okay?
to pipe the result of whatever do something like this `sudo systemctl status firewalld | clip`
and that output is in your clipboard
+33
View File
@@ -0,0 +1,33 @@
# Watch PDF
So when using typst to create documents, it is fine to have something watching the typst changes, and reload the
file with evince, so you constantly see the changes to the pdf.
I use this bash script with inotifywait, make a bash script and add it to path
Use watch-pdf /path/to/file.pdf okay?
```bash
#!/usr/bin/env bash
set -euo pipefail
[[ -z "$1" ]] && { echo "ERROR: No PDF filename provided"; exit 1; }
PDF_PATH="$1"
if [[ ! -f "${PDF_PATH}" ]]; then
echo "ERROR: ${PDF_PATH} is not a regular file"
exit 1
fi
command -v evince &> /dev/null || { echo "❌ evince not found. Install: sudo apt-get install evince"; exit 1; }
echo "=== Reload Watcher Started ==="
echo "Monitoring ${PDF_PATH} for writes…"
while IFS= read -r change_file; do
[[ "${change_file}" == "${PDF_PATH}" ]] || continue
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ${PDF_PATH} modified → opening evince"
evince "${PDF_PATH}" &
done < <(inotifywait -mr --format '%w%f' -e close_write "${PDF_PATH}")
echo "Watcher stopped."
```