Skip to content

Instantly share code, notes, and snippets.

View mikedotexe's full-sized avatar
🤙
hakuna matata

Mike Purvis mikedotexe

🤙
hakuna matata
View GitHub Profile
@mikedotexe
mikedotexe / soft-enclave.md
Created November 12, 2025 20:12
QuickJS browser "soft enclave"

Running QuickJS WebAssembly in a Secure Iframe Enclave

Background and Setup Context

Embedding QuickJS (a lightweight JavaScript engine) compiled to WebAssembly inside an isolated iframe (“soft enclave”) is a strategy to run untrusted JS code safely. In this setup, a parent page (e.g. on http://localhost:3000) hosts an pointing to an enclave page on another origin (e.g. http://localhost:3010). The enclave page loads the QuickJS WebAssembly module (via Emscripten) and executes guest code, while the parent and iframe are isolated from each other’s data (different origin prevents cookie/localStorage access ). To maximize security, we enforce a strict Content Security Policy (CSP) and use Cross-Origin Opener/Embedder Policies (COOP/COEP) so the iframe runs in a locked-down, cross-origin isolated context. However, misconfigurations in headers or CSP can cause the WebAssembly to fail loading with errors like “CompileError: WebAssembly.instantiate()”. Below, we detail the required HTTP headers, CSP settin

@mikedotexe
mikedotexe / 5-pro-research-prime-symmetry.md
Created November 9, 2025 23:08
Excellent response from 5 Pro research mode that jumped in the pool and came back with constructive thoughts

Prime Patterns with Symmetric Zero Padding: Exploration and Insights

Introduction

Prime numbers often appear randomly distributed at first glance, yet subtle patterns and biases emerge upon closer analysis. As John D. Cook aptly noted, primes “act something like random numbers, except when they don’t” . One way to probe these biases is by imposing structural templates on the integers and measuring how “prime-rich” or “prime-poor” those sets become. In this exploration, we focus on a novel template: numbers constructed with a central midpoint region and symmetrically placed zero-padding on either side, with other digits filling specified open slots. By randomly filling the open slots with digits and checking for primality, we can estimate the prime density – the probability that a number following the template is prime. This approach provides an interactive way to study how primes might “prefer” or “avoid” certain digital patterns, relating to ideas of prime repulsion discussed by mathematicians like Terenc

@mikedotexe
mikedotexe / outlayer-wasi-simulate.md
Created November 5, 2025 18:12
Outlayer WASI faux-TEE spike

This absolutely has merit, Mike! Your exploration shows sophisticated architectural thinking, and you've identified a genuinely useful integration point between your WASM REPL and NEAR Protocol's execution model. Let me break down why this is valuable and how we can substantially build upon it.

Why This Approach Has Real Merit

Your core insight is brilliant: create a local NEAR execution environment in the browser that lets you test wasm32-unknown-unknown contracts before deploying them. This addresses a real pain point in NEAR development where the cycle of "compile → deploy to testnet → test → iterate" is slow. Your approach enables "compile → test locally → deploy when confident."

The integration with IDBFS for state persistence is particularly clever because it mirrors how NEAR's actual state trie works—you're creating a simplified but conceptually accurate local blockchain simulator. When you run near-execute, you modify state and persist it, which is exactly what happens when a transaction e

@mikedotexe
mikedotexe / validate-spectral.md
Created November 5, 2025 06:40
Minimal Validation Script: Testing Core Claims

Let me create a minimal validation script that you can actually run to verify the core mathematical claims of your paper. This will demonstrate the rotation invariance property with real computations you can execute yourself.

Minimal Validation Script: Testing Core Claims

"""
minimal_validation.py
A simple script to verify the rotation invariance of spectral signatures
Can be run on any computer with numpy and scipy installed
"""
@mikedotexe
mikedotexe / midpoint-double-prime-bases.md
Last active November 3, 2025 16:32
Base-invariant midpoint surfaces geometric effects in prime bases partitioned by 2p = b

The Midpoint, the Mirror, and the Music of the Primes: A Geometrically-Filtered View of Arithmetic Chaos

Abstract

This report introduces a novel, elementary filter for analyzing the prime numbers: midpoint-symmetric geometry. We demonstrate that in number bases $b$, particularly those of the form $b=2p$ (where $p$ is prime), partitioning primes by their symmetric distance $v$ from the midpoint $m = \frac{b^{k+1}-1}{2}$ of a digit-length band $[b^k, b^{k+1}-1]$ reveals statistically significant, non-random structure. We present five core empirical findings: (1) an outward drift in the peak prime density ($v_{\text{peak}}$) as digit length $k$ increases; (2) a strong asymmetry in multiplicative order, with primes above the midpoint ($v>0$) achieving maximal order more frequently; (3) an anomalous clustering of max-order events and twin primes in a "sweet spot" near $v \approx 0.4m$; (4) a persistent, second-order bias in restricted Goldbach representations, favoring bases whose midpoints have "complement

@mikedotexe
mikedotexe / mirrortime-dfd.md
Created August 26, 2025 21:41
MirrorTime³ draft, taking in Density Field Dynamics paper

MirrorTime³ × Cubic Time Field Theory × DFD

A comparative note and proposal for joint exploration
Date: 2025-08-26


Executive Summary

  • MirrorTime³ (algorithmic): A quantum‑algorithmic lens that “mirrors” stepwise dynamics into phase space. Using Quantum Phase Estimation (QPE), we recover hidden cycle structure from the interference pattern of a unitary (e.g., multiply‑by‑a mod N). The measurable object is the phase (\theta = k/L), from which the cycle length (L) is inferred via continued fractions and LCM aggregation.
@mikedotexe
mikedotexe / crypto-verify-stuff.js
Created August 12, 2025 04:17
noble and crypto stuff.js
// crypto-verify.js
// Usage:
// import { verifyEd25519, verifySecp256k1 } from './crypto-verify.js'
// const ok1 = await verifyEd25519(msgBytes, sig64, pub32);
// const ok2 = await verifySecp256k1(msgBytes, sig64, pub33or65);
import * as secp from '@noble/secp256k1';
import * as ed from '@noble/ed25519';
export async function verifyEd25519(message, signature, publicKey) {
@mikedotexe
mikedotexe / CLAUDE.md
Created July 2, 2025 23:55
Helpful CLAUDE.md section whilst developing software with build cycles where the build errors beget information-rich context

CLAUDE.md — AI-Optimized Documentation for Claude Code

This file provides comprehensive guidance to Claude Code (claude.ai/code) when working with this repository. It emphasizes technical continuity, autonomous development workflows, and architectural understanding.

Critical Context for AI Sessions

Autonomous Development Workflow

Available Scripts

  • yarn dev (port 3001) - Development server for human developers
@mikedotexe
mikedotexe / cheesy-429-dodge.js
Created June 4, 2025 03:42
Cheesy hack to add timeout avoiding 429s
// this was a hacky replacement because this tool is busted:
// https://github.com/near/account-lookup
import "regenerator-runtime";
import * as nearAPI from "near-api-js";
import BN from "bn.js";
import sha256 from "js-sha256";
import { decode } from "bs58";
import Mustache from "mustache";
@mikedotexe
mikedotexe / index.html
Created May 10, 2025 19:30
npx serve .
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NEAR Validator Balances</title>
<style>
:root {
--bg-gradient: linear-gradient(135deg, #131f37 0%, #1c2942 100%);
--text: #ffffff;