Skip to content

Instantly share code, notes, and snippets.

View rrohrer's full-sized avatar
💭
writing a lot of rust

rainroar rrohrer

💭
writing a lot of rust
  • Santa Cruz, CA
View GitHub Profile
@tokenbender
tokenbender / train_modal_standalone.py
Last active September 1, 2025 01:46
standalone serverless simple character level transformer
import os
import sys
import time
import math
import pickle
from contextlib import nullcontext
from pathlib import Path
import subprocess
from dataclasses import dataclass
import inspect
@alichraghi
alichraghi / zig-shaders.md
Last active September 13, 2025 08:43
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),
@karlseguin
karlseguin / test_runner.zig
Last active September 4, 2025 11:35
Custom Zig Test Runner, better ouput, timing display, and support for special "tests:beforeAll" and "tests:afterAll" tests
// This is for the Zig 0.15.
// See https://gist.github.com/karlseguin/c6bea5b35e4e8d26af6f81c22cb5d76b/1f317ebc9cd09bc50fd5591d09c34255e15d1d85
// for a version that workson Zig 0.14.1.
// in your build.zig, you can specify a custom test runner:
// const tests = b.addTest(.{
// .root_module = $MODULE_BEING_TESTED,
// .test_runner = .{ .path = b.path("test_runner.zig"), .mode = .simple },
// });
@dreamsmasher
dreamsmasher / overload.rs
Created October 2, 2022 00:16
Function Overloading in Rust
#![feature(fn_traits, unboxed_closures)]
macro_rules! orelse {
(($($lhs:tt)+), $rhs:tt) => {$($lhs)+};
((), ($($rhs:tt)*)) => {$($rhs)*}
}
macro_rules! overload {
(
$v:vis fn $fn_name:ident {
@vnl
vnl / MediaDownloader.yaml
Created October 5, 2021 20:10
Docker-compose file which shows how to set up Sonarr, Radarr, Prowlarr, Lidarr, Jackett, QBittorrent and a VPN container so that all all traffic from the containers is routed through the VPN. Also includes get_iplayer containers, which is not routed through the VPN.
version: "3"
services:
vpn:
image: qmcgaw/gluetun
container_name: vpn
cap_add:
- NET_ADMIN
ports:
- 8888:8888/tcp # HTTP proxy
- 8388:8388/tcp # Shadowsocks
@Yanrishatum
Yanrishatum / hxsl-cheatsheet.md
Last active July 21, 2025 06:20
HXSL cheat-sheet

HXSL cheat-sheet

This is a WIP of a cheat-sheet that I will finish Eventually™

Types

Mapping of the shader types to Heaps types:

Float = Float
Int = Int
Bool = Bool
@bernardomig
bernardomig / README.md
Last active October 29, 2023 15:32
Setup podman and nvidia-container-runtime

How to setup nvidia-container-runtime and podman/runc

Podman is such a cool project! However, there is no easy way to setup the nvidia-container-runtime and podman so that we can run unprivileged container in a gpu host. This is specially interesting in environments with multiple people accessing the same host (strong isolation between containers!!!).

Steps to setup the whole system

  1. Install podman and friends (buildah and skopeo)

Ubuntu: add-apt-repository -y ppa:projectatomic/ppa && apt install podman buildah skopeo

@larsiusprime
larsiusprime / PakLibrary.hx
Last active October 25, 2021 07:25
Pak & Unpack system
package;
import haxe.io.Bytes;
import lime.utils.UInt8Array;
import lime.graphics.Image;
import lime.graphics.ImageBuffer;
import openfl.Assets.AssetLibrary;
import openfl.Assets;
import openfl.Lib;
import openfl.utils.ByteArray;