Skip to content

Instantly share code, notes, and snippets.

@nickav
nickav / ReadDirectoryChangesW_craziness.cpp
Last active May 7, 2025 11:50
Example of how to poll ReadDirectoryChangesW on Windows
int main() {
char *path = "/path/to/my/directory";
print("watching %s for changes...\n", path);
HANDLE file = CreateFile(path,
FILE_LIST_DIRECTORY,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
@pmttavara
pmttavara / tscqpc.h
Last active February 8, 2025 04:15
Obtain RDTSC frequency on Win32 and Linux
// SPDX-FileCopyrightText: © 2022 Phillip Trudeau-Tavara <[email protected]>
// SPDX-License-Identifier: 0BSD
// https://hero.handmade.network/forums/code-discussion/t/7485-queryperformancefrequency_returning_10mhz_bug/2
// https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/timers#partition-reference-tsc-mechanism
#include <stdbool.h>
#include <stdint.h>
#define WIN32_LEAN_AND_MEAN

I do not come in peace; I am here on a mission. I wish to vanquish the angles and trig which run amok
To my knowledge, this seems to stem from the thought:

The user provides and requests angles, therefore my formulas should input and output angles

At the very least, this is untrue in that the user provides degrees and we compute with radians
But more pervasively, I argue that the formulas are first and foremost Geometric and not Trigonometric