Skip to content

Instantly share code, notes, and snippets.

View trbngr's full-sized avatar

Chris Martin trbngr

  • Phoenix, AZ, USA
View GitHub Profile
@jwilger
jwilger / 1 - PII Encryption with Elixir, Commanded, Vault.md
Last active August 12, 2023 03:06
Quick Code Sample on Encrypting PII with Commanded for GDPR/CCPA Compliance

This code is extracted from one of my private projects as an example of how to implement encryption of PII in event streams using two keys: a master key for each "data subject" that is stored in Vault and never transported to the systems that process the PII, and a key unique to each event that is stored (itself encrypted) with the event.

To be clear, the key that is stored with the data is encrypted by another key that is not stored with the data. The idea is that each "data subject" has an encryption key that is stored in Vault (external). When you encrypt data, the library will:

  1. create a new AES 256 encryption key
@coco98
coco98 / elgordino-hasura.tf
Created December 19, 2018 08:31
Terraform spec for Hasura on Fargate and RDS
provider "aws" {
region = "${var.region}"
}
### VPC
# Fetch AZs in the current region
data "aws_availability_zones" "available" {}
resource "aws_vpc" "datastore" {
cidr_block = "172.17.0.0/16"
@slashdotdash
slashdotdash / README.md
Last active September 2, 2022 12:51
Commanded middleware to enrich commands during dispatch, such as calling an external API.

Commanded middleware for command enrichment

Usage

Add the EnrichCommand middleware to your command router:

defmodule MyApp.Router do
  use Commanded.Commands.Router
 
@branneman
branneman / fp-lenses.js
Last active May 17, 2023 00:56
JavaScript: Lenses (Functional Programming)
// FP Lenses
const lens = get => set => ({ get, set });
const view = lens => obj => lens.get(obj);
const set = lens => val => obj => lens.set(val)(obj);
const over = lens => fn => obj => set(lens)(fn(view(lens)(obj)))(obj);
const lensProp = key => lens(prop(key))(assoc(key));
@louthy
louthy / CSharp Free Monad.cs
Last active April 2, 2022 16:20
C# Free Monad
//
// See https://github.com/louthy/language-ext
//
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using LanguageExt;
using static LanguageExt.Prelude;
@swlaschin
swlaschin / ndcoslo17_fp_track.md
Created July 5, 2017 19:38
Functional Track talks from NDC Oslo 2017

Functional Track talks from NDC Oslo 2017

Also, here is the list of all videos from NDC Oslo 2017:

Wednesday 2017-06-14

@swlaschin
swlaschin / 1-checkers-scratch-design.fsx
Last active March 17, 2022 16:06
Example of Domain Driven Design for the game of checkers. There are two files: a scratch file with a series of designs, and a final version.
(*
Example of domain-driven design for Checkers
Rules from here: https://www.itsyourturn.com/t_helptopic2030.html
A SERIES OF SCRATCH DESIGNS
*)
// As we go through the rules, and learn things, we create a series of designs
module Version1 =
@bitwalker
bitwalker / config.ex
Created July 19, 2016 23:00
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.
@jboner
jboner / akka-cluster-implementation-notes.md
Last active March 4, 2023 22:30
Akka Cluster Implementation Notes

Akka Cluster Implementation Notes

Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.

Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.

Akka Gossip

Gossip state

This is the Gossip state representation: