Skip to content

Instantly share code, notes, and snippets.

View maxsei's full-sized avatar

Maximillian Schulte maxsei

View GitHub Profile
@maxsei
maxsei / kind.nix
Created December 11, 2025 00:55
kind is not kind on nixos
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
environment.systemPackages = with pkgs; [
kind
@maxsei
maxsei / flake.nix
Created December 10, 2025 05:46
flake nix for deploying with terranix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
terranix.url = "github:terranix/terranix";
terranix.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
sops-nix = {
url = "github:Mic92/sops-nix";
@maxsei
maxsei / strings.c
Last active October 25, 2024 18:51
// Generated by `wit-bindgen` 0.33.0. DO NOT EDIT!
#include "strings.h"
#include <stdlib.h>
#include <string.h>
// Exported Functions from `x:strings/upper`
__attribute__((__weak__, __export_name__("cabi_post_x:strings/upper#upper")))
void __wasm_export_exports_x_strings_upper_upper_post_return(uint8_t * arg0) {
switch ((int32_t) (int32_t) *((uint8_t*) (arg0 + 0))) {
@maxsei
maxsei / strings.c
Last active October 25, 2024 18:43
// Generated by `wit-bindgen` 0.33.0. DO NOT EDIT!
#include "strings.h"
#include <stdlib.h>
#include <string.h>
// Exported Functions from `x:strings/upper`
__attribute__((__weak__, __export_name__("cabi_post_x:strings/upper#upper")))
void __wasm_export_exports_x_strings_upper_upper_post_return(uint8_t * arg0) {
switch ((int32_t) (int32_t) *((uint8_t*) (arg0 + 0))) {
@maxsei
maxsei / out.txt
Created October 12, 2024 05:10
MultiArrayList for unions does not save bytes in zig 0.13.0
$ !zig build test
test
+- run test stderr
total allocated bytes: 4608
total allocated bytes: 4672
total allocated bytes: 4672
tag type: @typeInfo(root.test_0.Foo).Union.tag_type.?
tag 0 addr: @typeInfo(root.test_0.Foo).Union.tag_type.?@7ffff7ef7200
tag 1 addr: @typeInfo(root.test_0.Foo).Union.tag_type.?@7ffff7ef7201
@maxsei
maxsei / welford.zig
Created September 19, 2024 16:58
welfords online variance algorithm
const std = @import("std");
pub fn main() void {
const input1 = [_]f32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
var mean: f32 = 0;
var variance: f32 = 0;
for (input1, 0..) |v, count| {
const delta = v - mean;
mean += delta / @as(f32, @floatFromInt(count + 1));
const delta2 = v - mean;
@maxsei
maxsei / id_obfuscate.go
Last active August 22, 2024 23:11
Nice way of obfuscating database ids https://go.dev/play/p/4t9Ej8xOG5C
package main
import (
"bytes"
"encoding/base32"
"encoding/binary"
"fmt"
"io"
)
@maxsei
maxsei / debug_mutex.go
Created August 21, 2024 18:56
debug mutex lol
package main
import (
"fmt"
"runtime"
"sync"
)
func NewDebugMutex() sync.Locker {
return &debugMutex{}
@maxsei
maxsei / device_magnager_api.go
Created July 17, 2024 22:54
device manager api
package main
import (
"database/sql"
"errors"
"fmt"
"io"
"slices"
"sync"
"time"
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
schema: "./graph/*.graphql",
documents: ["./app/graph/*.gql"],
generates: {
"./app/graph/types.ts": {
config: {
useTypeImports: true,