shell snippets
hannah
updating this site
This site is stored in a git repo. A cronjob runs every minute to check for new commits, automatically pulling them and restarting the service if those exist.
XDG_RUNTIME_DIR=/run/user/$(id -u)
DBUS_SESSION_BUS_ADDRESS=unix:path=${XDG_RUNTIME_DIR}/bus
export DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
cd /home/hd-dn/hd-dn
git fetch origin
if git status | grep -q behind; then
git merge origin/mom
./build.sh
systemctl --user restart hd-dn.service
fi
markdown to html partials
I use this to convert Markdown files from an Obsidian vault into HTML partials to use on HD-DN.
# Convert $1 to HD-DN-ready HTML partial saved at $2
pandoc "$1" -s -f markdown+yaml_metadata_block+auto_identifiers-smart -o "$2"
tidy -imq "$2" # Pandoc end-lines are weird and break stuff, run tidy on it
sed -ni "/<body>/,/<\/body>/p" "$2" # Only grab <body>stuff</body>
sed -i "1d;\$d" "$2" # Remove start and end line