Skip to content

Instantly share code, notes, and snippets.

View hauleth's full-sized avatar
⌨️
Click! Clack!

Łukasz Jan Niemier hauleth

⌨️
Click! Clack!
View GitHub Profile
-module(fizzbuzz).
-export([main/0]).
main() ->
Types = [
{3, "Fizz"},
{5, "Buzz"}
],
io:put_chars(run(100, Types)).
{
"nodes": {
"devenv": {
"inputs": {
"flake-compat": "flake-compat",
"nix": "nix",
"nixpkgs": [
"nixpkgs"
],
"poetry2nix": "poetry2nix",
defmodule Langusta.Site.CleanURL do
defmodule Entry do
defstruct [
:url_pattern,
rules: [],
raw_rules: [],
exceptions: [],
redirections: []
]
{config, pkgs, ...}: let
domain = "hauleth.dev";
mail-domain = "mail.${domain}";
sieve-data = let
stalwart-mail = config.services.stalwart-mail.package;
in pkgs.stdenvNoCC.mkDerivation {
pname = "stalwart-mail-sieve-data";
inherit (stalwart-mail) version src;
dontBuild = true;
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
@hauleth
hauleth / templates.zig
Created January 10, 2024 16:53
Zig template engine
const std = @import("std");
const Type = std.builtin.Type;
pub fn Templates(comptime entries: anytype) type {
const type_info = @typeInfo(@TypeOf(entries)).Struct;
var enum_fields: [type_info.fields.len]Type.EnumField = undefined;
for (type_info.fields, 0..) |field, idx| {
defmodule Mix.Tasks.Man do
@moduledoc """
Print documentation for given Elixir term.
"""
@shortdoc "Show manual for term"
use Mix.Task
require IEx.Helpers
{
"nodes": {
"devenv": {
"inputs": {
"flake-compat": "flake-compat",
"nix": "nix",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
all: test
@hauleth
hauleth / bellman_ford.ex
Created December 12, 2022 13:47
Bellman-Ford implementation using ETS
defmodule BellmanFord2 do
@moduledoc """
The Bellman–Ford algorithm is an algorithm that computes shortest paths from a single
source vertex to all of the other vertices in a weighted digraph.
It is capable of handling graphs in which some of the edge weights are negative numbers
Time complexity: O(VLogV)
"""
@type distance :: %{Graph.vertex_id() => integer}