Skip to content

Instantly share code, notes, and snippets.

@dlitz
dlitz / 80-dlitz-mount-virtiofs.rules
Last active May 21, 2026 12:35
HAOS virtiofs hack
# dlitz 2025
ACTION!="remove", DRIVER=="virtiofs", RUN{program}+="/etc/udev/rules.d/dlitz-mount-virtiofs %n"
@dlitz
dlitz / 20-wan0.network (partial)
Created April 24, 2026 17:52
systemd-networkd options for stable address assignment
[Network]
DHCPPrefixDelegation=yes
DHCP=yes
IPv6AcceptRA=yes
IPv6LinkLocalAddressGenerationMode=eui64
# Note: If IgnoreCarrierLoss is set to yes, then "networkctl down wan0;
# networkctl up wan0" will still drop the default route and not recreate it
# until another DHCP exchange is performed.
IgnoreCarrierLoss=no
KeepConfiguration=dhcp-on-stop
@dlitz
dlitz / NOTE.md
Last active May 3, 2025 07:09
example IAM policy for restic user

Users should be named with the suffix "-restic", e.g. "host1-restic"

@dlitz
dlitz / config
Created June 18, 2023 11:43
My /etc/ssh/sshd_config.d/local.conf (bas
# Example ~/.ssh/config
# Used with something like:
# sshfs -o rw,reconnect,auto_unmount,noatime,idmap=user,allow_root _sshfs.syra.dlitz.net:~/ ~/mnt/syra
Host _sshfs.syra.dlitz.net
HostKeyAlias syra.dlitz.net
HostName syra.dlitz.net
ProxyCommand none
ControlPath none
ServerAliveCountMax 2
@dlitz
dlitz / .bashrc
Last active June 18, 2023 11:22
root's .bashrc., .profile, and .inputrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022
# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "$(dircolors)"
@dlitz
dlitz / djvusplit.sh
Created April 27, 2022 02:04
Shell script to split .djvu files into pages, one per file
#!/bin/bash
# dlitz 2022
# SPDX-License-Identifier: CC0-1.0
set -eu
usage() {
echo "usage: $0 [-v] inputfile.djvu output-dir"
echo "Split a DjVu document into multiple pages, one per file."
echo "Use djvm -c to reassemble the file."
#!/usr/bin/env python
# sort | uniq -c | sort -rn in Python
# Released into the public domain. No rights reserved.
import sys
# Build a dictionary of lines and their associated counts.
counts = {}
#input_file = open("/path/to/file", "r")
input_file = sys.stdin
@dlitz
dlitz / btrfstune-m-breaks-btrfs-scrub.sh
Last active May 11, 2022 01:50
btrfstune -m breaks btrfs scrub
#!/bin/bash
# dlitz 2022
# This tests 'btrfstune -m' (change metadata_uuid) followed by 'btrfs scrub'.
# Apparently, changing the metadata_uuid causes btrfs scrub to spew
# uncorrectable errors, even on an empty filesystem.
# Changing the metadata_uuid back to the old value makes 'btrfs scrub' happy
# again.
set -eu
@dlitz
dlitz / hello.sh
Created November 3, 2018 05:52
simple hello-world script
#!/bin/sh
echo "Hello world!"
@dlitz
dlitz / patch-vmware-workstation-9.02_linux-3.12.sh
Created January 21, 2014 00:10
VMware Workstation kernel module patches VMware Workstation 9.0.2 & Linux kernel 3.12
#!/bin/sh
# Inspired by the vmware-any-any-update series of patches
set -e
ws_ver=`vmware-installer -l | grep vmware-workstation | awk '{ print $2 }' | cut -d. -f1-3`
if [ -z "$ws_ver" ] ; then
echo >&2 "$0: error: VMware Workstation not installed?"
exit 1
fi