Skip to content

Instantly share code, notes, and snippets.

View lardratboy's full-sized avatar

Brad P. Taylor lardratboy

View GitHub Profile
@lardratboy
lardratboy / gendemodata.js
Created March 27, 2026 03:41
demo data generator scratchpad
// =============================================================================
// ENCODERS (CPU — for demo generation)
// =============================================================================
function fp16ToF32(u16){let s=(u16>>15)&1,e=(u16>>10)&0x1F,m=u16&0x3FF;if(e===0)return(s?-1:1)*Math.pow(2,-14)*(m/1024);if(e===31)return m?NaN:(s?-Infinity:Infinity);return(s?-1:1)*Math.pow(2,e-15)*(1+m/1024);}
function bf16ToF32(u16){let s=(u16>>15)&1,e=(u16>>7)&0xFF,m=u16&0x7F;if(e===0)return(s?-1:1)*Math.pow(2,-126)*(m/128);if(e===255)return m?NaN:(s?-Infinity:Infinity);return(s?-1:1)*Math.pow(2,e-127)*(1+m/128);}
function fp8E4M3ToF32(u8){let s=(u8>>7)&1,e=(u8>>3)&0xF,m=u8&0x7;if(e===0)return(s?-1:1)*Math.pow(2,-6)*(m/8);return(s?-1:1)*Math.pow(2,e-7)*(1+m/8);}
function fp8E5M2ToF32(u8){let s=(u8>>7)&1,e=(u8>>2)&0x1F,m=u8&0x3;if(e===0)return(s?-1:1)*Math.pow(2,-14)*(m/4);return(s?-1:1)*Math.pow(2,e-15)*(1+m/4);}
function fp4ToF32(u8){let s=(u8>>3)&1,e=(u8>>1)&0x3,m=u8&1;if(e===0)return(s?-1:1)*0.5*(m/2);r
/**
* Variable Bit-Depth Generator
* @param {string} shape - 'lorenz', 'thomas', 'noise'
* @param {number} depth - 8, 16, 32
* @param {num} number of points
* @param {littleEndian} true or false
*/
function uintShapeGenerator(shape, depth, num, littleEndian ) {
const compSize = depth / 8;
const buf = new ArrayBuffer(num * compSize * 3);
async function generateArtifactImage(signature) {
// Convert signature (e.g. "0101-1110-...") into a more descriptive prompt
const complexity = (signature.match(/1/g) || []).length;
const prompt = `A mystical cosmic artifact, a geometric totem floating in space.
The artifact has a ${complexity > 5 ? 'complex' : 'simple'} crystalline structure
inspired by the pattern: ${signature}. Neon bioluminescent colors,
ethereal nebula background, 8k, digital art, sci-fi relic.`;
try {
const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent?key=${apiKey}`, {
@lardratboy
lardratboy / quantize10_DataAs.js
Created December 22, 2025 22:50
quantized integer point cloud helper
// Data type configuration constants
const DATA_TYPES = {
int8: { size: 1, min: -128, max: 127, method: 'getInt8' },
uint8: { size: 1, min: 0, max: 255, method: 'getUint8' },
int16: { size: 2, min: -32768, max: 32767, method: 'getInt16' },
uint16: { size: 2, min: 0, max: 65535, method: 'getUint16' },
int32: { size: 4, min: -2147483648, max: 2147483647, method: 'getInt32' },
uint32: { size: 4, min: 0, max: 4294967295, method: 'getUint32' }
};
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>🎰 LATTICE SLOTS</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;600&display=swap');
* { box-sizing: border-box; margin: 0; padding: 0; }
@lardratboy
lardratboy / boxed-in.html
Last active December 22, 2025 22:38
boxed in game
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>BOXED IN - Instanced & Pooled</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;600&display=swap');
* { box-sizing: border-box; }
@lardratboy
lardratboy / SafeTensorDump.html
Created October 7, 2025 00:23
tool to export tensor data from safetensors
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SafeTensor Information Dump</title>
<style>
* {
box-sizing: border-box;
}
@lardratboy
lardratboy / grayscale_binary_plane.html
Last active October 1, 2025 01:09
grayscale binary plane viewer
<!DOCTYPE html>
<html>
<head>
<title>Binary Bit Viewer</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
}
@lardratboy
lardratboy / purgatory_shooter.html
Last active September 30, 2025 06:11
some progress purgatory game
<!DOCTYPE html>
<html>
<head>
<title>Space Shooter</title>
<style>
body { margin: 0; overflow: hidden; }
#score { position: fixed; top: 20px; right: 20px; color: white; font-family: Arial; }
#restart { position: fixed; top: 20px; left: 20px; padding: 10px; }
#instructions { position: fixed; bottom: 20px; left: 20px; color: white; font-family: Arial; }
</style>
@lardratboy
lardratboy / chunky_data_explorer.html
Created September 26, 2025 00:50
IFF/RIFF-like data explorer, processes chunks and produces a large amount of png images
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VOMIT PNG's 0.5.1 - CHUNKY DATA EXPLORER</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;