Skip to content

Instantly share code, notes, and snippets.


Herman hermanbanken

View GitHub Profile
hermanbanken / gitlab_list_variables.js
Created Sep 9, 2021
GitLab list pipeline variables
View gitlab_list_variables.js
#!/bin/env node
const PRIVATE_TOKEN = "redacted";
const headers = { "PRIVATE-TOKEN": PRIVATE_TOKEN };
const root = "";
const project = 24418136; // "hue-contract-tests";
const { default: fetch } = require("node-fetch");
fetch(`${root}/projects/${project}/pipelines`, { headers }).then((res) => res.json())
.then(async (pipelines) => {
hermanbanken /
Created Sep 6, 2021
Raft cluster completely blocked

Raft issue

When developing my first hashicorp/raft implementation I was stuck at a stone wall it seemed. Somehow I could bootstrap one of the nodes and this would win the election and the raft observation for it becoming Leader also made it in, but then nothing. I couldn't figure out why all RPCs timed out after that.

I started to run locally and debugged using VS Code Launch configuration (which uses Delve) and found that before bootstrapping there was a "runCandidate" goroutine, but after bootstrapping there was no "runLeader" goroutine. Turns out the leader loop never started! How could this be? Then my mind wandered to the observer that I added:

	ch := make(chan raft.Observation, 1)
	r.RegisterObserver(raft.NewObserver(ch, true, func(o *raft.Observation) bool {
		// *RequestVoteRequest
hermanbanken /
Last active Aug 23, 2021

Limited Sampler

flow chart

hermanbanken / .gitmodules
Last active Jun 6, 2021
Protobuf ramblings
View .gitmodules
[submodule "proto/googleapis"]
path = proto/vendor/googleapis
url =
hermanbanken /
Last active May 10, 2021
Datastore Emulator consistency

TLDR: The datastore emulator has a consistency setting. When developing, always set this to a value to 0.05 or lower to simulate realistic eventual consistency.

The Google Datastore is only partly consistent: only lookups and ancestor queries are strongly consistent. All types of queries use the indexes, which take a while to process in a distributed system like Google Datastore. When you develop an application that uses the Datastore, it helps to use the emulator in a way that simulates this eventual consistency. This way to can test if your

hermanbanken /
Last active Jan 13, 2021
Go net dial DNSError has the wrong server name #golang

Go net dial DNSError has the wrong server name

Suppose you write this piece of Go code to do a DNS resolve using

var resolver = &net.Resolver{
	PreferGo: true,
	Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
		d := net.Dialer{
			Timeout: time.Millisecond * time.Duration(5000),

This was initially posted in an kubernetes-sigs/kustomize issue.

We are using Kustomize's vars feature. Initially we didn't understand how to use it for our purpose, but it is a 100% fit. One example is our Ingress resource, which looks like this:

# file: base/ingress.yaml
kind: Ingress
  name: services
hermanbanken / config.js
Created Oct 3, 2020
TURN on Jitsi on kubernetes (k8s)
View config.js
// adapted from default
export const settings = {
useStunTurn: true,
p2p: {
enabled: false, // disabled for testing
useStunTurn: true,
// Some other settings for resolution & parallel talking as relevant for our usecase
hermanbanken /
Last active Aug 26, 2020
Envoy Cluster SubSet Load Balancing
hermanbanken /
Last active May 14, 2020
Scan for credentials (GNU/BSD)
# Remember, never run shell scripts from the internet: go ahead verify the SHA!
curl | \
sed s/=grep/=ggrep/ | \
bash -x