Skip to content

Instantly share code, notes, and snippets.

@joakin
joakin / Flat_Pool.jai
Last active November 4, 2026 15:01
Flat_Pool.jai
/* https://x.com/Jonathan_Blow/status/1858974099705655676
This is a new, simpler version of Pool that uses the 64-bit address space to achieve
that simplicity.
When you start using a Flat_Pool, it will reserve DEFAULT_VIRTUAL_MEMORY_RESERVE bytes
in the process's address space, but this space will not be committed, so it does not yet represent
actual memory used by the process. As we grow the Flat_Pool, each time we pass the existing
committed space, we ask the operating system to commit more. However, we only need to do this
the first time the Flat_Pool grows to that size; if you reset() the pool, the memory stays
@joakin
joakin / add-block-to-page.js
Last active July 18, 2025 10:41
Add a block to a page by title in Routine via the console
/**
* Function to search for a page by title and append a block to it
*
* Usage examples:
*
* // Add a JavaScript code block:
* await addBlockToPage('My Dev Notes', {
* type: 'code',
* language: 'javascript',
* content: 'const result = await fetchData();\nconsole.log(result);'
@joakin
joakin / kill-process-bound-to-port.sh
Created June 12, 2025 11:23
Killing a process that is bound to a port, to free it
# Find the process using the port (replace 3000 with your port)
lsof -ti:3000 | xargs kill -9
Or step by step:
# Find what's using the port
lsof -i:3000
# Kill by PID (replace 1234 with actual PID)
kill -9 1234
@joakin
joakin / Perfect PPL.md
Created March 12, 2025 12:58
Perfect PPL - Athlean X

PERFECT PPL WORKOUT - PUSH 1

  1. Barbell Bench Press - 4 x 4-6 (leave 1-2 reps in the tank)
  2. Hi-to-Low Crossovers - 3 x 10-12
  3. DB Shoulder Press - 4 x 8-10
  4. 1 1/2 Side Lateral Raises - 3 x 12-15
  5. Lying Tricep Extensions - 3 x 10-12 ⟶ DB Waiter's Curls - 3 x 10-12
  6. Rotator Cuff External Rotation - 3 x 15-20

PERFECT PPL WORKOUT - PULL 1

@joakin
joakin / mixed-list.html
Created December 11, 2024 11:10
HTML mixed item lists (paragraph, bullet, ordered, checklist)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom List Items</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
line-height: 1.6;
@joakin
joakin / nil.odin
Created August 7, 2023 22:57
Odin confusion with nil
package main
import "core:fmt"
Test :: struct {
test: int
}
EnumTest :: enum {
Int,
@joakin
joakin / watch-compile.sh
Last active July 25, 2023 11:20
Watch and compile elm files
#!/usr/bin/env bash
COLOR_OFF="\e[0m";
DIM="\e[2m";
function compile {
# Customize the elm make command as needed
elm make src/elm/Main.elm src/elm/Stories/**/*.elm && rm elm.js
}
@joakin
joakin / DebugJson.elm
Created January 26, 2023 16:19
Debug Json decoders helpers
log : String -> Json.Decode.Decoder a -> Json.Decode.Decoder a
log message =
Json.Decode.map (Debug.log message)
debug : String -> Json.Decode.Decoder a -> Json.Decode.Decoder a
debug message decoder =
Json.Decode.value
|> Json.Decode.andThen (debugHelper message decoder)
@joakin
joakin / ElmBenchmarks.elm
Created January 2, 2023 18:11
Elm benchmarking the best way to encode things to JSON and a few other things
module Main exposing (suite)
import Array exposing (Array)
import Benchmark as B exposing (..)
import Benchmark.Runner exposing (..)
import Dict
import Json.Encode as E
object =
@joakin
joakin / MaybeUnwrap.elm
Created December 20, 2021 07:39
Un safely unwrap a Maybe in production
unwrap : Maybe a -> a
unwrap maybeA =
case maybeA of
Just a ->
a
Nothing ->
unwrap maybeA