Skip to content

Instantly share code, notes, and snippets.

@lynaghk
lynaghk / elisp.el
Created March 29, 2024 08:22
Copy markdown from Emacs, paste formatted content directly into GMail
(defun formatted-copy ()
"Export region to HTML, and copy it to the clipboard."
(interactive)
(save-window-excursion
(let* ((buf (org-export-to-buffer 'html "*Formatted Copy*" nil nil t t))
(html (with-current-buffer buf (buffer-string))))
(with-current-buffer buf
(shell-command-on-region
(point-min)
(point-max)
@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 / SketchSystems.spec
Last active July 28, 2023 20:38
Search Bar*
Search Bar*
Inactive*
focused -> Active
Active
canceled -> Inactive
typed -> Text Entry
Empty*
@lynaghk
lynaghk / SketchSystems.spec
Last active July 4, 2023 11:35
# A traffic light
# A traffic light
Powered
power failed -> Unpowered
Green*
tick -> Yellow
Yellow
tick -> Red
@lynaghk
lynaghk / SketchSystems.spec
Last active June 23, 2023 17:39
Egg Timer*
Egg Timer*
Stopped*
wind forward -> Done?
Ticking
wind forward -> Done?
wind backward -> Done?
tick -> Done?
Done?
@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
@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 / 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.

@lynaghk
lynaghk / gist:f6a25748ca748ddb122146eb7e2e3a3c
Created September 25, 2018 16:53
Sketch systems grammar EBNF
<statechart> = (state / <whitespace> / <comments>)+
state = comments? state-name <whitespace>? <newline> block?
transition = comments? event-name <whitespace>? <'->'> <whitespace>? state-name <newline>
<block> = indent (state / transition / <whitespace> / <comments>)+ dedent
comments = comment (<newline> comment)* <newline>
<comment> = <'#'> #".*"