Skip to content

Instantly share code, notes, and snippets.

@crpb
crpb / topre-104ub-linux-usb-fix.txt
Created December 31, 2024 10:58
TOPRE 104UB / 87U / XF111T0 / REALFORCE - NOT WORKING OUTSIDE OF BIOS
################################################################################
# TOPRE 104UB / 87U / XF111T0 / REALFORCE BREAKS DOWN AFTER BIOS
# And when replugging the keyboard it only lights up shortly and the log shows
# something like this:
#
# Dec 31 11:26:31 kernel: usb 1-8: unable to read config index 0 descriptor/start: -32
# Dec 31 11:26:31 kernel: usb 1-8: can't read configurations, error -32
# Dec 31 11:26:31 kernel: usb 1-8: unable to read config index 0 descriptor/start: -32
# Dec 31 11:26:31 kernel: usb 1-8: can't read configurations, error -32
# Dec 31 11:26:31 kernel: usb 1-8: unable to read config index 0 descriptor/start: -32
#!/bin/bash
#set -x
SCRIPT_BUILD=202411254
GROMOX_MAILDIR_PATH="$(grommunio-admin config get options.userPrefix)"
SOFTDELETE_TIMESTAMP=${SOFTDELETE_TIMESTAMP:-30d20h}
function TrapQuit {
local exitcode=0
@crpb
crpb / midclt.toml
Last active November 30, 2024 13:28
#truenas #midclt #pet #snippets
[[snippets]]
description = "truenas upgrade all jails to latest"
command = "midclt call jail.query |jq -r '.[]|.id' |while read -r jailid; do midclt call jail.update_to_latest_patch $jailid; done"
output = ""
[[snippets]]
description = "truenas snapshot task overview extended"
command = "midclt call pool.snapshottask.query |jq -r '.[]|[(.id|tostring),.dataset,.lifetime_unit,\"\\(.lifetime_value)\",.naming_schema,.schedule.minute + \" \" + .schedule.hour + \" \" + .schedule.dom + \" \" + .schedule.month + \" \" + .schedule.dow]|map(gsub(\"^\\\\s+|\\\\s+$\";\"\"))|@tsv' |sort"
output = ""
@crpb
crpb / diskspd.ps1
Last active June 4, 2024 00:27
DiskSpd auto download with drive and core cound selection
$DiskSpd = "$PSScriptRoot\DiskSpd\$($Env:PROCESSOR_ARCHITECTURE.ToLower())\diskspd.exe"
if ( -Not ( Test-Path $DiskSpd ) ) {
# Destination will be the directory of the script + 'DiskSpd'
$destdir = "$PSScriptRoot"
$tempdir = "$env:TEMP"
New-Item -Type Directory -Path $tempdir -ErrorAction Ignore
$file = "DiskSpd.ZIP"
$tempfile = Join-Path -Path "$tempdir" -ChildPath "$file"
Set-Location -Path $tempdir
$repo = "microsoft/diskspd"
@crpb
crpb / tmux-midclt
Last active June 6, 2023 04:26
helper to lookup some truenas midclt calls on the fly / also works w/o tmux / fzf required!
#!/usr/bin/env bash
# v=0.5 2023-06-06
# ~cb
#
# # TMUX
# cat << EOTMUX >> ~/.tmux.conf
# # TrueNAS MIDCLT-QUERYs
# bind-key C-t popup -E tmux-midclt
# EOTMUX
@crpb
crpb / zfsinst.sh
Last active September 10, 2022 12:42
minimal debian installation with zfs / one or two disks.. haven't tried with two disks yet.. attention, this script will destroy your data without any question :-)
#!/bin/sh
modprobe zfs || exit
apt-get update
apt-get install ntpdate jq --yes
ntpdate-debian
#zpool export -f bpool
#zpool export -f rpool
#swapoff --all
#mount |awk '/\/mnt/ {print $3}'|xargs -n 1 umount 2>/dev/null
@crpb
crpb / syncoid_cleanup.sh
Last active February 24, 2023 06:01
little script to keep the snapshot-count in check for my truenas. "frequently" went above ~10k as i replicate every hour. syncoid_cleanup.sh
#!/bin/sh
ROOT="p0/bak/home"
frequently=4
hourly=36
daily=30
monthly=3
_remove_old_snaps() {
COUNT=$(echo "{$1}" |wc -l)
#echo "COUNT: ${COUNT}"
if [ "$COUNT" -gt "$2" ]
## vim: filetype=sh
# FARBSPIELE #
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
function red { printf "${RED}$@${NC}\n" ; }
function green { printf "${GREEN}$@${NC}\n" ; }
@crpb
crpb / gen_hosts_yml.sh
Created May 21, 2022 04:44
ansible hosts.yaml generated from ssh_config files
#!/usr/bin/env bash
# Generate hosts.yaml from ssh_config-Includes
# Filename-Pattern "NNN_customer.ssh"
SRC="$HOME/git/ssh_config/*.ssh"
printf "all:\n children:\n"
for CONF in ${SRC}; do
BASE=$(basename "${CONF}")
GROUP=${BASE:4:-4}
HOSTS=$(awk '/^Host / {print $2}' "${CONF}"|sort|uniq)
printf ' %s:\n hosts:\n' "${GROUP}"
/*
* This combined file was created by the DataTables downloader builder:
* https://datatables.net/download
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#dt/dt-1.11.3/af-2.3.7
*
* Included libraries:
* DataTables 1.11.3, AutoFill 2.3.7