Skip to content

Instantly share code, notes, and snippets.

/*
Designed for makemkvcon running inside a Docker container writing MKV files to /output.
The problem:
makemkvcon creates MKV files with the maximum of 0644 file mode. The current umask limits the maximum file mode, but
does not itself increase permissions (only decreases). This means when a user has a umask of 0002 and touches a new
file, it will have permissions of 664. However when makemkvcon runs MKV files will have permissions of 644.
The solution:
This code compiles into a shared object which is loaded at the beginning of makemkvcon's execution. This will
@Robpol86
Robpol86 / gist:6d56e715cb755f06a0984e8cb4ee5e56
Created November 11, 2021 20:15
find /sys/devices/platform -type f
/sys/devices/platform/DIAG_CMD.0/power/control
/sys/devices/platform/DIAG_CMD.0/power/runtime_active_time
/sys/devices/platform/DIAG_CMD.0/power/autosuspend_delay_ms
/sys/devices/platform/DIAG_CMD.0/power/runtime_status
/sys/devices/platform/DIAG_CMD.0/power/runtime_suspended_time
/sys/devices/platform/DIAG_CMD.0/driver_override
/sys/devices/platform/DIAG_CMD.0/modalias
/sys/devices/platform/DIAG_CMD.0/uevent
/sys/devices/platform/SVC00000009:00000002.1/power/control
/sys/devices/platform/SVC00000009:00000002.1/power/runtime_active_time
@Robpol86
Robpol86 / ppd.yml
Created April 20, 2022 20:32
fromJson trick for GitHub Actions
name: Parallel Poetry Discovery
on:
push: {branches-ignore: ["**"]}
env:
COMMENT_PFX: "# RPOOLEY "
jobs:

Slots Tool

I'm running TrueNAS-SCALE-23.10.0.1 on an old Supermicro motherboard in a Genesys S208B-TWIN-ITX-12G chassis. This chassis has hot swappable 3.5" SAS drive bays oriented in two rows of four drives. My storage drives are connected through an LSI Broadcom SAS 9300-8i HBA. My HBA does not support the LOCATE feature, so I cannot blink LEDs to locate hard drives to replace.

In order to quickly associate which hard drive in TrueNAS corresponds to what physical slot it is stored in I wrote a script. This script uses the description column of TrueNAS's Storage Disks table to label what slot a particular drive is installed in. One caveat with this script is I must run it after every reboot or after I install/remove a hard drive, so running sudo slots is now at the beginning of my disk repalcement workflows.

Installation

Copy slots.sh (attached below) to /usr/local/sbin/slots and then run sudo chmod +x /usr/local/sbin/slots. Afterward you will be able to use the tool anywhere by running `sudo