Skip to content

Instantly share code, notes, and snippets.

@catdevnull
catdevnull / snowflake.js
Created April 15, 2025 02:59
twitter snowflake id calc
/**
* Parses a Snowflake ID and returns its components.
* @param {string|number} snowflakeId The Snowflake ID to parse.
* @param {number} epoch The epoch to use for timestamp calculation.
* Defaults to Twitter's epoch (1288834974657).
* @returns {object} An object containing the parsed components.
*/
function parseSnowflake(snowflakeId, epoch = 1288834974657) {
const id = BigInt(snowflakeId);
const timestampBits = 41n;
@catdevnull
catdevnull / experiment.ipynb
Last active June 2, 2025 13:58
quirk: explicit resource management doesn't work like defer in go
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@catdevnull
catdevnull / readme.md
Created October 18, 2025 22:37
repro-bug-bun-s3-amp

output:

Res from aws-sdk: Hello, world!
Error reading with no escaping with bun: S3Error: Key not found
Error reading with escaping with bun: S3Error: Key not found
List from bun: 
- testing-bun-bug/hello?world&...
- testing-bun-bug/test.txt
Error reading testing-bun-bug/hello?world&... with bun: S3Error: Key not found