Skip to content

Instantly share code, notes, and snippets.

View lisa's full-sized avatar

Lisa Seelye lisa

View GitHub Profile
@lisa
lisa / README.md
Last active June 13, 2022 04:06
Adding a new control-plane node to an existing Kubernetes cluster

Adding a new control-plane node to an existing Kubernetes cluster

This document is meant to collect information from various sources to serve as a quick and dirty reminder to myself before ending up on lisa.dev

$ k get node -o wide
NAME         STATUS   ROLES                  AGE      VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION     CONTAINER-RUNTIME
kube2        Ready    <none>                 2y338d   v1.22.8   192.168.86.11   <none>        Ubuntu 18.04.6 LTS               5.1.0-rockchip64   containerd://1.5.5
kube3        Ready    <none>                 2y338d   v1.22.8   192.168.86.12   <none>        Ubuntu 18.04.6 LTS               5.1.0-rockchip64   containerd://1.5.5
kube4        Ready    control-plane          8m45s    v1.24.1   192.168.86.13   <none>        Debian GNU/Linux 11 (bullseye)   5.15.32-v8+        containerd://1.4.13

A pair of helper scripts for Factorio blueprint (string) parsing.

Factorio blueprint strings are base64-encoded and zlib compressed JSON. There is a leading 0 which prefixes the blueprint string. Consider:

0eNp9j80KwjAQhN9lzmmhbWI0ryIibV0kkD+SVCwl725TL548zjLzzeyGySwUonYZaoOevUtQ1w1JP91o6i2vgaCgM1kwuNFWlexoTEOG5hz13ARvCIVBuwe9obpyYyCXddb0xR1ivbvFThR3w18QQ/Bpz3pX+ytvkLIVDCtUM/ChFaUWHIvUzwMML4rpiPXnjstLL4XgXMhTKR9Exkxi

The preceeding is a base64 encoded blueprint string for a single Small electric pole with no connections or anything else going on.

A native, in-app way to restore files would be far better than needing to navigate to and login to select files.
The workflow to create a zip file in the website could be better: I totally get the 500GB limit, but I shouldn't be able to select files >500GB to receive that error, and if I did somehow, it should direct me to create a snapshot from those same files.
The backblaze downloader app requires logging in (with painful 2FA!) for each zip file. I should be able to select multiple zip files and snapshots. It's not really a backblaze "downloader" if it can't download all the things.
Snapshots: This whole process is a goddamn mess. I've tried for a week to fetch snapshots (ranging from multiple 500GB to a two over 3.9TB) and it's simply not gone well, which sucks because each attempt is costing real dollars.
I tried Cyberduck originally as suggested on backblaze website and that resulted in incomplete files and no way to resume. I've tried b2 3.3.0 to "sync" and it resulted in truncated files. I've trie
@lisa
lisa / stripansi.sh
Created September 26, 2021 16:48
Strip ANSI with Perl
#!/bin/bash
# An implementation of https://superuser.com/questions/380772/removing-ansi-color-codes-from-text-stream/380778
# usage: ./stripansi.sh "src" "dest"
cat "${1}" | perl -pe 's/\x1b\[[0-9;]*[mG]//g' > "${2}"
@lisa
lisa / lisa.md
Last active July 6, 2021 17:11
You seem to have accidentally notified Lisa. Here's what to do next.

@lisa User Notification

Hello! You're receiving this notice because you've tagged me, @lisa, on GitHub, likely in error. Lisa is a common first name, and happens to be mine. I use the @lisa username here on GitHub. While being tagged in various repositories is an interesting way for me to discover new projects, it's likely not your intention. Did you mean to tag someone else? Did you mean to use @lisa instead, in a word as word usage?

Next Steps

I'm unsubscribing from this issue, pull request or project so if you meant to tag someone else to notify them, I would recommend that. If you meant to use my user ID as a plain string, without having GitHub notify me, you can do so by wrapping with backticks (the ` character), like so: @lisa.

this text

@lisa
lisa / README.md
Created June 5, 2020 02:14
Python-generated YAML meets Go Operators

This week I ran into a pretty weird bug that mashed up a confluence of a number of things:

  • Code changes
  • Separate, but related project that generates YAML (sigh, yaml)
  • JSON marshalling in Go
  • Kubernetes CRDs

How these all intertwine centres around the Kubernetes CRD and JSON marshalling.

Say you have a CRD and its API is:

1 Godless Shrine
3 Unearth
2 Snow-Covered Island
1 Marsh Flats
4 Serum Visions
2 Snow-Covered Swamp
1 Watery Grave
3 Monastery Mentor
4 Snapcaster Mage
3 Flooded Strand
At home stuff:
Bodyweight squats - http://www.fitstream.com/exercises/squat-a158
Bulgarian split squats (put the 1 foot on a chair) - https://www.youtube.com/watch?v=2C-uNgKwPLE
Reverse lunges - https://www.youtube.com/watch?v=xrPteyQLGAo
Bench dips (with a chair or sofa) https://www.youtube.com/watch?v=c3ZGl4pAwZ4
Lat pulldown (Use a towel) - https://www.youtube.com/watch?v=NfS_6HC4ryE
Rows (got something heavy with a handle? like kitty litter)
Bodyweight hip thrust https://bretcontreras.com/10-steps-to-the-perfect-hip-thrust/
Pushups (inclined maybe)

Based on part of client-go tests, to add hooks to print out what endpoints the HTTP client is making to the Kubernets API server. This was useful to determine what the client was doing in regards to specific namespaced calls during the development of cloud-ingress-operator.

There are three pieces to add:

  1. import net/http (lines 11-12)
  2. Definition for the WrapTransport (occurs previous to func main(), lines 55-79)
  3. WrapTransport Kubernetes client config (lines 117-120)
@lisa
lisa / query.rb
Created September 20, 2019 16:21
# Originally written to detect which users have expired cache for specific API method.
# CCP required API users to respect the cache, which means we'd have to record the expiration date locally, and only request new data once the timer expired. This takes care of it.
# --->cut<---
# COALESCE to force NULLs to a recognisable string.
# when 'method' - if it's this method impose conditions
# if it's '(none)' (aka NULL) - this user has no EveApiCache entries, so select them
# else this user has a non-#{method} EveApiCache so select them
def users_to_work_on(method)