Skip to content

Instantly share code, notes, and snippets.

View davidroman0O's full-sized avatar
👨‍🍳
Let me cook

0xAkraw davidroman0O

👨‍🍳
Let me cook
View GitHub Profile
@DanB91
DanB91 / README.txt
Last active November 28, 2022 04:57
Playdate Zig starting point
THIS GIST IS OUT OF DATE! Please use my new project template here to get started with Zig on Playdate:
https://github.com/DanB91/Zig-Playdate-Template
The rest of this is preservied for historical reasons:
This is a small snippet of some code to get you started for developing for the Playdate on Zig. This code should be used as a starting point and may not compile without some massaging. This code has only been tested out on macOS and you'll need to modify the addSharedLibrary() portion of build.zig to output a .dll or .so instead of a .dylib, depending on you platform.
This code will help you produce both an executable for the Playdate simulator and also an executable that actually run on the Playdate hardware.
@odnanref
odnanref / nomad.hcl
Created May 27, 2022 22:12
nomad.hcl sample config with glusterfs local directory
data_dir = "/opt/nomad/data"
bind_addr = "0.0.0.0"
server {
enabled = true
bootstrap_expect = 2
encrypt = "+HT7OPk+vyPzXQ="
}
@h3r2tic
h3r2tic / kajiya-all-the-jiggarays.md
Last active May 22, 2022 00:22
kajiya ray count breakdown

There are two types of rays being traced: shadow and "gbuffer". The latter return gbuffer-style information from hit points, and don't recursively launch more rays. Lighting is done in a deferred way. There is just one light: the sun.

  • irradiance cache: usually fewer than 16k cache entries:

    • main trace: 4/entry * (1 gbuffer ray + 1 shadow ray for the sun)
    • restir validation trace: 4/entry * (1 gbuffer ray + 1 shadow ray for the sun)
    • accessibility check: 16/entry short shadow rays
  • sun shadow pass: 1/pixel shadow ray

  • final gather done at half-res; every third frame is a ReSTIR validation frame, and instead of tracing new candidates, it checks the old ones, and updates their radiance. in addition to that, the validation frame also traces very short contact rays; on paper it seems like it would be doing more work, but it's actually slightly cheaper, so I'm counting conservatively here:

const std = @import("std");
const io = std.io;
const assert = std.debug.assert;
// This example shows one possible way to approach Polymorphism in Zig
// using dynamic dispatch.
//
// Largely inspired by:
// - std/mem/Allocator.zig
// https://github.com/ziglang/zig/blob/77836e08a2384450b5e7933094511b61e3c22140/lib/std/mem/Allocator.zig#L55
@odnanref
odnanref / pihole.nomad
Created February 12, 2022 10:55
PiHole LoadBalance UDP and HTTP
job "pihole" {
datacenters = ["dc1"]
type = "service"
group "pihole" {
count = 1
volume "volume_nomad" {
type = "host"
read_only = false
@DanielVF
DanielVF / sample.md
Last active May 16, 2025 19:03
Sample Vulnerability Report

Impact

CRITICAL! Almost all USDC liquidity on the REKT/USDC uniswap pool can be stolen, due to an authorization issue with burnFrom() on the REKT token.

Background

Uniswap v2 pools get the prices for their swaps by comparing the relative amounts of each of the two tokens that they hold. If the pool holds very little of token A, and a lot of token B, then it only takes a little of token A to buy a lot of token B.

Currently REKT and USDC are fairly priced in the pool. If there were to suddenly be very little REKT in the pool, but the same amount of USDC, then very little REKT would be able to buy a lot of USDC.

@boofexxx
boofexxx / guessing_game.zig
Last active June 12, 2022 18:59
guessing game zig
const std = @import("std");
const print = std.debug.print;
pub fn main() anyerror!void {
print("Guess the number!\n", .{});
var secretNumber: i32 = std.rand.DefaultPrng
.init(@intCast(u64, std.time.timestamp()))
.random().intRangeAtMost(i32, 0, 100);
print("The secret number is {}\n", .{secretNumber});

NixOS NAS drives setup

My guide for setup of NixOS with LVM on multiple device LUKS on mdadm:

  1. mdadm for RAID 1:

    • for system and data physical volumes,
    • you can use RAID5 or other levels, based on needs,
  2. LUKS for device encryption:

// Another suggestion from watching
// https://www.youtube.com/watch?v=AHc4x1uXBQE&t=336s
// with my (genuine) 1 hour zig coding experience, I naively believe
// that this sould remove the memory issue within the union.
// and therefore is a slight improvement on the presented enum solution
const std = @import("std");
const stdout = std.io.getStdOut().writer();
@royalgarter
royalgarter / oneliner.sh
Created October 16, 2021 05:26
Oneliners shellscript
System information commands
===========================
(*) #su Show only errors and warnings: `dmesg --level=err,warn`
(*) View dmesg output in human readable format: `dmesg -T`
(*) Get an audio notification if a new device is attached to your computer: `dmesg -tW -l notice | gawk '{ if ($4 == "Attached") { system("echo New device attached | espeak") } }`
(*) Dmesg: follow/wait for new kernel messages: `dmesg -w`
(*) The proper way to read kernel messages in realtime.: `dmesg -wx`
(*) Query graphics card: `lspci -nnk | grep -i VGA -A2`