Skip to content

Instantly share code, notes, and snippets.

View hermanbanken's full-sized avatar
🇳🇱

Herman hermanbanken

🇳🇱
View GitHub Profile
@hermanbanken
hermanbanken / config.js
Created October 3, 2020 17:49
TURN on Jitsi on kubernetes (k8s)
// 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 August 26, 2020 19:54
Envoy Cluster SubSet Load Balancing
@hermanbanken
hermanbanken / README.md
Last active May 14, 2020 15:28
Scan for credentials (GNU/BSD)
# 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
@hermanbanken
hermanbanken / repro1.yaml
Last active January 2, 2020 16:14
replica issue
kind: Deployment
# repro1.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
namespace: default
spec:
replicas: 2
# in next apply we'll remove this replicas property
@hermanbanken
hermanbanken / 20191224-reproducible-image-sha.md
Last active January 10, 2020 08:32
Reproducible Image SHA with Kaniko

Reproducible Container Image SHA's with Kaniko

At Q42 we use Docker a lot nowadays. A few projects use full-fledged Kubernetes on GKE with Docker images. Other projects use docker with AppEngine Flex, which has become our standard for quickly deploying a standalone workload, because it does the boring things like hosting & SSL (LetsEncrypt) for us.

In one particularly large project (Hue) we have a multitude of different micro-services that all have separate Docker images. Combined with CI/CD releasing to our test & staging environments,

node_modules
package-lock.json
@hermanbanken
hermanbanken / demux.go
Created August 12, 2019 06:59
Demuxing
type Muxed struct {
IsLast bool;
Payload []byte;
}
type State struct {
ReplyTo chan interface{}
}
// Incoming attaches [channel(buffer: 1)], if Mux finds multi-packet reply,
@hermanbanken
hermanbanken / WWDC-swiftui-basic-binding.swift
Last active June 11, 2019 17:22
101 SwiftUI.BindableObject with a Combine.Publisher
// This is the bare-minimum you need to know to create a SwiftUI.BindableObject with a Combine.Publisher
final class MyUserData: BindableObject {
// this ==vvvvvvv must be a `Publisher` type
let didChange = PassthroughSubject<MyUserData, Never>()
var myProperty = false {
didSet {
// this ==vvvvvvv
didChange.send(self)
//
// Test.swift
// Q42
//
// Created by Herman Banken on 6/4/19.
//
import Foundation
import Combine
import RxSwift
@available(iOS 13.0, *)
func exampleCombineKVO () {
let article = Article(title: "Test", body: "Lorum ipsum")
// For a KeyPath 101, see https://www.swiftbysundell.com/posts/the-power-of-key-paths-in-swift
let keypath: ReferenceWritableKeyPath<Article,String> = \.title
// The new Combine stuff:
let sink = Subscribers.Assign(object: article, keyPath: keypath)
let source = Publishers.Future<String, Never> { subscriber in