Skip to content

Instantly share code, notes, and snippets.

View Brugarolas's full-sized avatar

Andrés Brugarolas Brugarolas

View GitHub Profile
@Brugarolas
Brugarolas / AllocaStackAllocator.hpp
Last active May 3, 2024 02:58
AllocaStackAllocator.hpp
/**
* @file AllocaStackAllocator.hpp
* @brief AllocaStackAllocator for fast, temporary allocations on a per-thread basis.
* @author Andrés Brugarolas
*
* The StackAllocator is designed to provide efficient, alloca stack memory allocation
* within a pre-allocated memory block. It supports fast allocation and deallocation,
* caching of frequently used block sizes, and management of free space using an AVL tree.
*/
@Azoy
Azoy / atomics.md
Last active May 5, 2024 22:44
Low-Level Atomic Operations
@JiayinCao
JiayinCao / tiny_fiber.h
Last active December 8, 2025 12:16
Tiny Fiber ( A razor thin cross platform fiber library )
/*
MIT License
Copyright (c) 2023 Jiayin Cao
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@torcado194
torcado194 / cleanEdge-shadertoy.glsl
Last active January 20, 2026 18:26
cleanEdge, a pixel art upscaling algorithm for clean rotations
/*** MIT LICENSE
Copyright (c) 2022 torcado
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
const std = @import("std");
const Channel = struct {
value: u32 = undefined,
frame: anyframe,
};
fn generate(out_channel: **Channel) void {
var ch = Channel{ .frame = @frame() };
suspend out_channel.* = &ch;
@kprotty
kprotty / sync.rs
Last active March 20, 2024 16:11
mod futex {
use std::{sync::atomic::AtomicU32, time::Duration};
pub fn wait(_ptr: &AtomicU32, _cmp: u32, _timeout: Option<Duration>) -> bool {
unimplemented!("TODO")
}
pub fn wake(_ptr: *const AtomicU32, _max_wake: u32) {
unimplemented!("TODO")
}
@kprotty
kprotty / sync.go
Last active March 20, 2024 16:11
Crossplatfomr futex and rwlock for Go
package main
import (
"sync/atomic"
"unsafe"
)
type mutex struct {
key uintptr
}
@sts10
sts10 / rust-command-line-utilities.markdown
Last active January 24, 2026 15:37
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
const std = @import("std");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer std.debug.assert(gpa.deinit());
const allocator = &gpa.allocator;
const num_threads = std.math.max(1, (std.Thread.getCpuCount() catch 1) / 2);
const epolls = try allocator.alloc(std.os.fd_t, num_threads);
defer allocator.free(epolls);
@zengxinhui
zengxinhui / convert2arch_arm.sh
Last active January 15, 2026 11:45
Replace Oracle Cloud Linux with Arch Linux ARM remotely
[02/25/2025]
Refs:
1. http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz
2. https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/aarch64/alpine-virt-3.21.3-aarch64.iso
3. https://wiki.alpinelinux.org/wiki/Replacing_non-Alpine_Linux_with_Alpine_remotely
4. https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system
5. https://archlinuxarm.org/platforms/armv8/generic
See also: