Skip to content

Instantly share code, notes, and snippets.

$fn = 90;
control_points = [[0, 0], [10, 0], [20, 20], [30, 00], [40, 0]];
function line(end_points, t) = end_points[0]+t*(end_points[1]-end_points[0]);
function bezier(control_points, t) = len(control_points) == 2 ?
line(control_points, t) :
bezier([
for (i = [0: len(control_points)-2])
@cyber-murmel
cyber-murmel / __main__.py
Last active May 14, 2023 18:40
Python CLI program template
#!/usr/bin/env python3.10
from argparse import ArgumentParser, Action, FileType, ArgumentError, ArgumentTypeError, Namespace
from logging import debug, info, warning, error, exception
from logging import DEBUG, INFO, WARNING, ERROR
from coloredlogs import install as color_log
def parse_arguments():
parser = ArgumentParser(
description="",
@cyber-murmel
cyber-murmel / shell.nix
Last active March 14, 2024 12:17
Nix Shell for Embedded Rust on RP2040
let
nixpkgs_rev = "51063ed4f2343a59fdeebb279bb81d87d453942b"; # nixos-23-11 on 2024-03-13
fenix_rev = "df74cae97f59a868ad355af6a703e7845d0ae648"; # main on 2024-03-13
in
{ pkgs ? import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${nixpkgs_rev}.tar.gz") { }
, fenix ? import (builtins.fetchTarball "https://github.com/nix-community/fenix/archive/${fenix_rev}.tar.gz") { }
}:
with pkgs;
Download the [CD image archive](https://archive.org/details/LegoLoco).
```shell
# Turn into iso
bchunk Lego\ Loco.bin Lego\ Loco.cue Lego_Loco
# Turn iso into loop device and mount
udisksctl loop-setup -r -f Lego_Loco.iso01.iso
udisksctl mount -b /dev/loop0
```
$fn = 90;
function base_face (D_maj, H) = [for(angle = [0: 360/$fn: 360-360/$fn]) [
cos(angle)*(D_maj/2 + H/8 - abs((angle-180)/180* H)),
sin(angle)*(D_maj/2 + H/8 - abs((angle-180)/180* H))
]];
module rod(D_maj = 8, P = 1.25, h = 20) {
H = P * sin(60);
/* linear extude thread */