Skip to content

Instantly share code, notes, and snippets.

@henri
henri / create-vm.bash
Last active August 14, 2026 05:13
Quickly Setup KVM/QEMU libvert VM - Great for Testing
#!/usr/bin/env bash
#
#
# (C)2026 Henri Shustak, All Rights Reserved
# Licence : GNU GPLv3 or later
#
#
# new-vm.bash
# Interactively creates a KVM/QEMU libvirt VM with a configurable
# boot mode (BIOS or UEFI), generic "linux2022" OS variant, a
@henri
henri / walk_proc_to_detect_trace.bash
Last active July 27, 2026 22:34
linux detect activated strace
#!/bin/bash
# Detect processes being ptraced via /proc/<pid>/status
# I am sure there are better ways!
while true; do
for pid in /proc/[0-9]*/status; do
tracer=$(grep -m1 "^TracerPid:" "$pid" 2>/dev/null | awk '{print $2}')
if [[ -n "$tracer" && "$tracer" != "0" ]]; then
target_pid=$(echo "$pid" | grep -oP '\d+')
tracer_comm=$(cat /proc/${tracer}/comm 2>/dev/null)
# set existing process to be in 'Best Effort' class with priority 6 in that class
# within the 'Best Effort' class priority 0 is highest and 7 is the lowest
ionice -c 2 -n 6 -p <PID>
# check what values are set for an existing process
ionice -p <PID>
@henri
henri / badblocks_cheat_sheet.txt
Last active July 27, 2026 22:35
badblocks cheatsheet
# run a scan and create a log file badblocks.log
sudo badblocks -v -s -o badblocks.log /dev/sdX # assumes sdX is your raw device
@henri
henri / cgroup_cheatsheet.txt
Created April 22, 2026 03:31
linux cgroup cheat sheet
# full process tree organized by cgroup
systemd-cgls
# resource usage per cgroup
systemd-cgtop
# view cgroup filesystem
ls /sys/fs/cgroup/
@henri
henri / grub_linux_identify_UEFI_not_running_macOS.txt
Created April 5, 2026 06:59
Display Power Issues on Linux Mint Cinnamon (iMac / Apple Computers)
# resolve power management issues on intel mac computers running LINUX
#
# add the acpi_osi=!Darwin Kernel Parameter
#
# edit GRUB:
sudo nano /etc/default/grub
# find the line GRUB_CMDLINE_LINUX_DEFAULT and add 'acpi_osi=!Darwin', 'quiet' and 'spash' paraemters example follows :
GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi=!Darwin quiet splash"
@henri
henri / README.md
Created March 26, 2026 04:49 — forked from joaopalmeiro/README.md
Metadata badges

Code style: black

@henri
henri / nvme_cheat_sheet.txt
Last active July 27, 2026 22:36
nvme cheat sheet
# initiate a short self-test
sudo nvme device-self-test /dev/nvme0 -s 1
# realtime view
sudo nvme device-self-test /dev/nvme0 --dry-run 2>/dev/null || sudo nvme self-test-log /dev/nvme0
@henri
henri / ghostty_cheatsheet.txt
Last active February 26, 2026 01:32
ghostty cheat sheet
# list key binds
ghostty +list-keybinds
# helpful links
https://ghostty.org/docs/config/keybind/reference
@henri
henri / WireGuard iOS HOWTO.md
Created December 15, 2025 22:32 — forked from 4np/WireGuard iOS HOWTO.md
Setting up WireGuard to secure iPhone traffic

WireGuard

How to set up WireGuard as an iOS VPN configuration in order to tunnel all traffic from an iOS or iPadOS device through a Linux server.

While there are many configurations possible, my intentation was to secure the traffic from my iOS device by routing it securely through a Linux server. As such, this HowTo will show you how to set-up an initial working configuration, which you can customize afterward.

Most likely things will be missing, such as how to configure the firewall or the init scripts on your Linux distribution. As it won't be possible to cover all Linux flavors this HowTo will attempt to give you a working WireGuard configuration, leaving it up to you to fill-in the blanks. Feel free to write a comment to touch upon your specific situation to help others that might stumble upon this HowTo :)

Note: In these configuration examples I use 10.8.0.1/24 and 10.8.0.2/24. However, as WireGuard IPs may not overlap your other network interfaces