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 / 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;
@mikedotexe
mikedotexe / prime-zeroes9.py
Created April 6, 2025 21:19
prime sieve formatted by symmetric zero-padding
#!/usr/bin/env python3
import math
import time
from itertools import product
import multiprocessing as mp
from collections import defaultdict, Counter
import random
def is_probable_prime(n, rounds=20):
"""
@mikedotexe
mikedotexe / dev tools console.nothing
Created October 24, 2024 05:33
messing around with SubtleCrypto
const newEd25519Key = await window.crypto.subtle.generateKey('Ed25519', true, ['sign', 'verify']);
const encoder = new TextEncoder();
const messageUtf8Bytes = encoder.encode("aloha honua");
const signature = await window.crypto.subtle.sign("Ed25519", newEd25519Key.privateKey, messageUtf8Bytes);
console.log('signature', signature);
const pkcs8PrivateKey = await window.crypto.subtle.exportKey('pkcs8', newEd25519Key.privateKey);
const pkcs8PrivKeyArr = new Uint8Array(pkcs8PrivateKey)
console.log('pkcs8PrivKeyArr', pkcs8PrivKeyArr);
@mikedotexe
mikedotexe / yarn.config.cjs
Created October 17, 2024 08:05
Yarn 4.5.0 constraint (`yarn set version berry` has to be run)
module.exports = {
async constraints({ Yarn }) {
// get the root-level package.json's version
// then update all the packages' versions
/* The line below returns something like
{
cwd: '.',
ident: '@meer-js/monorepo',
@mikedotexe
mikedotexe / get-mpc-signature-from-tx-hash.js
Created May 14, 2024 22:00
Get MPC signature pieces from a transaction hash, like one returned from MyNEARWallet as a URL param
// run with "node get-mpc-signature-from-tx-hash.js" or whatever name
const { connect, keyStores } = require('near-api-js')
const mockKeyStore = new keyStores.InMemoryKeyStore()
const nearConfig = {
keyStore: mockKeyStore,
networkId: 'testnet',
nodeUrl: 'https://archival-rpc.testnet.near.org',
}
@mikedotexe
mikedotexe / chain-siggy.js
Created March 13, 2024 01:06
Chain signatures (shell of BOS frontend)
const ProgressBar = VM.require("mike.near/widget/ProgressBar");
console.log('props', props);
const yoctoZeroes = "000000000000000000000000";
const [stakingAmount, setStakingAmount] = useState("6");
const [unstakingWithdrawlAmount, setUnstakingWithdrawlAmount] = useState("19");
const StakeUnstakeWithdraw = ({ validator, method, amount }) => {
const openAnotherModal = ({validator, method, amount}) => {
// Let's explicitly have these in a switch so no one tries any funny business with methods
switch (method) {
@mikedotexe
mikedotexe / croncat-task-osmosis-1.sh
Created June 26, 2023 17:19
Simple CronCat task via shell script
#!/bin/sh
SIMPLE_PAYROLL='{
"create_task": {
"task": {
"actions": [
{
"msg": {
"bank": {
"send": {
@mikedotexe
mikedotexe / switch-network-print-gas-flags.sh
Created June 20, 2023 17:43
Switching Cosmos networks and printing gas flags
function set_cosmos_cli_config {
# If you're using a pretty old shell, might remove "local"
local cmd="$1"
local chain_id="$2"
local node="$3"
local gas_prices="$4"
local echo_str="$5"
"$cmd" config chain-id "$chain_id"
"$cmd" config node "$node"