Skip to content

Instantly share code, notes, and snippets.

View SuperAuguste's full-sized avatar

Auguste Rame SuperAuguste

View GitHub Profile
const std = @import("std");
pub fn SwitchJoiner(comptime T: type, comptime Tuple: type) fn (values: Tuple) T {
return struct {
fn switchJoin(values: Tuple) T {
comptime var bit_size: usize = 0;
var res: T = 0;
inline for (values) |val| {
res |= @as(T, switch (@typeInfo(@TypeOf(val))) {
@SuperAuguste
SuperAuguste / typetracker.zig
Created October 27, 2023 16:25
Sequentially number type tracking in Zig
const std = @import("std");
/// Tracks types and returns unique IDs for them at compile time
///
/// Takes a "unique" parameter to prevent Id types from being interchangeable
/// between different Typetrackers
pub fn Typetracker(comptime IntType: type, comptime unique: @TypeOf(opaque {})) type {
_ = unique;
return struct {
pub const Id = enum(IntType) { _ };
@SuperAuguste
SuperAuguste / build.zig
Created October 10, 2023 03:52
comptime random hack
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "sandbox",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
@SuperAuguste
SuperAuguste / A.py
Created June 11, 2023 01:49
Heheh r
# 0 0
# 0 1
# 0 2
# 0 3
# 0 4
# 1 1
# 1 2
# 1 3
# 1 4
# 2 2
@SuperAuguste
SuperAuguste / bruh.js
Last active April 25, 2023 00:14
bruh
document.write(`<iframe width="1519" height="529" src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1" title="Rick Astley - Never Gonna Give You Up (Official Music Video)" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`)
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.1/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>