Skip to content

Instantly share code, notes, and snippets.

View trikko's full-sized avatar

Andrea Fontana trikko

View GitHub Profile
@trikko
trikko / gridfinity.hcad
Created October 22, 2026 20:33
Gridfinity example
// Gridfinity bin and lid: cells of 42 mm, heights in
// units of 7 mm, a stacking lip on top so another bin
// locks onto it. The bin can be split in compartments,
// with a finger scoop at the front and a shelf for a
// label at the back. The lid sits in the stacking lip
// and carries an engraved label.
// Both print without supports: the bin standing as it
// is, the lid upside down, its top on the bed.
//
// Try it:
@trikko
trikko / dlang_static.md
Created November 2, 2024 14:09
Build dlang fully static executable

Docker with Alpine+MUSL

FROM alpine:latest
RUN apk add gcc musl-dev ldc dub llvm-libunwind-static openssl-libs-static gzip upx

On dub.json

"dflags": ["--nodefaultlib", "-static"],
"subConfigurations": {
@trikko
trikko / uuid.d
Last active April 23, 2026 10:33
UUID (v3, v4, v5, v7) in dlang
import std.stdio : writeln;
void main() {
writeln("UUIDv4 (random): ", UUIDv4!string());
writeln("UUIDv7 (timestamp + counter + random): ", UUIDv7!string());
writeln("UUIDv7 (timestamp + counter + random): ", UUIDv7!string());
writeln("UUIDv3 (w/ null namespace): ", UUIDv3!string("pizza"));
writeln("UUIDv5 (w/ null namespace): ", UUIDv5!string("pizza"));
writeln("UUIDv5 (w/ custom namespace): ", UUIDv5!string("pizza", [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]));
writeln("UUIDv5 (w/ OID namespace): ", UUIDv5!string("pizza", UUIDNamespace.OID));
@trikko
trikko / Dockerfile
Created January 30, 2023 17:44
Serverino + Docker
FROM alpine:latest
RUN apk update && apk upgrade
RUN apk add dmd dub cmake gcc make musl-dev
RUN ln -fs /usr/share/zoneinfo/Europe/Rome /etc/localtime
RUN apk add tzdata
RUN adduser -D -S www-data
WORKDIR /source
@trikko
trikko / raylib-video.c
Last active May 7, 2026 07:36
How to render a video with raylib and gstreamer
#include "raylib.h"
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
GstElement* createPipeline(const char* filename)
{
GError *error;
gchar *pipelineString = g_strdup_printf ("filesrc location=%s ! tee name=t ! queue ! decodebin ! videoconvert ! appsink name=output caps=video/x-raw,format=RGBA,pixel-aspect-ratio=1/1 t. ! queue ! decodebin ! audioconvert ! audioresample ! autoaudiosink", filename);
GstElement *pipeline = gst_parse_launch (pipelineString, &error);