Skip to content

Instantly share code, notes, and snippets.

View dln's full-sized avatar
🚀

Daniel Lundin dln

🚀
View GitHub Profile
import * as THREE from 'three';
import { LineSegments2 } from 'three/examples/jsm/lines/LineSegments2.js';
import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial.js';
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry.js';
export function initPenteract(elem) {
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(95, elem.clientWidth / elem.clientHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({
alpha: true,
@dln
dln / DeepSeek R1 - CR Test.md
Created January 28, 2025 16:02
GPT 4o vs Deepseek R1 in practical application

Secure API Authentication with Argon2 in Rust

Created at 2025-01-28 15:38:18 UTC

@ 2025-01-28 15:38:18 UTC

in rust, how can we use argon2 in a challenge response api to force a client to do an expensive computation? the server has a longer-lived server key at hand. we want the server to not have to persist any state for challenges. we must guard against replay attacks.

@dln
dln / configuration.nix
Created June 16, 2024 19:20
dev container for systemd-nspawn
{ pkgs, modulesPath, ... }:
{
imports = [
(modulesPath + "/profiles/minimal.nix")
./nspawn-image.nix
];
boot.isContainer = true;
networking.hostName = "nixos";
curl https://github.com/cert-manager/cert-manager/releases/download/v1.14.5/cert-manager.yaml |
  cue import - -p kube -l '"_cert-manager"' -l 'strings.ToCamel(kind)' -l metadata.name -f
@dln
dln / .envrc
Last active April 30, 2024 18:21
Minimal example of using nix flake as "devshell" with direnv for a portable environment of various handy tools
if has nix; then
use flake
fi
@dln
dln / opentelemetry-collector.yaml
Created March 26, 2024 13:45
otel collector with prometheus remote write example
extensions:
zpages:
endpoint: 0.0.0.0:8080
receivers:
hostmetrics:
collection_interval: 3s
scrapers:
cpu:
load:
Host dln-dev
RemoteForward ${XDG_RUNTIME_DIR}/opener.sock ${XDG_RUNTIME_DIR}/opener.dln-dev.sock
@dln
dln / uuid.go
Last active February 18, 2023 14:30
UUID with extra encodings
package uuid
import (
"bytes"
"encoding/base64"
"strings"
"github.com/gofrs/uuid/v5"
)
// Proquints: Identifiers that are Readable, Spellable, and Pronounceable
// https://arxiv.org/html/0901.4016
package main
import (
"bytes"
"fmt"
"regexp"
"strings"
@dln
dln / _fail.sh
Last active February 7, 2023 13:32
% buf generate
google/protobuf/timestamp.proto:136:9:symbol "google.protobuf.Timestamp" already defined at timestamp.proto:136:9
google/protobuf/timestamp.proto:140:9:symbol "google.protobuf.Timestamp.seconds" already defined at timestamp.proto:140:9
google/protobuf/timestamp.proto:146:9:symbol "google.protobuf.Timestamp.nanos" already defined at timestamp.proto:146:9