Skip to content

Instantly share code, notes, and snippets.

@joe-warren
Last active March 8, 2026 19:12
Show Gist options
  • Select an option

  • Save joe-warren/6e594553206e254774f78a6402711993 to your computer and use it in GitHub Desktop.

Select an option

Save joe-warren/6e594553206e254774f78a6402711993 to your computer and use it in GitHub Desktop.
Permutive Kafka Migration Keyring
#!/usr/bin/env stack
{- stack script --resolver lts-24.11
--package linear
--package lens
--package waterfall-cad
--extra-dep waterfall-cad-0.6.1.0
--extra-dep opencascade-hs-0.6.1.0
-}
import qualified Waterfall as W
import Linear
import Control.Lens ((^.))
import Data.Function ((&))
hollowCylinder :: Double -> Double -> Double -> W.Solid
hollowCylinder innerR outerR height =
let a = W.centeredCylinder
& W.scale (V3 outerR outerR height)
b = W.centeredCylinder
& W.scale (V3 innerR innerR (height * 2))
in a `W.difference` b
text :: [String]
text =
[ "Permutive"
, "Kafka"
, "Migration"
, "2026"
]
arcText ::W.Font -> Double -> Double -> String -> W.Solid
arcText font r h t =
let l (c, theta) =
W.text font [c]
& W.prism h
& W.translate (r *^ unit _y)
& W.rotate (unit _z) (negate theta)
in mconcat $ l <$> zip t [0, 0.4 ..]
kafkaLogo :: W.Font -> W.Solid
kafkaLogo font =
let height = 10/4.5
smallCyl =
hollowCylinder 1 2 height
& W.chamfer 0.2
spoke =
W.centeredCube
& W.translate (unit _x ^* 0.5)
& W.scale (V3 2 0.75 height)
& W.translate (unit _x ^* 2.25)
leg (t, theta) = smallCyl
& W.union (arcText font 1.5 (height/2 + 0.6/4.5) t)
& W.rotate (unit _z) (theta - pi/2)
& W.translate (unit _x ^* 6)
& W.union spoke
& W.rotate (unit _z) (negate theta)
legs = leg <$> zip text [0, pi/3 ..]
centerCyl =
hollowCylinder 1.51 3.01 height
& W.chamfer 0.2
in mconcat (centerCyl : legs)
ornament :: W.Font -> W.Solid
ornament font =
let
scale = 4.5
logo = W.uScale scale (kafkaLogo font)
holeR = 5.5/2
holes = mconcat
[ W.unitCylinder
& W.scale (V3 holeR holeR 2.2)
& W.translate (unit _z ^* (0.6-5))
& W.translate (unit _x ^* ( i * 2.25 * scale))
| i <- [1, -1]
]
in logo `W.difference` holes
main :: IO ()
main = do
font <- W.fontFromPath "ShareTechMono-Regular.ttf" 1.2
W.writeSTL 0.005 "permutive-kafka-badge.stl" (ornament font)
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Display the source blob
Display the rendered blob
Raw
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment