Skip to content

Instantly share code, notes, and snippets.

@gtrevg
gtrevg / HookedSession.swift
Created June 3, 2022 18:33 — forked from buranmert/HookedSession.swift
Adding hooks to URLSession
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/
import Foundation
public extension URLSession {
internal typealias RequestInterceptor = HookedSession.RequestInterceptor
@gtrevg
gtrevg / States-v3.md
Created October 21, 2021 14:57 — forked from andymatuschak/States-v3.md
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@gtrevg
gtrevg / ANSI.md
Created August 20, 2021 18:17 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1b
  • Decimal: 27
@gtrevg
gtrevg / 00README.md
Created September 20, 2019 16:15 — forked from karlvr/00README.md
Roadwarrior configuration for macOS 10.12, iOS 10 and Windows 10 using strongSwan and user certificates

strongSwan setup for Road Warriors on macOS 10.12, iOS 10 and Windows 10

This setup is for remote users to connect into an office/home LAN using a VPN (ipsec). This is based on (but not the same as) the strongSwan documentation and this guide: https://raymii.org/s/tutorials/IPSEC_vpn_with_Ubuntu_16.04.html

I used strongSwan 5.5.1.

apt-get install -y strongswan strongswan-pki
@gtrevg
gtrevg / dashdocs.sphinx.txt
Created September 20, 2019 14:29 — forked from pbojinov/dashdocs.sphinx.txt
Creating your own Dash docset from projects using Sphinx documentation
sudo pip install sphinx # or pydoctor, depending on your project
sudo pip install doc2dash
git clone https://github.com/n1k0/casperjs.git
cd casperjs/docs
make
doc2dash -n casperjs --icon _static/images/casperjs-rounded.png --add-to-dash -d ~/Library/Application\ Support/Dash/DocSets/casperjs _build/
test.nt
test.ldj
@gtrevg
gtrevg / readme.md
Created April 5, 2019 22:20 — forked from eddiewebb/readme.md
Hugo JS Searching with Fuse.js
@gtrevg
gtrevg / all_aws_managed_policies.json
Created June 20, 2018 16:46 — forked from gene1wood/all_aws_managed_policies.json
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
{
"AWSAccountActivityAccess": {
"Arn": "arn:aws:iam::aws:policy/AWSAccountActivityAccess",
"AttachmentCount": 0,
"CreateDate": "2015-02-06T18:41:18+00:00",
"DefaultVersionId": "v1",
"Document": {
"Statement": [
{
"Action": [
@gtrevg
gtrevg / benchmark-commands.txt
Created February 7, 2018 08:46 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@gtrevg
gtrevg / Makefile
Created November 22, 2017 19:04 — forked from mcastilho/Makefile
Makefile for Medium article
.PHONY: all tags clean test build install generate image release
REGISTRY_REPO = <..redacted..>
OK_COLOR=\033[32;01m
NO_COLOR=\033[0m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
# Build Flags