Skip to content

Instantly share code, notes, and snippets.

@andrewrk
andrewrk / zig-perf.md
Last active July 10, 2022 09:14
some measurements of zig self-hosted compiler perf

Building a debug build of Zig:

zig build -Dskip-install-lib-files

Measurements taken on:

  • Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  • 0.10.0-dev.2381+39ebfedd2

stage1

@columbarius
columbarius / debug-pipewire-screencast.sh
Last active October 12, 2025 19:45
PipeWire Screencast Info
#!/bin/sh
pw-dump | jq -r '[.[] | select(.info.props."node.name" | IN("firefox","gnome-shell","kwin_wayland","obs","xdg-desktop-portal-wlr","xdp-screencast.py")) | .id] as $pw_node_ids | [ .[] | select(.info.props."node.id" | IN($pw_node_ids[])) | .id ] as $pw_port_ids | .[] | select(.id | IN(($pw_node_ids + $pw_port_ids)[]))'
@mitchellh
mitchellh / Atlas.zig
Last active May 5, 2025 14:32
Bin-packed texture atlas implementation in Zig. https://en.wikipedia.org/wiki/Texture_atlas
//! Implements a texture atlas (https://en.wikipedia.org/wiki/Texture_atlas).
//!
//! The implementation is based on "A Thousand Ways to Pack the Bin - A
//! Practical Approach to Two-Dimensional Rectangle Bin Packing" by Jukka
//! Jylänki. This specific implementation is based heavily on
//! Nicolas P. Rougier's freetype-gl project as well as Jukka's C++
//! implementation: https://github.com/juj/RectangleBinPack
//!
//! Limitations that are easy to fix, but I didn't need them:
//!
@fakuivan
fakuivan / tplink_tlsg108e_v1_config_backup.md
Created February 20, 2022 20:07
TP-Link TL-SG108E V1 config backup format
AMD Ryzen 7 5700G with Radeon Graphics
@iszn11
iszn11 / image.zig
Last active August 4, 2021 10:39
PNG decoder based on stb_image.h implementation.
const std = @import("std");
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
// PNG decoder based on stb_image.h implementation, including zlib decompressor. A bit more zig-friendly than original. Compared to
// stb_image.h:
// - only decodes from a slice (filename or callbacks not supported)
// - only decodes to 8-bit channels (any other bit depth is converted, no decoding to 16-bit or float samples)
// - requires an allocator (zig style)
// - doesn't support interlaced images
@Hermann-SW
Hermann-SW / q32.pico.c
Last active July 5, 2022 18:41
q32.c adapted for Raspberry Pico
/* determine minimal prime 3x3 magic square; for more details see bottom */
#include <stdio.h>
#include "pico/stdlib.h"
#include <sys/time.h>
#include <stdint.h>
uint32_t B[]={0x35145105,0x4510414,0x11411040,0x45144001};
#define Prime(i) ((B[(i)>>5] & (0x80000000UL >> ((i)%32))) != 0)
@WebReflection
WebReflection / my-libraries-in-bytes.md
Last active September 24, 2021 22:03
My libraries in bytes

Toward better libraries

I am recently re-branding my libraries as µ (micro), refactoring these when necessary, dropping IE < 11 support, improving the logic where possible, or providing a better, more robust, or faster, API.

In few words, on the right there is the modern version of libraries I've used for the last ~5 years in production or for side projects, and I suggest anyone having one of the earlier dependencies, to have a look at their modern, micro, counterpart.

How to read these tables

All sizes are minified, brotli compressed, and representing these two files, when possible:

@starfleetcadet75
starfleetcadet75 / FindInvalidMemoryReferences.java
Last active March 28, 2025 10:15
Ghidra script that searches all instructions for any references to undefined memory addresses. Useful for reversing firmware when you are still determining the correct memory mappings. Invalid addresses could indicate that you need to add a new segment at that address.
// Searches all instructions for any references to undefined memory addresses.
// Useful for reversing firmware when you are still determining the correct memory mappings.
// Invalid addresses could indicate that you need to add a new segment at that address.
//
// @author starfleetcadet75
// @category Search
// @keybinding
// @menupath
// @toolbar