Skip to content

Instantly share code, notes, and snippets.

View christian-korneck's full-sized avatar
💭
I may be slow to respond.

Christian Korneck christian-korneck

💭
I may be slow to respond.
View GitHub Profile
@christian-korneck
christian-korneck / proxmox_vmlookup.md
Last active August 24, 2024 03:02
Proxmox vmlookup - nslookup but for Proxmox VMs - Proxmox get VM IP

vmlookup - get IP(s) for Proxmox VM name

bash alias for a vmlookup command (nslookup but for Proxmox). Uses qm and jq.

install

put in .bashrc:

function vmlookup () {
@christian-korneck
christian-korneck / win11_compat.md
Last active November 8, 2024 00:04
Win11 install - bypass compatibility checks (no TPM, no UEFI, etc)

in Windows setup: SHIFT + F10 opens a cmd shell. Then regedit.

[HKEY_LOCAL_MACHINE\SYSTEM\Setup\LabConfig]
"BypassTPMCheck"=dword:00000001
"BypassSecureBootCheck"=dword:00000001
"BypassRAMCheck"=dword:00000001
"BypassStorageCheck"=dword:00000001
"BypassCPUCheck"=dword:00000001
"BypassDiskCheck"=dword:00000001
@christian-korneck
christian-korneck / powershell-grep.md
Last active April 14, 2024 12:54
Unix-like destructive grep in Powershell

Powershell pure text grep (grepp)

what

A grep command (grepp) in Powershell that lets you grep for a string in the text that would usually be printed in the terminal (not some other representation of the data). Output is a string, not a pipeline anymore - thus destructive.

why

To quickly grep through shell output without having to do where-object gymnastics.

@christian-korneck
christian-korneck / win11_boot_into_recoverymode.md
Last active March 24, 2024 10:56
windows 11: boot into recovery mode

A way to reboot into recovery mode (Windows boots into GUI with only minimal drivers loaded):

  • bcdedit /set "{current}" safeboot minimal
  • reboot. Machine will boot into recovery mode.
  • in recovery mode, disable it before rebooting: bcdedit /deletevalue "{current}" safeboot
@christian-korneck
christian-korneck / virtmanager_win11_sata_to_virtio_migration.md
Last active March 24, 2024 10:50
virtmanager: switch windows vm boot disk from sata to virtio

I have a Windows 11 23H2 VM with a SATA boot disk running on virtmanager (KVM/Qemu) on Fedora 39 that I want to convert to a virtio disk.

  • in windows install virtio guest tools (download)
  • create cd drive and attach virtio iso (download)
  • shutdown vm
  • in virtmanager preferences, enable xml editing
  • in the vm disk settings, go to the xml tab, backup the existing xml and change it:

old:

# make a query at this point in time
$ promtool query instant http://localhost:9090 '{job=~".+"}'
up{instance="localhost:9090", job="prometheus"} => 1 @[1690724237.225]
go_memstats_alloc_bytes{instance="localhost:9090", job="prometheus"} => 29046776 @[1690724237.225]
...
# query a metric for the time range between two Unix timestamp
$ promtool query range --start 1690724700 --end 1690725307 --step 1m http://localhost:9090 \
'go_memstats_alloc_bytes{job="prometheus"}'
23215032 @[1690724700]
@christian-korneck
christian-korneck / podman_fix_unprivileged_k8s.md
Created July 24, 2023 00:52
fix podman error `setting value of extended attribute "security.ima" on "/catatonit": operation not permitted`

Podman error setting value of extended attribute "security.ima" on "/catatonit": operation not permitted:

example error message (when trying to run a k8s yaml as unpriv'ed user)

[user@host]$ podman kube play boom.yml
Error: building local pause image: building at STEP "COPY /usr/libexec/podman/catatonit /catatonit": storing "/usr/libexec/podman/catatonit": error during bulk transfer for copier.request{Request:"PUT", Root:"/", preservedRoot:"/home/opc/.local/share/containers/storage/overlay/ba320139a68ad5418cef299dd724dc9fc53737c8a3cba1ad9d30c3a25dfcca45/merged", rootPrefix:"/home/opc/.local/share/containers/storage/overlay/ba320139a68ad5418cef299dd724dc9fc53737c8a3cba1ad9d30c3a25dfcca45/merged", Directory:"/", preservedDirectory:"/home/opc/.local/share/containers/storage/overlay/ba320139a68ad5418cef299dd724dc9fc53737c8a3cba1ad9d30c3a25dfcca45/merged", Globs:[]string{}, preservedGlobs:[]string{}, StatOptions:copier.StatOptions{CheckForArchives:false, Excludes:[]string(nil)}, GetOptions:copier.GetOpt
@christian-korneck
christian-korneck / lfsbintrack.md
Last active May 31, 2023 16:02
git lfs - track all binary files in a folder with git-lfs - `lfsbintrack`
# as demo data, let's use a copy of the alpine rootfs (which contains both binary and text files)
$ wget https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/aarch64/alpine-minirootfs-3.18.0-aarch64.tar.gz
$ tar xf alpine-minirootfs-3.18.0-aarch64.tar.gz
$ ls
/bin
/etc
...

# make this dir a git repo and enable git-lfs
@christian-korneck
christian-korneck / python3.7-go-ubuntu20.04-arm64.md
Last active May 30, 2023 02:08
python3.7-go-ubuntu20.04-arm64
# we're on Ubuntu 20.04 on arm64
$ uname -a
...
Linux [...] 5.15.0 #40~20.04.1-Ubuntu [...] aarch64 [...]
...

# install build tools
$ apt-get -y update && apt-get -y install curl build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev pkg-config
# install latest Go