Skip to content

Instantly share code, notes, and snippets.

@menduz
menduz / etiquette.md
Created August 25, 2025 17:48
Pull request etiquette

Pull Request Etiquette

Why do we use a Pull Request workflow?

PRs are a great way of sharing information, and can help us be aware of the changes that are occuring in our codebase. They are also an excellent way of getting peer review on the work that we do, without the cost of working in direct pairs.

Ultimately though, the primary reason we use PRs is to encourage quality in the commits that are made to our code repositories

Done well, the commits (and their attached messages) contained within tell a story to people examining the code at a later date. If we are not careful to ensure the quality of these commits, we silently lose this ability.

@menduz
menduz / rules.yml
Created March 27, 2025 22:58
recording rules.yaml
groups:
- name: users-prediction
rules:
- record: dcl:online_users:5m
expr: >
sum(avg_over_time(dcl_archipelago_peers_count[5m])) OR on() vector(0)
+ sum(avg_over_time(dcl_ws_rooms_connections{service="ws-room-service"}[5m])) OR on() vector(0)
# Long-term average value for the series
- record: dcl:online_users:5m:avg_over_time_1w
expr: >
@menduz
menduz / actionlist.vim
Created April 19, 2024 13:22 — forked from zchee/actionlist.vim
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@menduz
menduz / gi.c
Created December 6, 2023 20:33 — forked from futureengine2/gi.c
Radiance Cascades 2d GI implementation
static void gi_on_gpu(u8* in_bitmap, int w, int h) {
#define num_cascades 7
static bool initialized;
static gpu_bindgroup_t texture_bindgroup[2];
static gpu_bindgroup_t cascade_uniform_bindgroup[num_cascades];
static gpu_bindgroup_t render_uniform_bindgroup;
static gpu_buffer_t vertex_buffer;
static gpu_buffer_t uniform_buffer;
static gpu_pipeline_t pipeline;
@menduz
menduz / build.zig
Last active September 20, 2023 20:16
zig dependency checker
const DependencyChecker = struct {
/// map(module_name -> set(module_hash))
package_name_to_hashes: std.StringHashMap(std.StringHashMap(bool)),
const Self = @This();
const dependencies = @import("root").dependencies;
fn check_transitive_dependency(self: *Self, comptime module_name: []const u8, comptime module_hash: []const u8, comptime level: comptime_int) void {
const package = @field(dependencies.packages, module_hash);
const BITS = 32
export function queryBit(data: Uint32Array, index: number) {
const mask = 1 << (index % BITS)
return (data[(index / BITS) | 0] & mask) != 0
}
export function turnOnBit(data: Uint32Array, index: number) {
const mask = 1 << (index % BITS)
return (data[(index / BITS) | 0] |= mask)
}
Use cases:
- Edition mode, needs component schemas and IDs
```
entity0: {
position: { x y z }
}
```
- If the devs define the component number, libraries may have conflicting numbers
export function asnEcdsaSignatureParser(signature: Uint8Array): {
r: BigNumber
s: BigNumber
} {
// 30 — type tag indicating SEQUENCE
// 46 — length in octets of value that follows
// 02 — type tag indicating INTEGER
// 21 — length in octets of value that follows
// 00 b15232269023d8c65689f816996f6af874b484347f1e7a537df1230cb1b12d76 R
import { ILoggerComponent, IMetricsComponent } from '@well-known-components/interfaces'
import { validateMetricsDeclaration } from '@well-known-components/metrics'
import PQueue from 'p-queue'
export type ISequecuentialJobExecutorComponent = {
/**
* Runs sequential jobs with a max concurrency of 1 per jobName.
*/
run<T>(jobName: string, fn: () => Promise<T>): Promise<T>
}
@menduz
menduz / game.ts
Last active February 3, 2021 14:04
loading kernel modules from Decentraland's SDK scene
executeTask(async () => {
const module = await dcl.loadModule('@decentraland/CommunicationsController')
const rpcResult = await dcl.callRpc(module.rpcHandle, 'send' /* remote method */, [message /* argument list */])
/**
The code avobe is the same as:
import {send} from "@decentraland/CommunicationsController"