Skip to content

Instantly share code, notes, and snippets.

@lynaghk
lynaghk / taxes.smt2
Created August 1, 2022 18:34
S-Corp tax optimization with the Z3 Theorem Prover
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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 https://github.com/Z3Prover/z3
;;
;; See also my notes at https://kevinlynagh.com/financial-plan/
@lynaghk
lynaghk / About Search.jpg
Created July 25, 2022 19:39 — forked from ryanlucas/About Search.jpg
Unlocking iPhone 8 iOS 11
About Search.jpg
@lynaghk
lynaghk / 0_readme.md
Last active July 22, 2022 18:52
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
lynaghk / user.clj
Created March 18, 2022 21:21
Rel and Datascript comparison
;; A comparison of Rel: https://docs.relational.ai/rel/primer/aggregations_groupby_joins
;; with datascript: https://github.com/tonsky/datascript/
;; Unless otherwise indicated, all datascript outputs match the ones shown in the Rel Primer.
(ns user
(:require [datascript.core :as d]
clojure.string))
(def csv
"Messi,70,32,BFC,Argentina
@lynaghk
lynaghk / 0_WebRTC_serverless_demo.md
Last active July 15, 2022 14:21
"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 https://patchbay.pub/ and, once established, a video-only camera feed from the client will display on the host.

id val
C4410 1000
C17985 750
C17887 300
C17900 100000
C17901 100
C17902 10000
C17903 10
C17924 180
C17928 1
@lynaghk
lynaghk / jlcpcb_xls2csv.py
Created February 6, 2021 07:37
Download JLCPCB part library as a spreadsheet (https://jlcpcb.com/parts) then turn it into a sqlite database so you can search/view/sort parts using https://sqlitebrowser.org/
#!/usr/bin/env python
import xlrd
import os
import sys
import csv
import re
re_px = re.compile(":([0-9.]+)")
@lynaghk
lynaghk / lib.rs
Created September 24, 2019 18:43
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 = "192.168.1.2:9898";
@lynaghk
lynaghk / reinforcement_learning.clj
Created September 4, 2019 06:11
Reinforcement learning sketch
(ns reinforcement-learning
(:require [clojure.set :refer [difference union]]
[clojure.string :as str]
[lonocloud.synthread :as ->]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tic Tac Toe bits
;; based on https://github.com/paraseba/tictactoe/blob/master/src/tictactoe/core.clj
@lynaghk
lynaghk / SketchSystems.spec
Last active January 24, 2023 22:37
# A big and slow sketch useful for perf testing.
# A big and slow sketch useful for perf testing.
A
A1 -> A2
A2 -> A3
A3 -> A4
A1
A2
A3
A4