Skip to content

Instantly share code, notes, and snippets.

View andywer's full-sized avatar

Andy Wermke andywer

View GitHub Profile
@andywer
andywer / migration-guide.md
Last active September 22, 2017 08:22
webpack-blocks 1.0 migration guide
@andywer
andywer / minikube-traefik.md
Created May 8, 2018 10:38
Running Traefik in Minikube using Helm

Traefik in Minikube using Helm

Install traefik to the cluster using helm.

helm install stable/traefik --set dashboard.enabled=true,imageTag=v1.6,serviceType=NodePort

Now edit the traefik dashboard service manually, since the traefik chart wants us to access the traefik dashboard via a custom domain. Since we run it locally in a VM, we will just expose the dashboard on the minikube IP on a custom port.

@andywer
andywer / parcel-vs-webpack.md
Last active May 22, 2018 14:31
Parcel bundler vs Webpack

Tree shaking

Webpack: Should work now™

Parcel: Still not implemented - parcel-bundler/parcel#392

Environment vars substitution

Webpack: EnvironmentPlugin / DefinePlugin

import State from 'new-state-component'
const setName = name => prevState => ({ ...prevState, name })
const RenameDialog = ({ prevName, onRename }) => {
return (
<State initial={{ name: prevName }}>
{(state, setState, memoize) => (
<RenameDialogUI
name={state.name}
@andywer
andywer / kubernetes-cheat.md
Last active August 8, 2018 09:59
Kubernetes Cheat Sheet
kubectl config get-contexts
cd charts/satoshipay
helm dep up
@andywer
andywer / postgres-outage.md
Created August 21, 2018 05:03
Post Mortem: Postgres outage on 2018-08-20

2018-08-20: Postgres failure

What happened

The PostgreSQL container stopped unexpectedly, was automatically restarted, but suddenly didn't accept any connections anymore. Neither from the API service containers nor from the Macbook over the internet.

Error in logs:

FATAL:  pg_hba.conf rejects connection for host "10.0.1.2", user "postgres", database "******", SSL off
@andywer
andywer / multisig-service.md
Last active September 19, 2018 10:45
Stellar Multisig Coordination Service - Rough Draft

Stellar Multisig Coordination Service

Objective

SEP-0007 introduced a standard for payment requests (basically templated transactions) on Stellar. In order to provide a smooth user experience when working with multi-signature accounts, wallets need to be able to send each other realtime payment requests.

That requires a new kind of service in the Stellar eco system: A multi-signature coordination service.

@andywer
andywer / multisig-service-arch.md
Last active September 19, 2018 10:35
Stellar Multisig Coordination Service Architecture Draft

Service federation

  • Each node has a key pair to authenticate itself to its peers
    • Key pair might or might not relate to a Stellar account
  • Each node provides a SSE co-signature request streaming endpoint other peers or wallets may subscribe to
  • When connecting to another peer
    • Subscribe to that peer's stream
    • Post a message to invite the peer to subscribe to the node's stream
  • Each node exposes a list of the peers that it is connected to
  • Each node has a configurable set of trusted peers, will always connect to them and accept them subscribing
@andywer
andywer / typed-emitter.ts
Last active September 26, 2018 17:14
Type-safe EventEmitter
type Arguments<T> = [T] extends [(...args: infer U) => any]
? U
: [T] extends [void] ? [] : [T]
/**
* Type-safe event emitter.
*
* Use it as:
*
* interface MyEvents {
@andywer
andywer / react-debug.js
Last active October 23, 2018 17:30
React Component State Debugger
let lastLoggingTime = Date.now();
function logUpdate (componentName, update, stateBefore, stateAfter, stack) {
const msSinceLastPrint = Date.now() - lastLoggingTime;
console.groupCollapsed(
`%c<${componentName}> setState: %o %c%s`,
"color: #5080ff",
update,
"color: #808080",