Skip to content

Instantly share code, notes, and snippets.

View michaelfortunato's full-sized avatar
:shipit:
Thinking about groups

Michael Fortunato michaelfortunato

:shipit:
Thinking about groups
View GitHub Profile
@michaelfortunato
michaelfortunato / experiment_v2.py
Created April 24, 2026 15:03
V2: tiny ml-experiment framework
from __future__ import annotations
import base64
import dataclasses
import hashlib
import importlib
import json
import os
import re
import tempfile
@michaelfortunato
michaelfortunato / experiment.py
Created April 24, 2026 14:58
Elegant tiny ml-experiment framework
import hashlib
import importlib
import json
import logging
import os
import random
import time
from contextlib import contextmanager
from dataclasses import asdict, dataclass, field, make_dataclass
from datetime import datetime, timezone
@michaelfortunato
michaelfortunato / train.py
Created July 31, 2025 01:15
Neural Network Fundamentals
def train(
model: MikesNN,
train_loader: DataLoader,
config: ExperimentConfig,
logger: Logger | None = None,
):
num_epochs = config.num_epochs
learning_rate = config.learning_rate
device = config.device
@michaelfortunato
michaelfortunato / tiled-mat-mul.cu
Last active April 28, 2025 14:29
Matrix Multiplication Using Shared Memory
#include <cuda_runtime_api.h>
#include <stdio.h>
// Matrices are stored in row-major order:
// M(row, col) = *(M.elements + row * M.width + col)
struct Matrix {
int width;
int height;
float *elements;
};
@michaelfortunato
michaelfortunato / simple-mat-mul.cu
Created April 26, 2025 22:59
CUDA Matrix Multiplication Beginner
#include <cuda_runtime_api.h>
#include <stdio.h>
// Matrices are stored in row-major order:
// M(row, col) = *(M.elements + row * M.width + col)
struct Matrix {
int width;
int height;
float *elements;
};
#let typ(body) = html.elem(
"typ",
{
// distinguish parbreak from <p> tag
show parbreak: it => html.elem("typParbreak", "")
show linebreak: it => html.elem("typLinebreak", "")
show strong: it => html.elem("typStrong", it.body)
show emph: it => html.elem("typEmph", it.body)
show highlight: it => html.elem("typHighlight", it.body)
@michaelfortunato
michaelfortunato / job_control_zsh_bash.md
Created March 14, 2025 14:37 — forked from CMCDragonkai/job_control_zsh_bash.md
CLI: Job Control in ZSH and Bash

Job Control in ZSH and Bash

All processes in ZSH/Bash under job control are in 3 states: foregrounded, backgrounded and suspended.

# run command in the foreground
command
# run commend in the background
@michaelfortunato
michaelfortunato / flake.nix
Last active January 9, 2025 18:14
Basic Latex Flake Template
{
description = "A simple LaTeX template for writing documents with latexmk";
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; };
outputs = { self, nixpkgs }:
let
supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
in {
@michaelfortunato
michaelfortunato / tex.Makefile
Last active January 8, 2025 00:04
Makefile for building TeX pdfs
# This Makefile is to run commands. While justfiles are better purposed
# It is unlikely Make will go away and it works well enough for my needs.
TEX_FILE ?= main.tex
AUX_DIR := aux
.PHONY: pdf open clean
refresh: pdf reload
@michaelfortunato
michaelfortunato / ANSI.md
Created October 6, 2023 17:58 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27