Skip to content

Instantly share code, notes, and snippets.

View tdewin's full-sized avatar

tdewin

View GitHub Profile
@tdewin
tdewin / k3s-openebs-zfs-kasten-demo.md
Last active January 3, 2026 19:50
K3S demo with openebs, kasten and stock-demo

Main notes

Node spec 4 core / 16 GB RAM 50GB OS / 50 GB ZFS

K3 Setup

Install K3S

ubuntu escalation (or add sudo at the front)

# Generic
lsblk -f --json | jq '.blockdevices[] | select((.fstype == null) and (.children == null)) | {name:.name,available:.fsavail}'
# Looking for VMware disks
lsblk -O -J | jq '.blockdevices[] | select(.vendor == "VMware " and (.children == null)) | {name:.path,size:.size}'
# I feel lucky
TGTDISK=$(lsblk -O -J | jq -r '.blockdevices[] | select(.vendor == "VMware " and (.children == null)) | .path')
@tdewin
tdewin / support-backup.ps1
Last active September 16, 2022 08:39
Backup of Veeam Backup & Replication Database
$bpath = "c:\temp\"
New-Item -Type Directory $bpath -ErrorAction ignore
$datestr = ("{0}" -f (Get-Date -Format "yyyyMMdd-hhmmss"))
$bdatepath = join-path -Path $bpath -ChildPath ("veeambackup-{0}" -f $datestr)
New-Item -Type Directory $bdatepath
$props = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Veeam\Veeam Backup and Replication\'
$fpath = join-path -Path $bdatepath -childpath ("sqldump-{0}-{1}.bak" -f $props.SqlDatabaseName,$datestr)
Backup-SqlDatabase -ServerInstance ("{0}\{1}" -f $props.SqlServerName,$props.SqlInstanceName) -Database $props.SqlDatabaseName -BackupFile $fpath
@tdewin
tdewin / hex-to-inkscape-gpl.ps1
Last active February 16, 2023 09:31
Convert a text ($colors) full of hex colors to a GIMP Palette/gpl file, for Inkscape
$colors = @"
#333333
#222222
#FFFFFF #444433
"@
$theme = "mytheme"
$lns = @("GIMP Palette","Name: $theme","#")
$cregx = [Regex]::new("#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})[^a-fA-F0-9]")
@tdewin
tdewin / poorman-postman.ps1
Last active December 1, 2022 10:13
Poor man postman script with recording functionality
$global:headers = @{authorization="bearer $token"}
$h = $global:headers
$global:recordfile = "dev\record.md"
$global:replaces = @(@{m="http://sensistivehostname";r="http://[host]"},@{m="bearer .*";r="bearer [token]"})
function redact {
param($text)
$global:replaces | % {
$text = $text -replace $_.m,$_.r
@tdewin
tdewin / clumpsyarchitect.py
Last active December 20, 2022 23:28
very basic architect for blender (3.0 tested)
import bpy
wallheight = 2.5
wallwidth = 0.3
def xyadd(c,n,wallwidth):
dx = n[0] - c[0]
dy = n[1] - c[1]
@tdewin
tdewin / autoinstall.sh
Last active October 16, 2023 10:03
k3s autoinstall aws t3 with zfs (2 disks of 50gb)
#!/bin/sh
ZFSDISK=/dev/nvme1n1
apt-get update -y
curl -sfL https://get.k3s.io | sh -
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
git clone https://github.com/ahmetb/kubectx /opt/kubectx
ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx
ln -s /opt/kubectx/kubens /usr/local/bin/kubens
apt install zfsutils-linux jq -y
@tdewin
tdewin / stock-on-k3s.sh
Created March 16, 2023 10:57
install stock-demo on k3s
#!/bin/sh
kubectl create ns stock-demo
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install -n stock-demo --set global.postgresql.auth.username=root --set global.postgresql.auth.password=notsecure --set global.postgresql.auth.database=stock stockdb bitnami/postgresql
curl https://raw.githubusercontent.com/tdewin/stock-demo/main/kubernetes/deployment.yaml | sed s#tdewin/stock-demo#tdewin/stock-demo:vnext# | kubectl apply -n stock-demo -f -
curl https://raw.githubusercontent.com/tdewin/stock-demo/main/kubernetes/svc.yaml | sed s/^.*externalTrafficPolicy.*$//g | sed s/LoadBalancer/ClusterIP/g | kubectl apply -n stock-demo -f -
kubectl get svc -n stock-demo
@tdewin
tdewin / k10multiclusterdownload.sh
Created March 16, 2023 11:41
k10 multi cluster download latest release
#!/bin/sh
curl https://api.github.com/repos/kastenhq/external-tools/releases | jq -r '.[].assets[]."browser_download_url" | select (. | contains("linux_amd64.tar"))'
@tdewin
tdewin / autoinstall-support-services.sh
Last active May 24, 2023 07:05
k3s support services
#!/bin/sh
apt-get -y update
DEBIAN_FRONTEND=noninteractive apt-get -y install podman
mkdir -p /minio/data
podman run -d --name minio -v /minio/data:/data -e MINIO_ROOT_USER=bert -e MINIO_ROOT_PASSWORD=changeme --restart=always -p 9000:9000 -p 9001:9001 docker.io/minio/minio server /data --console-address ":9001"