Skip to content

Instantly share code, notes, and snippets.

@lynaghk
lynaghk / SketchSystems.spec
Created August 21, 2024 20:15
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
Foo2
@lynaghk
lynaghk / SketchSystems.spec
Last active August 21, 2024 20:15
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
@lynaghk
lynaghk / elisp.el
Last active November 12, 2024 21:00
Copy markdown from Emacs, paste formatted content directly into GMail
(defun formatted-copy (start end)
"Export region to HTML, and copy it to the clipboard."
(interactive "r")
(let* ((region-string (buffer-substring-no-properties start end))
(shell-command "pandoc -f gfm -t html5 | pbcopy_html")
(output-buffer (generate-new-buffer "*Shell Command Output*")))
(with-current-buffer output-buffer
(erase-buffer)
(insert region-string)
(shell-command-on-region (point-min) (point-max) shell-command t t))
@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.]+)")