Skip to content

Instantly share code, notes, and snippets.

@rgl
rgl / proxmox-set-vm-tpm-state.py
Created November 27, 2023 19:00
set the tpm state of a proxmox vm
import json
import requests
import urllib3
api_url = 'https://192.168.1.21:8006/api2/json'
username = 'root@pam'
password = 'PASSWORD'
node = 'pve'
vm_id = 105
@rgl
rgl / wip-talos-poke.md
Created August 20, 2022 16:49
wip talos poke
kubectl -n kube-system delete pod/poke
kubectl -n kube-system apply -f - <<'EOF'
# see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#pod-v1-core
apiVersion: v1
kind: Pod
metadata:
  name: poke
spec:
  nodeSelector:
@rgl
rgl / mbr-to-gpt.md
Last active March 24, 2023 04:27
BIOS: Convert from MBR to GTP

MBR to GPT Conversion

This is a three step procedure:

  1. Use gdisk to convert the partition type from MBR to GPT (without data loss).
  2. Use gdisk to add a new BIOS boot partition (EF02 type).
  3. Use grub-install to install the boot loader into the new BIOS boot partition.

MBR to GPT

@rgl
rgl / uup-dump-scrape.js
Last active March 28, 2023 14:24
scrape uupdump.net for a windows server 2022 iso creation pack
// scrape https://uupdump.net/known.php?q=feature+update+server+operating+system+20348+amd64
// NB there's a better way, using the API, e.g. https://api.uupdump.net/listid.php?search=feature+update+server+operating+system+20348+amd64
// see https://github.com/uup-dump/json-api
// see https://github.com/uup-dump/website/blob/master/known.php
// see https://github.com/uup-dump/website/blob/master/get.php
// each scraped line is a tab separated string with 4 fields alike:
// "Feature update to Microsoft server operating system, version 21H2 (20348.643) amd64\tx64\t2022-04-12 17:04:01 UTC\tb8e204fd-4e2b-4722-95d7-aad633ad7379"
const updateIdEl = Array.prototype.find.call(document.querySelectorAll('th'), el => el.innerText == "Update ID");
const buildsTableEl = updateIdEl.parentElement.parentElement.parentElement;
const builds = buildsTableEl.querySelector('tbody').innerText
@rgl
rgl / rke2-windows.md
Last active January 28, 2023 12:51
rke2 windows notes
root@pandora:~# kubectl get servers -o yaml
apiVersion: v1
items:
- apiVersion: metal.sidero.dev/v1alpha1
  kind: Server
  metadata:
    creationTimestamp: "2021-07-16T05:05:21Z"
    finalizers:
    - storage.finalizers.server.k8s.io
@rgl
rgl / talosctl-cluster-create.md
Last active July 15, 2021 16:51
talosctl cluster create fails with error getting family information for ethtool: netlink receive: no such file or directory

This is how I tried to execute talosctl cluster create in a Ubuntu 20.04 host.

Install ethtool:

# apt-get install -y ethtool

# ethtool eth1 # with the virtio network interface type
Settings for eth1:
	Supported ports: [ ]
@rgl
rgl / Find-OpenHandle.ps1
Created July 9, 2021 11:01
uses sysinternals handle.exe to find/list the current open handles
function Find-OpenHandle([string]$Filter = '') {
# handle.exe returns all the open files grouped by process as:
# ------------------------------------------------------------------------------
# System pid: 4 \<unable to open process>
# 720: Section \Win32kCrossSessionGlobals
# ------------------------------------------------------------------------------
# svchost.exe pid: 1208 NT AUTHORITY\SYSTEM
# 198: File (R-D) C:\Windows\System32\en-US\svchost.exe.mui
# the first line has the following fields:
# svchost.exe pid: 1208 NT AUTHORITY\SYSTEM
@rgl
rgl / show-chocolatey-packages-parameters.md
Created January 27, 2021 10:28
show all the chocolatey packages installation parameters / arguments
# see https://github.com/chocolatey/choco/issues/1310
Add-Type -AssemblyName System.Security
Get-ChildItem `
    -Path "$env:ChocolateyInstall\.chocolatey" `
    -Filter .arguments `
    -Recurse `
    | ForEach-Object {
        $name = $_.Directory.BaseName
        $data = [System.Text.Encoding]::UTF8.GetString(
@rgl
rgl / skopeo.md
Created January 14, 2021 11:14
skokeo

This is a quick&dirty way to get started with skopeo in Ubuntu 20.04.

Install go.

Install skopeo dependencies:

sudo apt-get install -y git-core build-essential pkg-config libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev