Skip to content

Instantly share code, notes, and snippets.

@aavogt
aavogt / Makefile
Last active June 6, 2026 16:55
dumbbel
SHELL = /bin/bash
OUT = $(shell basename `pwd`)
watch:
ulimit -v 1000000
set -m
trap 'pkill -P $$$$' EXIT INT TERM
pgrep f3d || f3d --watch $(OUT).step &
ls Makefile config.ini $(OUT)*.step | entr make $(OUT).gcode &
ghcid -r &
gcodeviewer $(OUT).gcode
@aavogt
aavogt / Color.hs
Created June 3, 2026 13:53
per face color WIP
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
-- | propagate face colors
module Rapids.Color
( setColor,
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE BlockArguments #-}
module Color where
-- import Waterfall.Internal.Solid
@aavogt
aavogt / Makefile
Last active May 22, 2026 17:21
hose barb cone cylinder union bug set k=1 in main.hs
SHELL = /bin/bash
OUT = $(shell basename `pwd`)
watch:
ulimit -v 1000000
set -m
trap 'pkill -P $$$$' EXIT
pgrep f3d || f3d --watch $(OUT).step &
ls Makefile config.ini $(OUT)*.step | entr make $(OUT).gcode &
ghcid -r &
gcodeviewer $(OUT).gcode
7663 , 788 , 722 , 779 , 854 , 193 , 194
*ELEMENT,TYPE=C3D6,ELSET=contactelements_st1_in1_at1_it2
7664 , 788 , 722 , 779 , 854 , 193 , 194
*ELEMENT,TYPE=C3D6,ELSET=contactelements_st1_in1_at1_it2
7665 , 788 , 722 , 779 , 854 , 193 , 194
*ELEMENT,TYPE=C3D6,ELSET=contactelements_st1_in1_at1_it2
7666 , 788 , 722 , 779 , 854 , 193 , 194
*ELEMENT,TYPE=C3D6,ELSET=contactelements_st1_in1_at1_it2
7667 , 788 , 722 , 779 , 854 , 193 , 194
*ELEMENT,TYPE=C3D6,ELSET=contactelements_st1_in1_at1_it2
@aavogt
aavogt / Rapids.hs
Created April 30, 2026 14:11
waterfall-cad cut to dimple
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE BlockArguments #-}
-- | cascade, waterfall, rapids
-- simplify waterfall-cad expressions by complicating the types and type errors
-- same as before with a fromInteger 0 case added
module Rapids (module Rapids, module Linear, module Control.Lens, module Waterfall) where
import Control.Lens hiding (prism)
@aavogt
aavogt / main.c
Created April 9, 2026 10:58
raylib turing pattern animation
// https://youtu.be/1A2gVRfUDPY
// start the window, resize it, press enter to start recording out.mp4
#ifndef RAYLIBD
#include "raygui.h"
#include "raylib.h"
#include "raymath.h"
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@aavogt
aavogt / mooney.sh
Created March 31, 2026 18:01
override the material in freecad's calculix input file with a rubber
echo =================
sed '/\*MATERIAL, NAME=MaterialSolid/{ n; N; c\
*HYPERELASTIC, NEO-HOOKE\
0.738,1e3
}' -i FEMMeshNetgen.inp
# freecad uses MPa,
# it converges for high values of *SURFACE BEHAVIOR
#
# https://rsmith.home.xs4all.nl/engineering/mooney-rivlin-rubber-data-for-calculix.html
@aavogt
aavogt / Rapids.hs
Last active March 10, 2026 14:13
simplify waterfall-cad expressions by complicating the types and type errors
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeOperators #-}
-- moved to https://github.com/aavogt/battery-adapter
-- | cascade, waterfall, rapids
-- simplify waterfall-cad expressions by complicating the types and type errors
module Rapids (module Rapids, module Linear, module Control.Lens, module Waterfall) where
import Control.Lens hiding (prism)
import Data.Maybe
import Data.Proxy (Proxy (..))
@aavogt
aavogt / PathState2D.hs
Last active December 13, 2025 01:25
2d polyline offset/thickness/closing for waterfall-cad-svg
-- | 2d version of https://gist.github.com/aavogt/8fb7162e572d72049748e1e42b12bbd2
--
-- Example output:
-- https://i.ibb.co/yFBtS903/cup.png
--
-- > p0 = execPath $
-- > do
-- > hliner 140
-- > vliner 160
-- > hliner 140