Skip to content

Instantly share code, notes, and snippets.

View TrooperT's full-sized avatar
🎉

Sam TrooperT

🎉
  • Dayton, OH, USA
View GitHub Profile
@kvaps
kvaps / node-bootstrup.sh
Created August 14, 2023 18:36
Add external kubeadm node to Talos cluster
VIP="192.168.100.5"
mkdir -p /etc/kubernetes/pki
talosctl -n "$VIP" cat /etc/kubernetes/kubeconfig-kubelet > /etc/kubernetes/kubelet.conf
talosctl -n "$VIP" cat /etc/kubernetes/bootstrap-kubeconfig > /etc/kubernetes/bootstrap-kubelet.conf
talosctl -n "$VIP" cat /etc/kubernetes/pki/ca.crt > /etc/kubernetes/pki/ca.crt
sed -i "/server:/ s|:.*|: https://${VIP}:6443|g" \
/etc/kubernetes/kubelet.conf \
/etc/kubernetes/bootstrap-kubelet.conf
func typeCache[T any](compute func(t reflect.Type) T) func(t reflect.Type) T {
cache := map[reflect.Type]T{}
return func(t reflect.Type) T {
if v, ok := cache[t]; ok {
return v
}
v := compute(t) // but compute cant recurse
cache[t] = v
return v
}
@usrbinkat
usrbinkat / README.md
Created July 5, 2022 16:45
Talos + Kubevirt Bare Metal & Nested Tenant Cluster

Scratch nodes WIP

talosctl gen config talos-kubevirt https://talos-kubevirt.home.arpa:6443 --additional-sans 192.168.1.70,talos-kubevirt --install-disk /dev/vda --output-dir $(pwd)/talos
❯ cat deploy.sh
#kubectl --kubeconfig $HOME/.kube/poweredge delete -f ./kubevirt/
#sleep 12
#kubectl --kubeconfig $HOME/.kube/poweredge apply -f ./kubevirt/

#sleep 120
@lucassperez
lucassperez / gist:bc04afa332c18ab708a084c1be1ff230
Created May 31, 2022 19:26
minimal zsh prompt with git colors
git_color() {
local git_status="$(git status 2> /dev/null)"
local output_styles=""
if [[ $git_status =~ "nothing to commit, working tree clean" ]]; then
# red
output_styles="9"
elif [[ $git_status =~ "nothing added to commit but untracked files present" ]]; then
# yellow
output_styles="11"

Vmware Tanzu Kubernetes Grid and VMware Telco Cloud Automation

Welcome! This is a series of quick guides to setting up dev/test/lab environment with Tanzu Kubernetes Grid and/or with VMware Telco Cloud Automation.

This isn't a replacement for the official documentation but rather is a curated, streamlined set of "how tos" from several locations based on my experiences.

@jpillora
jpillora / icloud-dl.sh
Created February 7, 2021 06:47
Download iCloud link from Terminal
#!/bin/bash
# given "https://www.icloud.com/iclouddrive/<ID>#<Filename>
ID="...."
URL=$(curl 'https://ckdatabasews.icloud.com/database/1/com.apple.cloudkit/production/public/records/resolve' \
--data-raw '{"shortGUIDs":[{"value":"$ID"}]}' --compressed \
jq -r '.results[0].rootRecord.fields.fileContent.value.downloadURL')
curl "$URL" -o myfile.ext
@a-a
a-a / fuckedifimraisingajtaccaseforthis.txt
Last active June 24, 2024 04:49
Force Juniper SRX110 to accept VDSL PIC firmware from later (published) jfirmware releases
# Force Juniper SRX110H2 to accept VDSL PIC firmware from Juniper jfirmware 17 release (For SRX300 series?)
# it might work, it might not. do this at your own risk etc. i think it rolls back. haven't tried lol.
# Testing using latest 17.4 release specifically from https://support.juniper.net/support/downloads/?p=junos-srx#sw.
# At time of writing, "latest" was jfirmware-srxsme-17.4R3.16-signed.tgz - copy your shit to a fat32 usb
# Make usb mountpoint (if you haven't already)
root@% mkdir /var/tmp/usb
# Mount the USB
root@% mount_msdosfs /dev/da0s1 /var/tmp/usb
@rumkin
rumkin / authkeys.sh
Last active December 1, 2023 00:31
Manage ssh keys with a script
#!/bin/bash
SSH_DIR=$HOME/.ssh/
AUTH_KEYS_DIR=${SSH_DIR}/authorized_keys.d
AUTH_KEYS_FILE=${SSH_DIR}/authorized_keys
# Utils
key-path() {
echo "${AUTH_KEYS_DIR}/${1}"
@PhirePhly
PhirePhly / init
Last active July 23, 2025 12:25
Init script to go in the root of a Debian install for booting entirely from the initrd file
#!/bin/sh
# Kenneth Finnegan, 2020
# https://blog.thelifeofkenneth.com/
# Huge thanks to Gandi.net for most of this code
set -x
set -e
# Create the mount points for all of the virtual file systems which don't
# actually map to disks, but are views into the kernel
@ali-kamalizade
ali-kamalizade / healthcheck.js
Last active October 20, 2025 22:08
A sample implementation of a health check endpoint for Node.js using Express
// app.js: register the route. In our case, we don't want authorization for this route
app.use('/healthcheck', require('./routes/healthcheck.routes'));
// healthcheck.routes.js: return a 2xx response when your server is healthy, else send a 5xx response
import express from 'express';
const router = express.Router({});
router.get('/', async (_req, res, _next) => {
// optional: add further things to check (e.g. connecting to dababase)