Skip to content

Instantly share code, notes, and snippets.

@Zabrane
Zabrane / example.c
Created August 14, 2025 21:00 — forked from skeeto/example.c
Code for "Examples of quick hash tables and dynamic arrays in C"
// Examples of quick hash tables and dynamic arrays in C
// https://nullprogram.com/blog/2025/01/19/
// This is free and unencumbered software released into the public domain.
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@Zabrane
Zabrane / -sna86.asm
Created June 15, 2025 19:16 — forked from charlesastaylor/-sna86.asm
8086 assembly snake game!
; -------------------------------------------------------------------
; Sna86.
; An 8086 simulator snake!
; -------------------------------------------------------------------
;
; Assembly program intended to run in an 8086 simulator with functionaliy equal* to one made for homeworks
; up to Part 1 Episode 10 of the Peformance-Aware Programming Series (https://www.computerenhance.com/)
; by Casey Muratori. Demo - https://youtu.be/s_S4-QHeFMc.
;
; * mov, add, sub, cmp, je and jne was the target instructions. However I also added loop for convenience,
@Zabrane
Zabrane / _miniperf_readme.md
Created June 13, 2025 20:41 — forked from mmozeiko/_miniperf_readme.md
get PMU counter values with ETW, perf or kperf

MiniPerf

Example of how to capture CPU counters with ETW on Windows, perf on Linux or kperf on Apple.

Using ETW needs somewhat recently updated Windows 10 or 11. Not sure about exact version.

Currently tested on:

  • etw on Qualcomm Snapdragon X Elite, Windows 11, arm64
  • etw on AMD Zen 3, Windows 11 (with virtualization enabled in BIOS)
@Zabrane
Zabrane / otel.erl
Created April 30, 2025 20:48 — forked from maxlapshin/otel.erl
Opentelemetry tracing
-module(otel).
-include_lib("kernel/include/logger.hrl").
-include_lib("corelib/include/corelib_openapi.hrl").
-export([start_trace/0, start_trace/1]).
-export([end_trace/0]).
-export([start_span/0, start_span/1]).
-export([end_span/0, end_span/1]).
-export([setattrs/1, setname/1]).
-export([get_context/0, set_context/1]).
@Zabrane
Zabrane / Dockerfile
Created April 19, 2025 11:29 — forked from usrbinkat/Dockerfile
Pandoc Markdown to PDF
###############################################################################
# Use:
# - docker build --progress plain --tag docker.io/containercraft/pandoc -f Dockerfile .
# - docker run --rm -it --name pandoc --hostname pandoc --volume .:/convert docker.io/containercraft/pandoc my_document.md
###############################################################################
FROM docker.io/library/ubuntu:24.04
LABEL tag="pandoc"
ENV DEVCONTAINER="pandoc"
SHELL ["/bin/bash", "-c", "-e"]
@Zabrane
Zabrane / nginx-https-local.md
Created November 29, 2024 04:53 — forked from mehmetsefabalik/nginx-https-local.md
Enable https on your local environment with nginx

enable https on your local environment

install mkcert and create certificates

brew install mkcert
mkcert -install
@Zabrane
Zabrane / COWBOY_MIDDLEWARE.md
Created November 19, 2024 21:31 — forked from eproxus/COWBOY_MIDDLEWARE.md
How to Create a Cowboy Middleware

How to Create a Cowboy Middleware

Add an entry to the middlewares. Usually you want to keep the standard Cowboy handlers afterwards, but you can replace them if you want.

{ok, Pid} = cowboy:start_clear(ListenerName,
    [{port, Port}],
    #{
 env =&gt; #{dispatch =&gt; Dispatch},
@Zabrane
Zabrane / COWBOY_STREAM_HANDLER.md
Created November 19, 2024 21:31 — forked from eproxus/COWBOY_STREAM_HANDLER.md
How to Create a Cowboy Stream Handler

How to Create a Cowboy Stream Handler

Add your stream handler to the list of stream handlers in the protocol options:

{ok, Pid} = cowboy:start_clear(ListenerName,
    [{port, Port}],
    #{
        env => #{dispatch => Dispatch},
 stream_handlers =&gt; [my_stream_h, cowboy_compress_h, cowboy_stream_h]
@Zabrane
Zabrane / README.md
Created November 19, 2024 21:31 — forked from weaversam8/README.md
Cowboy Stream Handler Reference Implementation

Cowboy, the popular Erlang web server, has deprecated middleware and replaced the concept with stream handlers, a more flexible, but more complicated API. This page contains a documented reference implementation of a stream handler, to help others when developing their stream handlers in the future.

@Zabrane
Zabrane / shmem.c
Created September 26, 2024 15:47 — forked from maxlapshin/shmem.c
#include <sys/mman.h>
#include <sys/stat.h>
#include <erl_nif.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
static ErlNifResourceType* shmem_resource;