This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://link.springer.com/article/10.1007/s00170-006-0556-9 | |
library(pacman) | |
p_load(tidyverse, directlabels) | |
delta <- function(dh,alpha,hdt,dt,L,H) { | |
n <- H / dh | |
te <- hdt - dt | |
tibble(n=n, te=te, delta = n^3 * dh / (6*alpha*dt*(n-1)) * (1 - cos(3*alpha*L/(n*dh) * dt * (n-1)/n^2 ))) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Water Heater | |
For backpacking weight is an important constraint. Often boiling water is | |
enough for food and drink -- the food can be precooked and/or dehydrated etc. | |
such that it doesn't need to simmer. Therefore a stove and a pot could be | |
unnecessary, if a tube containing burning fuel is put inside a water bottle. | |
Methanol stoves where the pot has a shield ("caldera cone", jetboil etc.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Success[0.1, 0.1, 0.1, 0.1, 0.1, 0.09999999999999999, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.09999999999999999, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.09999999999999999, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]% | |
# The problem is probably the pressure tank composition equation. | |
# challenge Valliers 2004 sweep gas claim | |
# flanges are a,b,c,d etc. | |
# where "a" is upstream and "b" is downstream | |
# | |
## | |
using ModelingToolkit, Plots, DifferentialEquations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverlappingInstances #-} | |
{-# LANGUAGE IncoherentInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Layout where | |
import Raylib.Types | |
-- | Horizontal split | |
newtype H a = H a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Arrows #-} | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE TypeApplications #-} | |
-- ghcid -c 'ghci -isrc' src/Gui.hs -T'sync prog' | |
module Gui (module Gui) where | |
import LiveCoding | |
import Raylib.Util ( WindowResources, drawing ) | |
import Control.Monad.IO.Class ( MonadIO(liftIO) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE LambdaCase #-} | |
import Control.Lens.Plated | |
import Control.Lens | |
import Language.Haskell.TH | |
import Control.Lens.Extras | |
import Debug.Trace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_last_vertex(f): | |
"""Call a function with the newest vertex of the workplane as the first argument. | |
For example, add_last_vertex(Line)(p) is equivalent to Line((0,0), p), | |
if there was no last vertex, or if the last vertex was (0,0) | |
""" | |
def wrapped(*args, **kwargs): | |
context = Builder._get_context() | |
loclastpt = Vector() | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# NOINLINE runLoop #-} | |
runLoop :: IORef Bool | |
runLoop = unsafePerformIO (newIORef True) | |
main = rapid 0 \ k -> do | |
HGCode{..} <- return $ HGCode { input = "CE5S1_hex_grid.gcode" &= typ "INPUT" &= argPos 0, output = def &= typ "OUTPUT" &= argPos 1 } | |
lines <- createRef k "lines" $ runResourceT $ runConduit $ sourceFile input | |
.| decodeUtf8C | |
.| parseGcodeC @Pico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rain Barrel Simulation | |
I want to decide how big my rain barrel has to be. So I use NOAA's version of YYZ's weather | |
mkdir 71624099999 | |
for f in `seq 2006 2022`; do | |
wget https://ncei.noaa.gov/data/global-hourly/access/$f/71624099999.csv -O $f | |
done | |
rm 71624099999/2005.csv # is missing for some reason |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} | |
-- use linear V2 Float, V3 Float instead of raylib Vector2 Vector3 | |
module RaylibLinear | |
(module Raylib.Core, | |
module Raylib.Types, | |
module Raylib.Util, | |
module RaylibLinear) where | |
import Raylib.Core hiding (getMonitorPosition, getWindowPosition, getWindowScaleDPI, getMousePosition, getMouseDelta, getMouseWheelMoveV, getTouchPosition, getScreenToWorldRay) | |
import Raylib.Types hiding (Quaternion, Camera3D) |