Skip to content

Instantly share code, notes, and snippets.

View linux4life798's full-sized avatar

Craig Hesling linux4life798

View GitHub Profile
@linux4life798
linux4life798 / dew_point.yaml
Last active August 8, 2025 20:50
Home Assistant dew point blueprint template
blueprint:
name: Dew Point (Template Sensor)
description: >
Create a dew point sensor from temperature and relative humidity using
precise psychrometric formulas. Defaults to Buck (1981, ice/water split);
Magnus–Tetens (Alduchov & Eskridge, 1996) available as an alternative.
domain: template
source_url: https://gist.github.com/linux4life798/417a932a54503c9747d3a3a40219ac46
input:
temperature_entity:
@linux4life798
linux4life798 / udev-protected-usb-storage.md
Last active July 29, 2025 23:17
Protect USB storage devices, holding alternative operating systems, from overwrite

/etc/udev/rules.d/99-protected-usb-storage.rules:

# Craig Jul 29, 2025
#
# Prevent accidentally writing over alt OS boot volumes, like my
# Framework 1TB Expansion card for Windows 11.
#
# sudo udevadm control --reload-rules
@linux4life798
linux4life798 / chroot-enter.bash
Last active April 22, 2025 23:19
Script to setup and enter a chroot
#!/bin/bash
# Craig Hesling <[email protected]>
set -e
root="$1"
if [[ -z "$root" || ! -d "$root" ]]; then
echo "Error: Directory '$root' does not exist"
echo
@linux4life798
linux4life798 / nginx_proxy_default.conf
Last active April 19, 2025 05:50
Change Home Assistant NGINX SSL Proxy Listening Port
# /share/nginx_proxy_default.conf
# Blank.
# apk add cadaver
sudo apt install cadaver

cadaver http://100.100.100.100:8080/<tailnet_name>/<host>/<share>
> ls
@linux4life798
linux4life798 / unraid_installer.md
Last active December 2, 2024 03:06
Setup an Unraid inestaller on USB driver on Linux
@linux4life798
linux4life798 / portainer.md
Last active July 29, 2024 09:30
Setup Portainer on Debian with Tailscale
@linux4life798
linux4life798 / qemu-guest-debian.md
Last active July 15, 2024 03:18
Setup Debian as QEMU/KVM/libvirt guest

Channel: unix + org.qemu.guest_agent.0

It doesn't need to be the QEMU agent type. Both the unix and QEMU vdagent channels have "clipboard" support, but neither seem to work. Clipboard support of the spicevmc does seem to work.

You need the following package to enable this channel, but it is usually automatically installed during debian installer:

sudo apt install qemu-guest-agent

Setup

Very unfortunatley, there is not a reasonable way to get Debian's default initramfs-tools to unlock LUKS volumes using tokens, like FIDO2 or TPM2. The best attempt to make this work using initramfs-tools is https://github.com/bertogg/fido2luks.

The most common way to handle unlocking these LUKS volumes is to use dracut to generate an initram filesystems. I'm not saying that dracut is great, but it will allow you to easily use systemd-cryptenroll tokenized luks unlock methods.

Setup dracut on Debian

@linux4life798
linux4life798 / pstore.md
Last active May 28, 2024 06:53
Info about enabling kernel log dump to pstore

On Debian the /usr/lib/tmpfiles.d/systemd-pstore.conf file can modified to enable pstore log saving on panic and shutdown.

w- /sys/module/printk/parameters/always_kmsg_dump - - - - Y
w- /sys/module/kernel/parameters/crash_kexec_post_notifiers - - - - Y

The systemd-pstore service is already configured to read from /sys/fs/pstore on the next boot and add these log fragment to the journal log and directly copy to /var/lib/systemd/pstore/.