Posts

Build distrobox for calibre 8

  Phase 1: Create the Fedora 41 Distrobox Run these on your  Bluefin host terminal . We use Fedora 41 for library stability and a custom home to keep your config isolated. bash # 1. Create the container distrobox create --name calibre8 --image registry.fedoraproject.org/fedora-toolbox:41 --home ~/distrobox/calibre8 # 2. Enter the container distrobox enter calibre8 Use code with caution. Phase 2: Install the "Dependency Gauntlet" Run these  inside  the  calibre8  container. These are the specific Fedora packages that satisfy Calibre 8's requirements for X11, OpenGL, and WebEngine. bash # 1. Update and install all required system libraries sudo dnf install -y \ wget xz python3 xdg-utils \ xcb-util-cursor libxcb xcb-util-renderutil xcb-util-image xcb-util-keysyms xcb-util-wm \ libglvnd-opengl libglvnd-egl libglvnd-glx mesa-libGL \ nss nss-util nspr atk at-spi2-atk cups-libs libdrm mesa-libgbm \ libXdamage libXrandr libXcomposite libXft libXtst \ ...

Distrobox darkatble container with OpenCL

  distrobox-create -i docker.io/cachyos/cachyos-v3:latest -n opencl-dbx -H ~/distrobox/opencl-dbx     1  sudo pacman -S darktable portmidi libcanberra     2  sudo pacman -S intel-compute-runtime ocl-icd clinfo     3  distrobox-export -a darktable     4  exit      /usr/bin/distrobox-enter  -n opencl-dbx  --   bash -c 'GDK_BACKEND=wayland /usr/bin/darktable'  %U

ZFS ACL breakdown

 Here is the breakdown of your rwxpDdaARWcCos string. This is essentially "Full Control" in the NFSv4/ZFS world. The "Big Three" (Standard Unix) r (read_data): Ability to read the contents of a file. w (write_data): Ability to modify an existing file's contents. x (execute): Ability to run a file as a program or search/enter a directory. The "Management" Bits (The "pDd" in your string) p (append_data): Ability to add data to the end of a file or create subdirectories. D (delete_child): (Directory only) Ability to delete files or folders inside this directory. d (delete): Ability to delete the file or folder itself. The "Metadata" Bits (The "aARW" in your string) a (read_attributes): Ability to see basic stat(2) info (size, timestamps). A (write_attributes): Ability to change timestamps (essential for the touch command). R (read_xattr): Ability to read extended attributes (used heavily by macOS for metadata). W (write_xattr...

Samba Guest config with ZFS

This configuration allows anonymous "Guest" access to a specific folder while ensuring all files are owned by a restricted local service account. This is ideal for media libraries (audiobooks, movies) on a trusted home network. 1. FreeBSD System Identity (User & Group) Create a dedicated group and a "no-login" service account to handle guest traffic. bash # Create the shared group sudo pw groupadd smbgrp # Create the guest user (no home directory, no shell access) sudo pw useradd smbguest -c "Samba Guest Account" -d /nonexistent -s /usr/sbin/nologin -g smbgrp # Add your primary administrative user to the group sudo pw groupmod smbgrp -m <YOUR_ADMIN_USER> Use code with caution. 2. ZFS Dataset Tuning Set these properties to ensure ZFS manages permissions via inheritance rather than letting individual apps strip them. bash # Replace 'zpool/dataset' with your actual ZFS dataset path sudo zfs set aclinherit=passthrough zpool/dataset sudo zfs s...

DIff btrfs snapshots for package installation changes

 To view the changes after a package installation without using Snapper, you need to manually create read-only Btrfs snapshots of your system's root subvolume before and after the dnf transaction, then use the btrfs send -p command with a pipe to see the file differences. A dedicated tool called btrfs-diff may also be available in your distribution's repositories or as a script online.  Prerequisites You must be using Btrfs as your root filesystem. You need sufficient disk space for the snapshots (snapshots are space-efficient as they only store the changes, not full copies). You'll need root privileges.  Method 1: Using btrfs send -p This method leverages Btrfs's incremental backup feature to list changed files.  Create a pre-installation snapshot: Before running your dnf command, create a read-only snapshot of your root subvolume. bash sudo btrfs subvolume snapshot -r / pre_install_snapshot Install your package: Proceed with your package installation, for example: ...

Change Fedora Silverblue automatic updates to check

Set the AutomaticUpdatePolicy to check in /etc/rpm-ostreed.conf: [Daemon] AutomaticUpdatePolicy=check Then reload the service: sudo rpm-ostree reload Enable the timer if not already active: sudo systemctl enable rpm-ostreed-automatic.timer --now This configures the system to check for updates automatically and display them in rpm-ostree status, but does not download or apply them.  You’ll see notifications about available updates, including CVEs, without any automatic downloading. 

Set up ISOs for VMs

  sudo ln -s /path/to/your/image.iso /var/lib/libvirt/images/    Ensure the target path is accessible to the qemu user (e.g., by setting appropriate ownership and permissions). 

Add VMs to Fedora Atomic

