3.27.3.0settings -> help -> Copyrights and licences. Tam se nahaja odsek GPLv3 Compliance, kjer os navodila za sshjanje v tablico.`
ssh root@10.11.99.1
`
Potrebno je vpisati geslo, ki ga najdete med navodili za sshjanje.
Tu je nekaj uporabnih heckov:
touch-a vse datoteke *.metadata, ampak sem to naredila z gemini-jom in se ne spomnim točno navodil. Sory.Tu je skript, ki sem ga nardila na tablici. Naredila sem systemctl service, ki požene ta skript na vsake nekaj minut. Izvede se enkrat na dan, saj spremlja kateri datum je zapisan v datoteki last-success.
`bash
#!/bin/bash
export PATH=$PATH:/opt/bin
STAMP=/home/root/rsyncanje/last-success SHIFT=54300 # 153600 + 560 seconds SYNCDAY=$(date -d "@$(( $(date +%s) - SHIFT ))" +%F)
[ "$(cat "$STAMP" 2>/dev/null)" = "$SYNCDAY" ] && exit 0
SRC=/home/root/.local/share/remarkable/xochitl LIST=/home/root/rsyncanje/files-to-sync.txt
get_value() { sed -n "s/.\"$2\": \"\([^\"]\)\"./\1/p" "$1" }
: > "$LIST"
for meta in "$SRC"/*.metadata; do if grep -q '"visibleName".*@' "$meta"; then id=$(basename "$meta" .metadata)
# skip items flagged as deleted grep -q '"deleted": *true' "$meta" && continue
# walk up, collecting ancestors ancestors="" parent=$(get_value "$meta" parent) while [ -n "$parent" ] && [ "$parent" != "trash" ]; do ancestors="$ancestors $parent.metadata" parent=$(get_value "$SRC/$parent.metadata" parent) done
# skip items in the trash [ "$parent" = "trash" ] && continue
echo "processing $id" >&2
# the notebook's own files, without thumbnails for f in "$SRC/$id".* "$SRC/$id"; do case "$f" in *.thumbnails) continue ;; esac [ -e "$f" ] && echo "${f#$SRC/}" >> "$LIST" done
# the folders above it for a in $ancestors; do echo "$a" >> "$LIST" done fi done
sort -u "$LIST" -o "$LIST"
REMOTE=user@ip PORT=portnumber KEY=/home/root/.ssh/remote.key
if rsync -rt --timeout=60 -e "ssh -i $KEY -p $PORT" \
--files-from="$LIST" "$SRC/" "$REMOTE:/teradisk/remarkable/"; then
ssh -i "$KEY" -p "$PORT" "$REMOTE" 'date +%s > /teradisk/gitanje/trigger'
echo "$SYNCDAY" > "$STAMP"
fi
`
S tem scriptom se zapiski, ki vsebujejo @ v imenu syncajo na server. Potem na serverju poženem spodnji script. Ključnega pomena je ukaz rmdocs, ki sprejme mapo remarkable zvezkov, ki ima enako urejeno vsebino kot jo ima originalna mapa /home/root/.local/share/remarkable/xochitl, naredi pa pdfje, ki so po mapah organizirani tako, kot so organizirani na tablici.
`bash
#!/bin/bash
set -e
exec 9>/teradisk/gitanje/publish.lock flock -n 9 || { echo "already running" >&2; exit 0; }
REPO=/teradisk/gitanje/Vida26365.github.io FOLDER=notes OUT=$REPO/$FOLDER REMARKABLE=/teradisk/remarkable
source /teradisk/gitanje/venv/bin/activate
mkdir -p "$OUT" STATE=/teradisk/gitanje/state mkdir -p "$STATE"
get_value() { sed -n "s/.\"$2\": \"\([^\"]\)\"./\1/p" "$1" }
for meta in "$REMARKABLE"/*.metadata; do id=$(basename "$meta" .metadata)
# folders have no pages, skip them [ "$(get_value "$meta" type)" = "DocumentType" ] || continue
# fingerprint = names, sizes and mtimes of all this notebook's files fp=$( { find "$REMARKABLE" -maxdepth 1 -name "$id.*" -type f -printf '%f %s %T@\n' [ -d "$REMARKABLE/$id" ] && find "$REMARKABLE/$id" -type f -printf '%P %s %T@\n' } | sort | md5sum | cut -d' ' -f1 )
# unchanged since last conversion? skip [ "$(cat "$STATE/$id" 2>/dev/null)" = "$fp" ] && continue
echo "converting $id" >&2
# mini xochitl folder: this notebook plus the folders above it tmp=$(mktemp -d /teradisk/gitanje/tmp.XXXXXX) cp -al "$REMARKABLE/$id".* "$tmp/" [ -d "$REMARKABLE/$id" ] && cp -al "$REMARKABLE/$id" "$tmp/" parent=$(get_value "$meta" parent) while [ -n "$parent" ] && [ "$parent" != "trash" ]; do cp -al "$REMARKABLE/$parent.metadata" "$tmp/" parent=$(get_value "$REMARKABLE/$parent.metadata" parent) done
rmdocs "$tmp" "$OUT" echo "$fp" > "$STATE/$id" rm -rf "$tmp" done
python3 /teradisk/gitanje/make_index.py "$REPO"
cd "$REPO" git add "$FOLDER" index.html
find notes -name '*.pdf' -size +90M -print0 | while IFS= read -r -d '' f; do echo "SKIPPING (too big for GitHub): $f" >&2 git reset -q -- "$f" done
git commit -m "Update notes"
git push origin main
`
Na koncu pa še te novo narejene datoteke script commita na github. Tako imam lahko spletno stran vida26365.github.io.
Script bi lahko bil precej krajši, če ne bi imela toliko zvezkov za syncat, saj večino scripta je tu samo zato, da se mi zgenerirajo pdfji, ki so se dejansko spremenili.
Bil je zabaven projekt. Priporočam :)