Skip to content

Instantly share code, notes, and snippets.

View thiscantbeserious's full-sized avatar
👾
I may be slow to respond.

Simon thiscantbeserious

👾
I may be slow to respond.
  • Germany
View GitHub Profile
@thiscantbeserious
thiscantbeserious / qvm.sh
Last active November 1, 2025 12:12
qvm command: unmanaged QEMU launcher with multi raw --disk support for TrueNAS Scale
#!/bin/zsh
# using this in my .zshrc file of the truenas_scale admin as an aliased command
qvm() {
local DISKS=()
local ISO=""
local BRIDGE=""
local VNC_DISP="2"
local VNC_BIND="0.0.0.0"
local MEM="1024"
local CPUS="1"
@thiscantbeserious
thiscantbeserious / mover
Last active November 1, 2025 23:25
Mover script for MergerFS with Bidirectional Sync and Tiered Percentage keep ...
#!/usr/bin/env bash
# mover: bidirectional sync + retention-mode move/trim.
# - Sync: --sync [--exclude PATTERN ...] [--authoritative-delete src|dst] [--authoritative-grace-sec SEC]
# - Retain mode: --move --move-path P [--retain-pct N] [--retain-min-bytes BYTES]
# [--ensure-dst-superset] [--max-trim-bytes BYTES]
# Common safety: --min-age-sec SEC, --skip-open (auto: fuser→lsof→/proc), MergerFS branch awareness.
# Locking: per pair/direction/global via --lock-scope, lock files in --lock-dir (default /var/lock/mover)
set -euo pipefail
export LC_ALL=C
@thiscantbeserious
thiscantbeserious / omv-auto-import-mounts
Created October 14, 2025 15:02
Detect mounted filesystems and add missing <mntent> entries to OMV's config.xml. Writes to a temp copy, validates XML, then atomically replaces the real file. Default: DRY-RUN (prints). Use --apply to write, --deploy to refresh OMV.
#!/usr/bin/env bash
set -Eeuo pipefail
# omv-auto-import-mounts (safe XML edition)
# Detect mounted filesystems and add missing <mntent> entries to OMV's config.xml.
# Writes to a temp copy, validates XML, then atomically replaces the real file.
# Default: DRY-RUN (prints). Use --apply to write, --deploy to refresh OMV.
OMV_XML="/etc/openmediavault/config.xml"
@thiscantbeserious
thiscantbeserious / fio_stability_loop.sh
Last active October 10, 2025 18:37
fio stress test to test a whole block device in a loop and catching kernel & smart errors in-between to proof if the SATA bridge and Kernel is stable
#!/usr/bin/env bash
# Endless SATA/UASP stability soak with fio + SMART (robust shutdown)
# DESTROYS DATA on the target device. Use a WHOLE device (e.g. /dev/sdb, not /dev/sdb1).
# Usage: sudo ./fio_stability_loop.sh /dev/sdX
set -euo pipefail
#====================== configuration ======================
DEVICE="${1:-}" # REQUIRED whole block device
SEQ_DURATION=300 # 5m seq read/write
RAND_DURATION=300 # 5m 4k 70/30
@thiscantbeserious
thiscantbeserious / translate_missing.py
Last active January 26, 2024 17:19
Compare two translation bundles and translate missing keys via deep_translator (Google) by key = value || value logic ...
import json
import requests
import concurrent.futures
import os
import time
from tqdm import tqdm
from deep_translator import GoogleTranslator
def load_json_file(file_path):
@thiscantbeserious
thiscantbeserious / gmail_extractor.py
Last active March 5, 2026 10:57
OpenSource Gmail Takeout MBox extractor (with Label to Folder structure into seperate .eml files)
#!/usr/bin/env python3
# This will extract an mbox in seperate eml files from google takeout (manually unzip it first)
# Will try to create a folder structure based on the labels
# Emails will be formatted like this:
# 221104_110405_sender@mail.com_subject_in_45_chars.eml
# e.g. ./Inbox/2022/10/Special/221104_110405_sender@mail.com_subject_in_45_chars.eml
#
# Should work for all languages, but has been tested on German with a 14 GB large mbox file (with 169039 messages)
# Result: 169039 messages processed, 167591 messages saved