Skip to content

Instantly share code, notes, and snippets.

@paralin
paralin / example.js
Created March 20, 2025 22:25 — forked from konsumer/example.js
This will give you a nice clean list of wasm imports/exports which is useful for making minimal wasm-loaders.
import getWasmInterface from './get_wasm_interface.js'
// usage
const bytes = await fetch('mine.wasm').then(r => r.arrayBuffer())
const m = await WebAssembly.compile(bytes)
// imports is minimal stub (empty functions) and exports is a list of things it exports
const { imports } = await getWasmInterface(m)
// now I can inject my own functions
@paralin
paralin / defy.json
Created February 25, 2025 20:26
my Dygma Defy config
{
"neuronID": "fd764f8cc086705e",
"neuron": {
"id": "fd764f8cc086705e",
"name": "Defy",
"layers": [
{
"id": 0,
"name": "L1"
},
@paralin
paralin / self-improving-ai.md
Created February 22, 2025 19:58
Self-improving AI: we have it, it's here. Here's how it works.

This document contains my simplified understanding of how this works.

it is by no means an exhaustive explanation and is meant to get the "vibe" of what's happening while glossing over implementation detail.


  1. Ask deepseek R1 to think about something.
  2. It thinks about it for a long time, spending $$$ on compute.
  3. It eventually comes to a conclusion.
  4. Take the question + the conclusion and generate a "thought trace" which is the "correct" version or the "shortest version" of the "thought process"
@paralin
paralin / readme.md
Last active December 24, 2024 07:41
jotai hierarchical persistence concept

UI Component State Persistence Design

See a prototype: https://github.com/paralin/jotai-tree-state-prototype

Background

Modern web applications often contain complex UI hierarchies with stateful components like counters, panels, and nested layouts. Each component maintains its own state but needs to persist across page reloads and browser sessions. Additionally, these components may be dynamically nested within each other, creating a hierarchical

@paralin
paralin / buildroot-update-go.py
Created October 26, 2024 04:56
Buildroot update go python script
#!env python3
# buildroot-update-go.py
# by: Christian Stewart <[email protected]>
# license: MIT
import json
import sys
import requests
import re
@paralin
paralin / Go Git CLI Extensions
Last active July 13, 2024 20:34
git utilities written in Go
Copyright 2024 Christian Stewart <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH TH
@paralin
paralin / idbkeyrange_forprefix.js
Created May 20, 2024 02:54 — forked from inexorabletash/idbkeyrange_forprefix.js
Helper for creating an IDBKeyRange for all keys with a given prefix
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Basic p(r)olyfill for proposed feature
// This defines no successor of empty arrays, so the range for prefix
// [] or [[],[]] has no upper bound.
// An alternate definition would preclude adding additional nesting,
// so the range for prefix [] would have upper bound [[]] and the
// range for prefix [[], []] would have upper bound [[], [[]]].
@paralin
paralin / aider-coder.md
Created May 4, 2024 19:47
aider coder overview

Classes:

  1. MissingAPIKeyError: Inherits from ValueError. Represents an error when the API key is missing.
  2. ExhaustedContextWindow: Inherits from Exception. Represents an error when the context window is exhausted.
  3. Coder: The main class representing the Coder functionality.

Functions:

  1. wrap_fence(name): Returns a tuple of opening and closing fence tags for the given name.
  2. Coder.create(...): A class method to create an instance of the Coder class based on the provided parameters.
  3. Coder.__init__(...): The constructor method for the Coder class, initializing various attributes.
  4. Coder.show_announcements(): Displays announcement messages.
@paralin
paralin / minimize-go-wasm-size.md
Last active September 27, 2024 08:13
Minimizing Go wasm binaries size: a multi-pronged approach

My approach to smaller Go wasm binaries:

  • protoc-gen-go-lite: Removes dependency on reflection, making your binaries lighter.
  • goweight: Analyze the size of your binaries. This is a fork with added wasm support.
  • goda: Use to find why something is imported by executing:
    goda graph "reach(.:all, gonum.org/v1/gonum/mat)" | dot -Tsvg -o graph.svg
    
  • wasm-opt: Optimize wasm binaries for size with the command:
@paralin
paralin / lima.yaml
Created March 19, 2024 19:14
debian sid lima config
images:
- location: "https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-genericcloud-arm64-daily.qcow2"
arch: "aarch64"
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
mountType: virtiofs
vmType: vz