Skip to content

Instantly share code, notes, and snippets.

@yorickdowne
yorickdowne / HallOfBlame.md
Last active January 16, 2025 14:16
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on latency and IOPS, I/O Per Second, of the storage. Budget SSDs will struggle to an extent, and some won't be able to sync at all. For simplicity, this page treats IOPS as a proxy for/predictor of latency.

This document aims to snapshot some known good and known bad models.

The drive lists are ordered by interface and then by capacity and alphabetically by vendor name, not by preference. The lists are not exhaustive at all. @mwpastore linked a filterable spreadsheet in comments that has a far greater variety of drives and their characteristics. Filter it by DRAM yes, NAND Type TLC, Form Factor M.2, and desired capacity.

For size, 4TB is a very conservative choice. The smaller 2TB drive should last an Ethereum full node until at least sometime 2026, with the pre-merge history expiry scheduled for Ma

use std::collections::HashMap;
use std::fmt;
use std::io;
use std::num::ParseFloatError;
use std::rc::Rc;
/*
Types
*/
@miguelmota
miguelmota / gaps.sql
Last active November 23, 2022 19:25
PostgreSQL find gaps in sequence
-- table is 'blocks'
-- column is 'number'
SELECT
gap_start, gap_end FROM (
SELECT number + 1 AS gap_start,
next_nr - 1 AS gap_end
FROM (
SELECT number, lead(number) OVER (ORDER BY number) AS next_nr
FROM blocks
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active January 17, 2025 21:04
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
WITH weeks AS (
SELECT distinct date_trunc('week', dates)::date AS start,
daterange(date_trunc('week', dates)::date, (date_trunc('week', dates) + interval '7 days')::date) week
FROM generate_series(date '2013-01-01', now(), '1 day')
dates ORDER BY 1
)
SELECT weeks.start,
count(whatever.*) as count
FROM whatever
JOIN weeks
@jctosta
jctosta / screen_cheatsheet.markdown
Last active January 17, 2025 13:25
Screen Cheatsheet

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@brandur
brandur / request-trees.md
Last active August 29, 2015 14:05
Request Trees

But why gen a new id if someone passes you an id? Just use the supplied id in the called srvc.

This is certainly disputable territory, but the main motivation is that depending on service architecture, a single incoming request can balloon out into a full tree of backend requests because requests can map 1:N between any two components. Assigning every request in every component a unique ID allows any particular request to be isolated, while still allowing the any subsection of the tree to be viewed all at once.

Visually, this might look something like this:

      Component 1            Component 2            Component 3
+----------------------+----------------------+----------------------+
@gavinandresen
gavinandresen / BlockPropagation.md
Last active June 28, 2024 08:17
O(1) block propagation

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

@roidrage
roidrage / meatballs.md
Last active November 16, 2024 00:06
Americanized version of my meatballs recipe

The @roidrage meatballs extravaganza.

The secret ingredient to this recipe is letting everything stew for a few hours. First the tomato sauce, requires at least 90 minutes to 2 hours. Then the meatballs in the sauce another 90 minutes. The longer the better.

Once the meatballs are in the sauce, the more time you give them, the more delicious flavor will seep from the meat into the sauce, and vice versa. I'd recommend giving it a total of four hours for maximum taste extraction.

The long stew ensure that the fluids have evaporated and that you're left with the tastiest meatballs you've ever had.

Ingredients (serves four hungry people):

@JoshCheek
JoshCheek / what-is-an-object.txt
Last active January 1, 2016 02:18
Feynman talking about definitions of objects
Any simple idea is approximate; as an illustration, consider an object,
… what is an object? Philosophers are always saying, “Well, just take a chair for example.”
The moment they say that, you know that they do not know what they are talking about any more.
What is a chair? Well, a chair is a certain thing over there … certain?, how certain?
The atoms are evaporating from it from time to time—not many atoms,
but a few—dirt falls on it and gets dissolved in the paint;
so to define a chair precisely, to say exactly which atoms are chair,
and which atoms are air, or which atoms are dirt,
or which atoms are paint that belongs to the chair is impossible.
So the mass of a chair can be defined only approximately.