Skip to content

Instantly share code, notes, and snippets.

View leostera's full-sized avatar
🛠️
ars longa vita brevis

Leo Ostera leostera

🛠️
ars longa vita brevis
View GitHub Profile
@leostera
leostera / query_duckdb.py
Created December 7, 2025 20:49
Query Solana transaction data with DuckDB
import duckdb
duckdb.sql("""
SELECT DATE_TRUNC('hour', block_timestamp) AS hour,
COUNT(*) AS tx_count,
SUM(fee) / 1e9 AS total_fees_sol
FROM '2025-11-01/*.parquet'
GROUP BY hour
ORDER BY hour
""").show()
@leostera
leostera / download_day.py
Last active December 7, 2025 20:58
Download all Solana transactions for a specific day from solarchive.org
import requests
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor
day = "2025-11-01"
index = requests.get(f"https://data.solarchive.org/txs/{day}/index.json").json()
output_dir = Path(day)
output_dir.mkdir(exist_ok=True)
src_dir ?= src
build_dir ?= build/
main ?= main
mode ?= debug
arch ?= $(shell uname -m)
os ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
ifeq ($(os), linux)
abi = musl
src_dir ?= src
build_dir ?= build/
main ?= main
mode ?= debug
arch ?= $(shell uname -m)
os ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
ifeq ($(os), linux)
abi = musl
@leostera
leostera / miniriot.ml
Last active January 22, 2024 15:50
miniriot.ml
let sample_fun () =
Format.printf "creating fragmented data\r\n%!";
let make_data () =
let smol_array = Array.make 1000 "" in
let big_array = Array.make 1000 "" in
for i = 0 to 999 do
if i mod 2 = 0 then smol_array.(i) <- String.make 1 'h'
else big_array.(i) <- String.make 500_000 'x'
done;
smol_array
import React, { useState, useCallback, useMemo} from 'react';
import ReactFlow, {
ReactFlowProvider,
useNodesState,
useEdgesState,
addEdge,
useReactFlow,
Handle, Position,
} from 'react-flow-renderer';
type QueueOpts = {
maxConcurrency: Number;
};
type Task<R> = () => Promise<R>;
class ConcurrentQueue<R> {
opts: QueueOpts = {
maxConcurrency: 1
};
open Cmdliner
(* our echo function just prints stuff out *)
let echo x = print_string x
(* this is our argument *)
let msg = Arg.(value & pos 0 string "" & info [])
(* this is our program *)
let echo_t = Term.(const echo $ msg)
[[erlang_library]]
name = "lib"
deps = [ "//a:lib" ]
[[erlang_application]]
name = "b_app"
config = "b.app.src"
deps = [ ":lib" ]
[[otp_release]]
use super::archive::Archive;
use super::IntoToolchainBuilder;
use super::ToolchainBuilder;
use anyhow::{anyhow, Context};
use log::debug;
use std::collections::HashMap;
use std::collections::HashSet;
use std::io::{BufRead, BufReader, Write};
use std::path::PathBuf;
use std::process::{Command, Stdio};