Skip to content

Instantly share code, notes, and snippets.

@tilacog
tilacog / number_todos.py
Created March 9, 2026 11:41
Scans a Rust project directory and assigns unique sequential numbers to any un-numbered `// TODO` comments in-place (e.g. `// TODO` → `// TODO(42)`).
#!/usr/bin/env python3
"""Number unnumbered // TODO comments across Rust files."""
import re
import sys
from pathlib import Path
# Matches "// TODO" NOT followed by "(number)"
UNNUMBERED_TODO = re.compile(r"// TODO(?!\(\d+\))")
#!/usr/bin/env python3
"""Analyze a Solana transaction from its signature."""
import json
import subprocess
import struct
import sys
from collections.abc import Callable
# Base58 alphabet (Bitcoin/Solana)
@tilacog
tilacog / mana-board.scm
Last active June 3, 2025 16:54
Mana Board
(define board
'((2 2 3 1 2 2)
(1 3 1 3 1 3)
(3 1 2 2 3 1)
(2 3 1 3 1 2)
(2 1 3 1 3 2)
(1 3 2 2 1 3)))
(define (invalid_range n)
@tilacog
tilacog / transaction_manager.rs
Created October 20, 2022 22:49
Transaction manager
use std::time::{Duration, Instant};
/// How many confirmations to wait for
const REQUIRED_CONFIRMATIONS: u32 = 1;
const WAIT_TIME_IN_SECONDS: u64 = 60;
const HARD_TIMEOUT_FACTOR: u64 = 10;
/// Time before giving up on waiting for transaction confirmation. After this time, we expect the
/// Transaction Monitor to bump the gas price and re-broadcast the transaction.

Graphman

graphman chain check-blocks

SYNOPSIS

Compares cached blocks with fresh ones and clears the block cache when they differ

USAGE:

graphman --config chain check-blocks

Keybase proof

I hereby claim:

  • I am tilacog on github.
  • I am tilacog (https://keybase.io/tilacog) on keybase.
  • I have a public key ASClYPuqDlrnrIQAunAoCcma3_VQs7YxwUOCi2paVKhmfAo

To claim this, I am signing this object:

[package]
edition = "2021"
name = "block-search-bin"
version = "0.1.0"
[dependencies]
anyhow = "*"
chrono = "*"
hex = "*"
serde_json = "*"
@tilacog
tilacog / bump.clj
Last active December 2, 2020 04:01
bump.clj
#!/usr/bin/env bb
;; -*- mode: clojure -*-
(defn first-rest [col]
[(first col) (rest col)])
(defn split-path [file]
(let [file (io/file file)]
[(.getParent file) (.getName file)]))
@tilacog
tilacog / pomodoro.sh
Last active November 2, 2020 19:21 — forked from gabriel-bezerra/pomodoro.sh
Shell script Pomodoro timer for ubuntu unity
#!/bin/env bash
#
# Pomodoro script.
#
# Displays a notification after X minutes.
#
# Depends on libnotify-bin
main() {
minutes=$1
@tilacog
tilacog / multiproducer-consumer.py
Last active April 6, 2020 13:35 — forked from RasmusFonseca/multiproducer-consumer.py
Python multiple producer / single consumer example
from multiprocessing import Lock, Process, Queue
print_lock = Lock()
def square_producer(inputqueue, resultqueue):
"""A producer that pops numbers off the inputqueue, squares them and puts the
result on resultqueue
"""
while True: