Skip to content

Instantly share code, notes, and snippets.

View silversquirl's full-sized avatar

Silver silversquirl

  • Graphcore
View GitHub Profile
@alichraghi
alichraghi / zig-shaders.md
Last active June 23, 2025 04:14
Zig Shaders

What does it look like?

Here is a simple fragment shader with uniform buffers:

const std = @import("std");
const gpu = std.gpu;

const UBO = extern struct {
    object_color: @Vector(4, f32),
    light_color: @Vector(4, f32),
  1. Every atomic object has a timeline (TL) of writes:

    • A write is either a store or a read-modify-write (RMW): it read latest write & pushed new one.
    • A write is either tagged Relaxed, Release, or SeqCst.
    • A read observes some write on the timeline:
      • On the same thread, future reads can't go backwards on the timeline.
      • A read is either tagged Relaxed, Acquire, or SeqCst.
      • RMWs can also be tagged Acquire (or AcqRel). If so, the Acquire refers to the "read" portion of "RMW".
  2. Each thread has its own view of the world:

  • Shared write timelines but each thread could be reading at different points.
@AI-nsley69
AI-nsley69 / installation.md
Last active September 18, 2023 01:50
Setting up a free fabric server (with recommendations)

Questions?

If you have read the entirety of this guide or you're confused about any part, feel free to ask in my discord server. Please check the troubleshooting & faq section before asking. Your issue or question might've already been covered here. I try my best to keep this guide up to date, but I do forget about it at times and I could also miss anything in the guide when updating it to a new version. Please do your own research (for mods in particular) and try using newer versions of the mods/software available if it breaks!

Used commands

This is a small list to explain the linux commands being used in this guide.

cd - This allows us to change our working directory (also known as ./) into another directory, by default, you will be in your home directory (/home/user/ also known as ~). If you wish to go to a parent directory (the directory which your current directo

@SpexGuy
SpexGuy / vla.zig
Last active June 18, 2021 15:40
VLA types implemented in user space in Zig
const std = @import("std");
pub fn VLA(comptime ArrayType: type, comptime ParentStruct: type, comptime fieldName: []u8) type {
return struct {
const headerSize: usize = comptime std.mem.alignForward(@sizeOf(ParentStruct), @alignOf(ArrayType));
const headerAlign: u29 = comptime std.math.max(@alignOf(ArrayType), @alignOf(ParentStruct));
len: usize,
pub fn get(self: *@This()) []ArrayType {
@EDDxample
EDDxample / Lattice Basics.ipynb
Last active March 10, 2025 19:46
Lattice Basics for RNG Seed finding
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Drovolon
Drovolon / 1.14.x-chunk-loading-final.md
Created August 11, 2019 14:36
An overview of chunk loading mechanics in Minecraft 1.14, tested empirically in 1.14.4.

1.14.x Chunk Loading

Chunk loading operates differently in 1.14 than in previous Minecraft versions. This document is intended to be an overview of the 1.14 system.

In 1.14, chunk loading starts with tickets. A ticket is:

  • a ticket type
  • a load level
  • optionally, a time-to-live
uint wang_hash(uint seed)
{
seed = (seed ^ 61) ^ (seed >> 16);
seed *= 9;
seed = seed ^ (seed >> 4);
seed *= 0x27d4eb2d;
seed = seed ^ (seed >> 15);
return seed;
}
@tommyettinger
tommyettinger / mulberry32.c
Last active May 28, 2025 18:49
Mulberry32 PRNG
/* Written in 2017 by Tommy Ettinger ([email protected])
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include <stdint.h>