Skip to content

Instantly share code, notes, and snippets.

View andywer's full-sized avatar

Andy Wermke andywer

View GitHub Profile
@andywer
andywer / _readme.md
Last active March 7, 2024 05:52
React - Functional error boundaries

React - Functional error boundaries

Thanks to React hooks you have now happily turned all your classes into functional components.

Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.

There is just no functional equivalent for componentDidCatch and deriveStateFromError yet.

Proposed solution

@andywer
andywer / delegated-aml.md
Last active June 19, 2023 09:21
Draft: Delegating AML to DeFi pools

Draft: AML Delegation to DeFi Pools

There is a looming risk in DeFi concerning real-world assets (RWAs) or security tokens in general and pools holding them (think Uniswap, AAVE, …) regarding Anti Money Laundering (AML) regulation.

Should a court order the token issuer (i.e. Circle) to freeze the holdings of an address that has deposited the funds into a pool (i.e. UniV3-ETH/USDC), that might risk the token issuer having to freeze the whole pool's holdings.

This risk is even amplified in the new Uniswap v4 architecture as all pools' funds will be held

@andywer
andywer / Monorepo Setup.md
Last active April 8, 2022 03:50
Monorepo Setup

Overall Approach

This document is a short description of the monorepo setup that I came up for a few different smaller projects in the last 8 months or so.

Directory structure

/
  services/
 product/
@andywer
andywer / Dockerfile
Created December 30, 2019 17:08
Database migration & seeding tool / container
FROM node:12-alpine AS builder
COPY . /app
WORKDIR /app
RUN yarn
# `build` script is already run as a `prepare` script hook
RUN rm -rf /app/node_modules
@andywer
andywer / sample-config.env
Created December 16, 2019 15:51
Candy Dispenser Sample Config
ACCOUNT_PUBLIC_KEY_1=GACEH4IGNPVQNPPOFC4SLZ5OGCIRPSOFNQIO2XIF5ERUKNYI6QDJ3O6Q
ACCOUNT_PUBLIC_KEY_2=GBZYXXFSOP545IVUAFUQCJVZ42EWGAKEIW5WKP7QPRAIQ5W2NSAUEP5K
TEST_PUBLIC_KEY_1=GC3QAQTZMVUDCU4M3HT3MIIJPS7YC5NFZP3G5S2RBABXP3L4ODZMSWLO
TEST_PUBLIC_KEY_2=GCGKEIISGVAMW4EQYTCM7GLDFBFNEXP6CZXFA5GBZG7CPJOTR2JZGLTA
# <speed>:<duration>:<alternations>
MOTOR_CONFIG_LEFT=30:2s:1 # This motor config is good for M&Ms
MOTOR_CONFIG_RIGHT=40:4.5s:3 # Pistachios
@andywer
andywer / sharded-key-storage.md
Last active March 17, 2021 16:04
Sharded Key Storage

Sharded Secret Key Storage

  • Store secret keys on the internet
  • Authenticate with arbitrary authentication methods to retrieve secret
  • Trustless: None of the key storage server providers can read the secret
  • Recoverable funds: Even if authentication credentials are lost, the secret can be recovered
  • Secure: If a key storage server gets compromised, the attacker will not even know a fragment of the secret
  • Fault-tolerant: Redundancy fragment allows retrieving the secret even if a server is down
  • Versatile: Allows storage of arbitrary secrets
@andywer
andywer / preauthed-multisig.md
Created July 27, 2019 13:48
Stellar Pre-Authorized Multi-Signature

Stellar Pre-Authorized Multi-Signature

Abstract

I tried to use pre-authorizeded transactions on Stellar as a replacement for a co-signer signature, but it seems like they don't play terribly well with multi-signature setups.

Scenario

Given:

@andywer
andywer / custom-sep-7-types.md
Last active March 17, 2021 16:02
SEP-7 Stellar URI extension / custom types

New / Custom SEP-7 URI Types

WHOIS (vendor prefixed)

Stellar URI type to request another party's public key. Can optionally be signed with a HMAC using a secret nonce to protect the response (the data submitted to the callback endpoint) against man-in-the-middle attacks.

web+stellar+solarwallet.io:whois?callback=url:<href>[&secret=<nonce>][&msg][&network_passphrase][&origin_domain][&signature]
@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 / talk-proposal.md
Last active December 23, 2020 17:22
Reactive Conf 2017 ⚡️ Talk Proposal - Memory Leak Hunt 2017 Style

This is a proposal for lightning talk at Reactive Conf. Please 🌟 this gist to push the proposal!

Memory Leak Testing in 2017

Hi, I am Andy, creator of leakage - the node-powered memory leak testing library.

Instead of manual debugging it provides a structured approach to fix or even prevent memory leaks.