Skip to content

Instantly share code, notes, and snippets.

lynaghk / taxes.smt2
Created Aug 1, 2022
S-Corp tax optimization with the Z3 Theorem Prover
View taxes.smt2
;; Solo freelancer's S-Corp tax optimization
;; Assumes an unmarried single-shareholder and tons of other stuff.
;; I'm not a tax professional, no guarantees here, probably typos, etc. Come on!
;; Run with
;; See also my notes at
lynaghk /
Last active Jul 22, 2022
earthly vs toast

Comparing Earthly and Toast for isolated / repeatable development.

Calculate a performance floor by running a fast command, echo, in the context of a large container (the emscripten SDK takes up about 1 GB).

After the initial build and caching, Toast takes 800ms and Earthly about 7 seconds on my 2020 M1 Macbook Air.

  • MacOS 12.5
  • Docker Desktop 4.10.1
  • Toast 0.45.5
  • Earthly v0.6.20 ad869c06c884b10f88948b5852ab22b4d7262e20
lynaghk / user.clj
Created Mar 18, 2022
Rel and Datascript comparison
View user.clj
;; A comparison of Rel:
;; with datascript:
;; Unless otherwise indicated, all datascript outputs match the ones shown in the Rel Primer.
(ns user
(:require [datascript.core :as d]
(def csv
lynaghk /
Last active Jul 15, 2022
"Serverless" WebRTC demo.

"Serverless" WebRTC demo

Start a server on localhost and open index.html (the host) and index.html#client (the client) in two different browser windows. They'll do their lil' p2p connection discovery dance via the wonderful public service that is and, once established, a video-only camera feed from the client will display on the host.

View resistors.csv
id val
C4410 1000
C17985 750
C17887 300
C17900 100000
C17901 100
C17902 10000
C17903 10
C17924 180
C17928 1
lynaghk /
Created Feb 6, 2021
Download JLCPCB part library as a spreadsheet ( then turn it into a sqlite database so you can search/view/sort parts using
#!/usr/bin/env python
import xlrd
import os
import sys
import csv
import re
re_px = re.compile(":([0-9.]+)")
lynaghk /
Created Sep 24, 2019
streaming realsense depth map video over network
pub mod network;
pub mod realsense_bindings;
pub type CameraTimestamp = u64;
pub const WIDTH: usize = 640;
pub const HEIGHT: usize = 480;
pub const FPS: usize = 30;
pub const FRAME_SIZE: usize = WIDTH * HEIGHT * 2; //16 bit depth info
pub const RECIEVER_ADDR: &'static str = "";
lynaghk / reinforcement_learning.clj
Created Sep 4, 2019
Reinforcement learning sketch
View reinforcement_learning.clj
(ns reinforcement-learning
(:require [clojure.set :refer [difference union]]
[clojure.string :as str]
[lonocloud.synthread :as ->]))
;; Tic Tac Toe bits
;; based on
lynaghk / SketchSystems.spec
Last active Jan 24, 2023
# A big and slow sketch useful for perf testing.
View SketchSystems.spec
# A big and slow sketch useful for perf testing.
A1 -> A2
A2 -> A3
A3 -> A4