Skip to content

Instantly share code, notes, and snippets.

View davidroman0O's full-sized avatar
🏠
Working from home

David Roman davidroman0O

🏠
Working from home
  • Ubisoft
  • Montréal, Canada
View GitHub Profile
@davidroman0O
davidroman0O / readme.md
Last active November 22, 2023 13:07
Delete all "Watch later" videos

It's semi-automated at worse, automated at best

open browser

open inspector on console

copy paste, enter

wait

Notes on Modern UI Development: Taking Ideas from Spaced Repetition

Introduction

I have been working on a modern typing training application for the last couple of days. One of the main motivations was to build an app with a modern UI and minimal distractions, enabling to fully focus on the training aspect. You can read more about the original idea and thought process here as well as some notes on iterating over the details here.

After adding some minimal auto close functionalities for the code training section, you can read about it here, another important feature was to make the text training part more entertaining.

@reednj
reednj / mult.md
Last active September 25, 2022 06:23

Multiplication from Scratch

Imagine you need to implement (integer) mulitplication in code. Maybe you are on a system which doesn't have it or something. How to do this, and what is the minimal set of operators that are required?

Repeated addition

The most obvious way to do multiplition is through repeated addition. To get the answer to 56 x 67 you add 56 to itself 67 times (or 67, 56 times - the order doesn't matter).

This is simple to implement if we assume for the moment that both a and b are positive (we will deal with negative integers later)

@ityonemo
ityonemo / Packed tagged.zig
Created August 12, 2022 18:15
Packed tagged union in zig
const E = enum(u12) {
Int = 0xFFF,
String = 0xFFE,
Pointer = 0xFFD,
}
const P = packed union(?e){
const this = @This();
Int: packed struct {
@aldy505
aldy505 / exec.sh
Created July 10, 2022 01:31
Spin up clustered rqlite on 1 host
rqlited \
-auth rqlite.json \
-fk \
-node-id 1 \
-http-addr localhost:4001 \
-raft-addr localhost:4002 \
./node.1
rqlited \
-auth rqlite.json \
@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