Skip to content

Instantly share code, notes, and snippets.

View maedoc's full-sized avatar

marmaduke woodman maedoc

  • now
  • here
View GitHub Profile
@maedoc
maedoc / kagi-ask.sh
Last active October 3, 2025 12:23
script for grabbing some search from cli
#!/usr/bin/env bash
# kagi-ask — tiny CLI for Kagi FastGPT
# usage: kagi-ask what is the integral of 'e^(-x^2)' from -inf to inf
set -euo pipefail
[[ -z "${KAGI_API_KEY:-}" ]] && { echo "KAGI_API_KEY not set" >&2; exit 1; }
QUERY="$*"
[[ -z "$QUERY" ]] && { echo "Usage: $0 <question>" >&2; exit 1; }
@maedoc
maedoc / pathfindergen.py
Created May 21, 2025 05:31
another take on generating pathfinder task images
import tqdm
import numpy as np
import pylab as pl
import jax, jax.numpy as jp
def loss(c):
v1 = c[:-2] - c[1:-1]
v2 = c[2:] - c[1:-1]
nv1 = jp.linalg.norm(v1, axis=1)
nv2 = jp.linalg.norm(v2, axis=1)
@maedoc
maedoc / vbjax-gpu-offload.ipynb
Created April 25, 2025 13:11
GPU offload w/ vbjax simulations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / sa.sh
Created April 4, 2025 13:46
convenient bash func to activate envs
function sa()
{
name=$1
if [[ ! -d ~/env/$name ]]
then
mkdir -p ~/env
uv venv ~/env/$name
fi
source ~/env/$name/bin/activate
}
@maedoc
maedoc / fgonline.py
Created April 2, 2025 20:26
online-training w/ a small linear transformer
import numpy as np, os, pickle, tqdm, jax, jax.numpy as jp
# setup
key = jax.random.PRNGKey(42)
batch_size = 1
nl, n_head, vocab_size = 2, 2, 65
n_embd = n_head * 8
nh, hs = n_head, n_embd//n_head
B, C = batch_size, n_embd
@maedoc
maedoc / femto-deltanet-jax.ipynb
Last active April 1, 2025 20:31
an attention only deltanet-style model, inspired by the nanoGPT repository, in jax
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / BufferA.glsl
Created January 13, 2025 15:13
integrating brain network models with Shadertoy
// iChannel0 is buffer A
// iChannel1 is some texture to use for weights
float rand()
{
return 0.0;
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
@maedoc
maedoc / auto-kinit.sh
Last active December 12, 2024 12:23
Automate krb5 tickets & renewal
#!/bin/bash
set -eu
# allow scripting password, pass as env var MDP
MDP=${MDP:-""}
# setup some vars
export u=$(whoami)
export kt=$HOME/.my-keytab
@maedoc
maedoc / podmp.ipynb
Last active January 23, 2025 14:53
simple active inference in plain numpy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / test-ins-s3.py
Created September 24, 2024 13:47
use minio s3 bucket easily from python
import os
import time
import s3fs
fs = s3fs.S3FileSystem(
endpoint_url="http://10.67.123.1:9000",
key="adni-user",
secret="12345679"
)