Skip to content

Instantly share code, notes, and snippets.

Avatar
🇳🇱

Herman hermanbanken

🇳🇱
View GitHub Profile
@hermanbanken
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 = "https://gitlab.com/api/v4";
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
hermanbanken / blog.md
Created Sep 6, 2021
Raft cluster completely blocked
View blog.md

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
hermanbanken / _README.md
Last active Aug 23, 2021
LimitedSampler
View _README.md

Limited Sampler

flow chart

@hermanbanken
hermanbanken / .gitmodules
Last active Jun 6, 2021
Protobuf ramblings
View .gitmodules
[submodule "proto/googleapis"]
path = proto/vendor/googleapis
url = https://github.com/googleapis/googleapis.git
@hermanbanken
hermanbanken / _README.md
Last active May 10, 2021
Datastore Emulator consistency
View _README.md

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
hermanbanken / README.md
Last active Jan 13, 2021
Go net dial DNSError has the wrong server name #golang
View README.md

Go net dial DNSError has the wrong server name

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

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),
		}
View kustomize_vars.md

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
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: services
@hermanbanken
hermanbanken / config.js
Created Oct 3, 2020
TURN on Jitsi on kubernetes (k8s)
View config.js
// adapted from default
export const settings = {
...defaultSettings,
useStunTurn: true,
p2p: {
enabled: false, // disabled for testing
useStunTurn: true,
},
// Some other settings for resolution & parallel talking as relevant for our usecase
}
@hermanbanken
hermanbanken / README.md
Last active Aug 26, 2020
Envoy Cluster SubSet Load Balancing
View README.md
@hermanbanken
hermanbanken / README.md
Last active May 14, 2020
Scan for credentials (GNU/BSD)
View README.md
# Remember, never run shell scripts from the internet: go ahead verify the SHA!
curl https://gist.githubusercontent.com/hermanbanken/96925cb9593137fd6816cefd8ac7e93a/raw/070f6bde93b362388b5612648ef17ae612e3cc5c/scan_filenames.sh | \
sed s/=grep/=ggrep/ | \
bash -x