Skip to content

Instantly share code, notes, and snippets.

@Munksgaard
Munksgaard / default.nix
Created February 3, 2026 12:10
Nix driver package for Brother DCPL2627DW printer
{
stdenv,
fetchurl,
dpkg,
makeWrapper,
coreutils,
ghostscript,
gnugrep,
gnused,
which,
fn unpipe(f: fn(a) -> b, g: fn() -> a) -> b {
f(g())
}
pub fn inc_and_reverse(xs: List(Int)) -> List(Int) {
use <- unpipe(list.reverse)
use x <- list.map(xs)
x + 1
}
@Munksgaard
Munksgaard / 2025_06_08_libtailscale_elixir.md
Created June 9, 2025 14:36
Your Phoenix application, directly on your Tailnet

Your Phoenix application, directly on your Tailnet

I've spent way too much time building an Elixir-wrapper for libtailscale and an accompanying chat app, because Elixir and libtailscale seem meant for each other.

I've been following Tailscale for a while now. Obviously, they're darlings of HN, their business strategy appeals to me and the product is great. I'm using it both for my personal servers and for managing

@Munksgaard
Munksgaard / phoenix-nix-tailwind.md
Created May 16, 2025 07:20
Building phoenix release using nix (the tailwind parts)

In general, follow the guides in the nixpkgs manual.

# config/config.exs
# Configure tailwind (the version is required)
config :tailwind,
  version: "3.4.12",
  # Use MIX_TAILWIND_PATH to find the tailwind binary
  path: System.get_env("MIX_TAILWIND_PATH"),
 default: [
defmodule(Math.Foo, [{:do, [@foo(3), def(foo(b), [{:do, @foo + b}]), def(add(b), [{:do, @foo + b}])]}]); alias(Math.Foo); IO.puts(Foo.add(2))
@Munksgaard
Munksgaard / flake.nix
Created February 14, 2024 18:33
elixir 1.17-dev
{
description = "elixir";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {

Futlixir

Mix.install([
  {:nx, "~> 0.6"},
  {:exla, "~> 0.6"}
])

Nx.global_default_backend(EXLA.Backend)
# Change this according to your device
################
# Variables
################
# Date and time
date_and_week=$(date "+%Y/%m/%d (w%V)")
current_time=$(date "+%H:%M:%S")
#############
@reserved_characters ~c":/?#[]@!$&'()*+,;="
@spec is_char_reserved(byte) :: boolean
defguard is_char_reserved(character) when character in @reserved_characters
MIX_ENV=prod mix run bench.exs
Operating System: Linux
CPU Information: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
Number of Available Cores: 8
Available memory: 15.30 GB
Elixir 1.14.3
Erlang 25.3
Benchmark suite executing with the following configuration:
warmup: 2 s