Skip to content

Instantly share code, notes, and snippets.

$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 */
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
```
@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;
@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="",
$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 / picoprobe-dev-env-shell.nix
Last active April 4, 2023 15:25
picoprobe development environment
{
pkgs ?
import (builtins.fetchGit {
name = "nixos-22.11-2023_01_14";
url = "https://github.com/nixos/nixpkgs/";
ref = "refs/heads/nixos-22.11";
rev = "e285dd0ca97c264003867c7329f0d1f4f028739c";
}) {}
}:
size = 1;
dx = 25;
dy = 25;
module striped_square(size = 1, length = 1, num_stripes = 2) {
color("teal")
for(stripe = [1:num_stripes]) {
if((stripe % 2) == 1) {
polygon([[stripe-1, 0], [stripe,0], [0, stripe], [0,stripe-1]]*size/num_stripes);
}
@cyber-murmel
cyber-murmel / IceSL.nix
Last active April 23, 2024 15:27
Nix expression to build @shapeforge IceSL modeler and slicer https://icesl.loria.fr/
# build with `nix-build IceSL.nix`
{ pkgs ? import
(builtins.fetchGit {
name = "nixos-22.11-2023_01_01";
url = "https://github.com/nixos/nixpkgs/";
ref = "refs/heads/nixos-22.11";
rev = "913a47cd064cc06440ea84e5e0452039a85781f0";
})
{ }
@cyber-murmel
cyber-murmel / hardware-configration-infinitybook-pro-14.nix
Last active February 28, 2024 21:23
Nixos Hardware Config fo TUXEDO InfinityBook Pro 14 - Gen7 (MK1)
{ config, pkgs, lib, ... }:
let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
'';

This gist shows you how to install Minecraft Forge on a NixOS server. It is based on my NixOS on Hetzner Cloud gist.

  1. Add ./minecraft.nix to the imports in ~/repos/configuration/default.nix.
  2. Paste the following in ~/repos/configuration/minecraft.nix.
{ config, pkgs, ... }:

{
  users = {