Skip to content

Instantly share code, notes, and snippets.

View abstractmachines's full-sized avatar
🤸

Amanda Falke abstractmachines

🤸
View GitHub Profile
@abstractmachines
abstractmachines / go-receiver-and-factories.go
Created July 24, 2021 22:06
Go Receiver and Factories
// Receiver arguments: https://tour.golang.org/methods/1
// Factory patterns:
// https://www.sohamkamani.com/golang/2018-06-20-golang-factory-patterns/
// https://stackoverflow.com/questions/49712313/golang-factory-method
package main
import "fmt"
type Instrument struct {
@abstractmachines
abstractmachines / taints-tolerations-affinity.md
Last active August 13, 2021 01:34
taints, tolerations and node affinity

Taints, tolerations and node affinity : the e-magnetism of Kubernetes Nodes in the Kube Scheduler

We can think of Node Affinity as analagous analogus to magnetic attraction;

We can think of Node Taints as the complement of that (magnetic repulsion);

We can think of the determinant of a Node's eventual location as being "up to the Kube scheduler.

That's why we'll often have an effect of NoSchedule for nodes we'll want an exception of sorts for.

@abstractmachines
abstractmachines / vscode-go.md
Created August 18, 2021 20:42
VSCode Go Extension

How to keep VSCode's Go Extension from removing Go imports while developing

We would think this would be enough for VSCode's Go Linter/formatter, but nopes:

{
  "editor.formatOnSave": false,
}

We instead need to do this:

@abstractmachines
abstractmachines / kubernetes-envtest-an-api-server.md
Last active September 21, 2021 15:05
Kubernetes envtest: An API Server

Kubernetes envtest

A testing environment for Kubernetes

Note: Everything mentioned here is also in the Controller Runtime's pkg envtest docs.

envtest can run on a local control plane, or an existing cluster.

  • To start up a local control plane, envtest spins up a local instance of control plane binaries. These would be, etcd and kube-apiserver. It's available as a package under controller-runtime.
  • Alternatively, an existing cluster can be used to run envtest, by loading up CRDs and client config.
@abstractmachines
abstractmachines / debugging-kubernetes-flow-chart.md
Last active September 23, 2021 20:36
Debugging Kubernetes Flow Chart

Debugging Kubernetes Flow Chart

Not sure of the source of this

image

@abstractmachines
abstractmachines / calcuating-probability.md
Last active May 29, 2022 18:05
How to calculate probability

How to calculate probability

Counting Distinct Objects

Combinations and Permutations

Combinations: Order Doesn't Matter

$$ C = \frac{n!}{(n-r)!r!}$$

@abstractmachines
abstractmachines / python-language.md
Last active August 25, 2022 01:01
Python language

Python Handbook

Intended audience: relatively experienced software engineers who don't know Python (yet).

Python lambdas

Python isn't a "functional" language, but it has adopted some FP methods around 1994.

A function in Python:

def identity(x):
@abstractmachines
abstractmachines / git-config-crlf-filemode.md
Last active August 27, 2022 15:55
git config re: cross-platform EOL and executables core.crlf core.filemode

core.autocrlf (man git-config)

core.autocrlf
   Setting this variable to "true" is the same as setting the text attribute to "auto" on all files and core.eol to "crlf".
   Set to true if you want to have CRLF line endings in your working directory and the repository has LF line endings.            This variable can be set to input, in which case no output conversion is performed.

e.g., CRLF false for EOL in Github POSIX/Windows cross-platform development.