Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -x
# run installer
curl -sfL https://get.k3s.io | sh -
# set up .kube/config for user
KUBECONFIG_CONTENT=$(sudo k3s kubectl config view --raw)
mkdir -p "/home/$USER/.kube"

Context

  • I am on Mac OS X arm64
  • I have 1 USB flash drive, not 2 (easy to write live USB installer to one and install to the other)
  • I do not have a Windows or Linux PC near by (can't format NTFS without pain, can't format ext4 without pain, etc.)
  • I want to prepare a USB flash drive that can be booted via a separate machine (non-Mac) via EFI (not legacy MBR).
  • I do not have Ethernet, just WiFi (no netboot capability)
  • I wanted the root filesystem to be compatible between Linux + Mac + Windows (NTFS/FAT32/ExFAT/EXT4 options; none meet this criteria)
  • I wanted to write Debian live image to USB stick, add toram boot parameter, turn around and install Debian to this USB stick. Did not work, doesn't come with debian-installer-launcher by default, had to add manually after manual wpa-supplicant config, then got a random error after partioning. live-toram also didn't work.
@brandonros
brandonros / dropbear.md
Last active November 23, 2023 00:41
Portable SSHD (Dropbear) on Windows with Cygwin
# build it with GitHub Actions: https://github.com/brandonros/dropbear/actions/runs/6964141533
# install Cygwin on the machine (probably need libcrypt package)
# run it from Cygwin terminal, not Git Bash or MinGW
mkpasswd -l > /etc/passwd
mkgroup -l > /etc/group
mkdir /etc/dropbear
mkdir ~/.ssh/
vi ~/.ssh/authorized_keys # paste ~/.ssh/id_rsa.pub into it, do not try to connect with passwords
./dropbear -F -E -R -w -s -g -j -k
root@vultr:~# journalctl -u k3s
Nov 05 20:29:09 vultr systemd[1]: Starting k3s.service - Lightweight Kubernetes...
Nov 05 20:29:09 vultr sh[18362]: + /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service
Nov 05 20:29:09 vultr systemctl[18363]: Failed to get unit file state for nm-cloud-setup.service: No such file or directory
Nov 05 20:29:09 vultr k3s[18368]: time="2023-11-05T20:29:09Z" level=info msg="Acquiring lock file /var/lib/rancher/k3s/data/.lock"
Nov 05 20:29:09 vultr k3s[18368]: time="2023-11-05T20:29:09Z" level=info msg="Preparing data dir /var/lib/rancher/k3s/data/e82313669fe2739df53b3870076163d1fe7785336a68b4771685219e51c9785d"
Nov 05 20:29:12 vultr k3s[18368]: time="2023-11-05T20:29:12Z" level=info msg="Starting k3s v1.27.7+k3s1 (b6f23014)"
Nov 05 20:29:12 vultr k3s[18368]: time="2023-11-05T20:29:12Z" level=info msg="Configuring sqlite3 database connection pooling: maxIdleConns=2, maxOpenConns=0, connMaxLifetime=0s"
Nov 05 20:29:12 vultr k3s[18368]: time="2023-11-05T20:29:12Z" level=info m
@brandonros
brandonros / ipod-touch-mp3-tag-extract.sh
Last active November 4, 2023 17:42
Extracting MP3 tag information from an iPod Touch
# dependencies (requires fuse2, not fuse3)
sudo apt-get install build-essential checkinstall git autoconf automake libtool-bin libssl-dev python3-distutils python3-dev libusb-1.0-0 libusb-1.0-0-dev fuse libfuse-dev id3v2
# add to fuse
sudo groupadd fuse
sudo usermod -aG fuse $(whoami) # logout + log back in after
# clone
for x in libplist libimobiledevice-glue libusbmuxd usbmuxd libimobiledevice ifuse
do
@brandonros
brandonros / poc.md
Last active October 27, 2023 02:12
rush + c-ward + eyra + mustang proof of concept

rush + c-ward + eyra + mustang proof of concept

Build kernel

# start clean kubernetes pod
kubectl run -n default alpine --restart=Never --rm -i --tty --image=alpine:3.18 -- /bin/bash
# install dependencies to build kernel
apk update && apk add bash curl make gcc musl-dev linux-headers g++ build-base ncurses-dev openssl-dev elfutils-dev bc diffutils perl
# change shells
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: kaniko
labels:
app.kubernetes.io/version: "0.6"
annotations:
tekton.dev/pipelines.minVersion: "0.17.0"
tekton.dev/categories: Image Build
tekton.dev/tags: image-build
@brandonros
brandonros / vultr.sh
Created August 30, 2023 14:37
Bash wrapper around Vultr API for k8s cluster up/down
#!/bin/bash
set -e
log() {
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - $*"
}
# Call the Vultr API and return the response.
call_api() {
#define CYBT_DEBUG 1
#define CYW43_DEBUG 1
#define CYW43_VDEBUG(...) uart_printf(__VA_ARGS__)
#define CYW43_VERBOSE_DEBUG 1
#include "pico/stdlib.h"
#include "pico/printf.h"
#include "pico/cyw43_arch.h"
#include "hardware/uart.h"
/*
scrape from https://www.espn.com/nba/playbyplay/_/gameId/401547671 with
const quarter = document.querySelector('.tabs__wrapper--playByPlay .tabs__list__item--active').innerText
const rows = document.querySelectorAll('.playByPlay__tableRow')
const plays = []
for (const row of rows) {
const index = row.attributes['data-idx']
const time = row.querySelector('.playByPlay__time').innerText
const text = row.querySelector('.playByPlay__text').innerText
const awayScore = row.querySelector('.playByPlay__score--away').innerText