sudo rpm-ostree install libvirt libvirt-daemon-config-network libvirt-daemon-kvm qemu-kvm virt-manager virt-viewer systemctl reboot sudo systemctl enable --now libvirtd sudo grep -E '^libvirt:' /usr/lib/group | sudo tee -a /etc/group sudo usermod -a -G libvirt $USER sudo grep -E '^qemu:' /usr/lib/group | sudo tee -a /etc/group sudo usermod -aG qemu tim

Disable SmartScan in Windows Sandbox

Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableSmartScreen" -Type DWord -Value 0 If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter")) {     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" -Force | Out-Null } Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" -Name "EnabledV9" -Type DWord -Value 0

Rsync specific files

rsync -av --files-from=<(find /SOURCE/ -type f   -newer ~/touched_file | cut -d '/' -f 6) /SOURCE/ /TARGET

MacOS Convert PC Menu Key to Command

hidutil property --set '{"UserKeyMapping":[ { "HIDKeyboardModifierMappingSrc": 0x700000065, "HIDKeyboardModifierMappingDst": 0x7000000E7 } ]}'

MacOS VNC Screensaver fix

defaults write /Library/Preferences/com.apple.PowerManagement.{UID}.plist "AC Power" -dict-add "System Sleep Timer" 0 defaults write /Library/Preferences/com.apple.PowerManagement.{UID}.plist "AC Power" -dict-add "Display Sleep Timer" 0

Tumbleweed post install.

  hostnamectl set-hostname name zypper install -t pattern devel_basis zypper install cmake

Acer Aspire E15 grub fix

Taken from:  https://askubuntu.com/a/630662 Recently, I bought an Acer Aspire ES1-512 for a college course. As it happens this course requires the students to use Ubuntu. After several unsuccessful attempts to install Ubuntu alongside Windows. I believe I have an answer that allows you to install Ubuntu 14.04.2 alongside Windows 8.1 on an Acer Aspire ES1-512. Some of the steps are from memory, so if something doesn't work please let me know. Steps for Installing Ubuntu: Turn on the laptop and press F2 as soon as you see the "Acer Explore Beyond Limits" screen. This will take you into the UEFI/BIOS screen. If this is the first time you have entered the UEFI/BIOS section there are some adjustments that need to be made. Using the cursor keys highlight the menu item "Main." Network Boot: [Disabled] F12 Boot Menu: [Enabled] D2D Recovery: [Enabled] Wake on LAN: [Disabled] SATA Mode: [AHCI Mode] Touchpad: [Advanced] xHCI Support: [Enabled] Cursor over to the "Secu...

Dearpygui resizable table

Resizable table using main window resize as redraw trigger. Create an item_resize_handler that calls the table redraw, and bind the main window to it. import dearpygui.dearpygui as dpg import random import string DEBUG = 1 def generate_entries():     entries = []     for x in range(1, 10):         entry = {}         for y in ["A", "B", "C", "D", "E"]:             entry[y] = "".join(random.SystemRandom().choices(string.ascii_uppercase, k=6))         entries.append(entry)     return entries def draw_entry_table(parent, entries):     if dpg.does_item_exist("entry_table"):         dpg.delete_item("entry_table", children_only=False)        table = dpg.add_table(         tag="entry_table",         header_row=True,         parent=parent,         re...

Local package cache setup

 Opensuse: uses squid. /etc/sysconfig/proxy PROXY_ENABLED="yes" HTTP_PROXY="http://192.168.1.118:3128/" Ubuntu: uses apt-cacher-ng. /etc/apt/apt.conf.d/02proxy Acquire::http { Proxy "http://fileserv:3142"; }; Arch: uses nginx. /etc/pacman.d/mirrorlist Server = http://fileserv:8080/archlinux/$repo/os/$arch

Python environment

asdf python poetry python3 -m pip install --user pipx python3 -m pipx ensurepath pipx install black pipx install mypy pipx install flake8

Platformio Config

[env:nodemcuv2_client] platform = espressif8266 board = nodemcuv2 framework = arduino upload_port = COM11 monitor_port = COM11 monitor_speed = 115200 build_flags = -D CLIENT -save-temps=obj -fverbose-asm  ;-D L_DEBUG [env:nodemcuv2_server] platform = espressif8266 board = nodemcuv2 framework = arduino upload_port = COM8 monitor_port = COM8 monitor_speed = 115200 build_flags = -D SERVER  ;-D L_DEBUG

Pktmon commands

pktmon filter add -p 4120 pktmon start --etw -m real-time pktmon filter remove ncat -lnuvx -p 4120

Update calibre server

service calibre stop rsync -av --no-p --modify-window=2 /Volumes/Local/ebooks/Calibre\ Library/ /Volumes/ebooks/Calibre_Library /

Poetry and Docker

poetry install --no-dev poetry shell pip list --format=freeze > requirements.txt Delete project from requirements.txt. Update Dockerfile. Delete any existing containers. docker build -t command_name .

Vim tips

Pad lines with spaces:  : %s/.*/\=printf('%-63s', submatch(0))

Opensuse Leap to Tumbleweed

 Edit /etc/sysconfig/proxy. zypper up zypper lr zypper mr -d repo-backports-update zypper mr -d repo-sle-update zypper lr mkdir /etc/zypp/repos.d/old mv /etc/zypp/repos.d/*.repo* /etc/zypp/repos.d/old zypper ar -f -c http://download.opensuse.org/tumbleweed/repo/oss repo-oss zypper ar -f -c http://download.opensuse.org/tumbleweed/repo/non-oss repo-non-oss zypper ar -f -c http://download.opensuse.org/tumbleweed/repo/debug repo-debug zypper ar -f -c http://download.opensuse.org/update/tumbleweed/ repo-update reboot to level 3. zypper cc -a && zypper ref && zypper dup --allow-vendor-change rpm --import https://dl.google.com/linux/linux_signing_key.pub zypper addrepo https://dl.google.com/linux/chrome/rpm/stable/x86_64 Google-Chrome zypper ref zypper install google-chrome-stable rpm --import https://packages.microsoft.com/keys/microsoft.asc zypper addrepo https://packages.microsoft.com/yumrepos/vscode vscode zypper ref zypper install code

Figlet temp command

  watch -n 15 "curl -s basement:4455/temp?params=0 | grep -P -o '\d\d\.\d\d' | figlet -w 120 -d /usr/share/figlet/contributed/ -f doh"

C Notes

#include <stdio.h> #include <string.h> int main(void) {     char f[] = "++++";     char c;     char m[11];     int i;     int o_size = 4;     int i_size = 1;          scanf("%c", &c);     memset(m, c, 10);     m[10] = 0;     for (i = 0; i < 5; i++) {         printf("%.*s%.*s%.*s\n", o_size, f, i_size, m, o_size, f);         o_size -= 1;         i_size += 2;     }     return 0; } e.g.: ends_with(filename, ".pdf.epub.mobi"); int ends_with(const char *string, const char *tail) {     const char *s1;     const char *s2;     if (!*tail)         return 1;     if (!*string)         return 0;     for (s1 = string; *s1; ++s1);     for (s2 = tail; *s2; ++s2);     if (s1 - string ...

Crystal notes

(0..10).step(2) do |x|      puts x end --- x = ["the","end","game"] x[0..1].each() do |y|      puts y end --- # times method 2.times do |n|      puts n end --- # upto method 0.upto(1) do |n|      puts n end --- For ranges it's simple: x..y defines a range from x to y inclusive and x...y defines a range from x to y exclusive. So if you want the same behavior as times use 0...n. For x.upto(y) there is only one version which will iterate upto and including y.

SQLite3 Regex

sudo apt install sqlite3-pcre sqlite3 /data/DBases/2022-01-housetemps.db -cmd ".load /usr/lib/sqlite3/pcre.so" "SELECT bed,downstairs,InsertedDatetime FROM housetemps WHERE InsertedDatetime REGEXP '\d\d\d\d-\d\d-1[4,5]';"

Nodemcu flash commands

esptool.py.exe erase_flash esptool.py --baud 460800 write_flash --flash_size=4MB -fm=dout 0 esp8266-20210902-2MB-v1.17.bin

Setup housemon

 Based on Ubuntu 20.04: sudo ufw status sudo ufw default allow outgoing sudo ufw default deny incoming sudo ufw allow ssh sudo ufw enable sudo ufw status sudo apt-get install fail2ban sudo service fail2ban status sudo vim /etc/fail2ban/jail.local [DEFAULT]  bantime = 8h  ignoreip = 127.0.0.1/8 xxx.xxx.xxx.xxx  ignoreself = true  [sshd]  enabled = true  port = 22  filter = sshd  logpath = /var/log/auth.log  maxretry = 3 sudo systemctl restart fail2ban sudo iptables -L f2b-sshd --line-numbers sudo service fail2ban status sudo iptables -L f2b-sshd --line-numbers sudo iptables -L Install python via asdf. Install poetry. Install nginx. Copy hm_server.tgz to server. Untar hm_server.tgz in /opt/services. sudo chown -R userx:userx /opt/services/hm_server cp configs/hm_server.conf /etc/nginx/conf.d cp configs/hm_server.service /etc/systemd/system/ Edit configs/hm_server.service for appropriate user. sudo usermod -a -G www-data userx cd /opt/servi...

Syncthing install Ubuntu 20.4

curl -s https://syncthing.net/release-key.txt | sudo apt-key add - echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list sudo apt-get install apt-transport-https sudo apt-get update sudo apt-get install syncthing sudo apt install daemonize For WSL 2: (issue in admin Powershell) netsh interface portproxy add v4tov4 listenport=22000 listenaddress=0.0.0.0 connectport=22000 connectaddress=xxx.xxx.xxx.xxx netsh interface portproxy add v4tov4 listenport=21027 listenaddress=0.0.0.0 connectport=21027 connectaddress=xxx.xxx.xxx.xxx connectaddress from ip addr in WSL 2. Open both ports for UDP and TCP in Defender.