Skip to content

Instantly share code, notes, and snippets.

@retroplasma
retroplasma / obb_dump_obj.js
Last active January 19, 2019 08:23
Dumps oriented bounding boxes of first bulk metadata to obj files. Place in repo's main directory before executing.
"use strict"
const fs = require('fs-extra');
const path = require('path');
/**************************** config ****************************/
const PLANET = 'earth';
const URL_PREFIX = `https://kh.google.com/rt/${PLANET}/`;
const DL_DIR = './downloaded_files';
const [RESEARCH_DIR, DUMP_JSON_DIR, DUMP_RAW_DIR] = ['research', 'json', 'raw'].map(x => path.join(DL_DIR, x));
"use strict"
/**************************** config ****************************/
const PLANET = 'earth';
const URL_PREFIX = `https://kh.google.com/rt/${PLANET}/`;
/****************************************************************/
const { getPlanetoid, getBulk, traverse } = require('./lib/utils')({
URL_PREFIX, DUMP_JSON_DIR: null, DUMP_RAW_DIR: null, DUMP_JSON: false, DUMP_RAW: false
});
@retroplasma
retroplasma / BINSYNC.md
Last active February 16, 2024 15:32
Private Incremental File Storage on Usenet

binsync logo

Private Incremental File Storage on Usenet

Disclaimer

This is just a concept. Don't spam the Usenet.

How Usenet works

Usenet is an old replicated network that is basically a giant forum. There are many providers that offer access to it. Clients use NNTP to read and write articles in newsgroups. A newsgroup is like a directory that contains a stream of articles that each have a unique message ID.

@retroplasma
retroplasma / OBB_RAY_INTERSECT.js
Last active June 24, 2026 13:48
Ray intersection with oriented bounding box (OBB)
const vec_sub = (a, b) => ({ x: a.x - b.x, y: a.y - b.y, z: a.z - b.z });
const vec_dot = (a, b) => a.x * b.x + a.y * b.y + a.z * b.z;
const vec_len = a => Math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
const vec_norm = a => {
const norm = vec_len(a);
return { x: a.x / norm, y: a.y / norm, z: a.z / norm };
}
/*
* JS version of
@retroplasma
retroplasma / sha256remote.sh
Created July 4, 2025 13:21
Remotely calculate SHA256 of files where file name is [0-9a-f]{64} to see if file name == hash of file (e.g. restic, rsync.net)
#!/bin/bash
set -Efeuo pipefail
SSH='ssh user@server'
DIR='/remote/path'
#assumes that "find" and "sha256 -r" commands work on the remote machine
#count files to show live counter
file_count="$($SSH "find $(printf %q "$DIR") -type f" | grep -E '/[0-9a-f]{64}$'|wc -l)"
@retroplasma
retroplasma / README.md
Last active August 3, 2026 19:08
Unlag Neo: Macbook Neo Cursor lag "fix"

Unlag Neo: A "fix" for the cursor lag on Macbook Neo

Macbook Neo (I'm on macOS Tahoe 26.5.2) cursor is lagging when the cursor is near the screen's edges or when it enters a Terminal window. [1][2][3][4][5]

[Click here for more info and background]

Why is it lagging?

I don't know. But at the moment when it lags the system switches from hardware cursor to software cursor (CGCursorIsDrawnInFramebuffer() goes from 0 to 1) so maybe that transition is stalled somehow on Macbook Neo.

@retroplasma
retroplasma / README.md
Created July 13, 2026 01:57
Pseudo True Tone (e.g. for Macbook Neo)

Pseudo True Tone: Webcam + Night Shift

It roughly does what real True Tone does, but without the sensor. It uses the webcam to estimate the warmth of the environment and sets Night Shift settings accordingly.

It's for devices without True Tone, like the Macbook Neo.