Skip to content

Instantly share code, notes, and snippets.

View shayelkin's full-sized avatar

Shay Elkin shayelkin

View GitHub Profile
@shayelkin
shayelkin / threading.lisp
Created January 19, 2024 03:21
A lisp implementation of Clojure's threading macro
(defmacro -> (form &rest forms)
(reduce
(lambda (acc next)
(if (listp next)
(list* (car next) acc (cdr next))
(list next acc)))
forms
:initial-value form))
@shayelkin
shayelkin / cached-goenv-init.sh
Created May 1, 2024 17:47
Speed up goenv init by caching it
#!/bin/sh
# Running "eval $(goenv init -)" can take more than 100ms on a recent Macbook, most of that time spent
# on generating the commands, rather than evaluating them. But those commands are the same every time,
# so this generates those once, and caches it to disk. It doesn't check for freshness though, so it is
# prudent to delete ~/.goenv.cached.init.sh after updating goenv.
# To use: replace the call to "eval $(goenv init -)" with the following code
_cached_goenv_init() {
@shayelkin
shayelkin / port-upgrade.sh
Created August 23, 2024 19:30
Update all installed MacPorts packages
#!/bin/zsh
sudo port selfupdate
outdated_ports=$(port echo outdated)
if [[ -z $outdated_ports ]]; then
exit 0
fi
@shayelkin
shayelkin / Eurkea_Mignon_drip_tray.scad
Created January 10, 2025 21:23
Drip tray for Eurkea Mignon grinders
// Thickness of the bottom of the tray itself.
base_z = 0.5;
// The width of the rim around the tray.
rim_width = 2;
// Height of the rim around the tray. This is the height over base_z.
rim_z = 2;
// Length of the drip tray (not including the notch).