Skip to content

Instantly share code, notes, and snippets.

View abstractmachines's full-sized avatar
🤸

Amanda Falke abstractmachines

🤸
View GitHub Profile
@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 / 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 / concurrency-parallelism.md
Last active May 27, 2021 19:58
Concurrency versus parallelism
@abstractmachines
abstractmachines / python-vscode.md
Created May 6, 2021 01:38
Python VSCode with black and flake8

Python VSCode settings.json w black and flake8

{
    "editor.formatOnSave": true,
    "python.formatting.provider": "black",
    "files.insertFinalNewline": true,
    "python.testing.pytestEnabled": true,
    "python.linting.pylintEnabled": false,
 "python.linting.flake8Enabled": true,
@abstractmachines
abstractmachines / tmux.conf
Created May 2, 2021 21:01
tmux.conf inspired by spicycode
# Define default shell
set -g default-command /bin/zsh
# Use mouse
set -g mouse on
set -g default-terminal screen-256color
# WIP. See inspiration at: https://gist.github.com/spicycode/1229612
@abstractmachines
abstractmachines / webpack-4-env-variables.md
Last active January 10, 2021 01:11
Webpack 4 environment variables

Making local dev servers w Webpack 4

To use an environment variable in webpack, set module.exports to a function which returns the config object.

Only a function can take in env and argv as args, and you'll need those.

Then use defineWebpackPlugin to set environment variables.

Remember that Webpack 4 is "no config"; just set mode when you startup webpack dev-versus-prod in your package.json.

@abstractmachines
abstractmachines / custom-types-ts.md
Last active January 10, 2021 01:11
Custom TS types for Webpack + React ES6-Style Imports

Custom Typescript Types Recipes for React + Webpack ES6 style imports

use case: CSS files in /src/styles dir, and SVG and PNG files in /assets/images dir

  • custom.d.ts file in dir of svg, png assets:
declare module "*.svg" {
    const content: any;
    export default content;
}
@abstractmachines
abstractmachines / redux-devtools-ts.md
Last active January 9, 2021 20:42
Redux Devtools Recipes: composeEnhancers, saga middleware, and TypeScript

Redux Devtools Recipes

With composeEnhancers, Router:

const reduxDevToolsCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
	trace: true,
	traceLimit: 25,
});

const composeEnhancers = reduxDevToolsCompose || compose;
@abstractmachines
abstractmachines / optional-chaining-nullish-coalescing.md
Last active December 31, 2020 23:01
Functional Programming: Optionals, Maybes, and Optional Chaining and Nullish Coalescing

WIP

Optional chaining, null coalescing, and optionals and maybes

The maybe/optional data types in functional languages such as Haskell and Scala have ways to handle null/undefined that are often superior to using validation, conditionals and operators to infer whether or not a value is nullish.

That's what optional chaining and null coalescing remind me of. They're also a replacement for usage of Lodash .get() method which allows for default values to be set in the last parameter, hence handling nullish value use cases.

Optional chaining

Rather than using something.property.anotherproperty, which can error (and hence crash your program/web page) if it encounters a nullish value for one of the properties, we use something?.property?.anotherproperty instead, which only returns undefined (instead of an error) if a nullish value is encountered in one of the properties.

@abstractmachines
abstractmachines / kyle-after-asm.md
Last active October 24, 2020 20:15
Kyle after assembly mentoring

TODO List for Kyle - Mentoring

"Finish out" the assembly courses

  1. Take your assembly courses and convert your notes into markdown in Github gists.
  2. Pin those gists to your Github profile.

Complete 2 C++ assignments

  1. Assignment 1: Create a class with 2-3 member functions and initialize an instance of the class in main()
  2. Assignment 2: Operator overloading (look at my github for an example!)