Skip to content

Instantly share code, notes, and snippets.

@cavedave
cavedave / breaks.csv
Created May 4, 2026 22:08
World Snooker Crucible: ggplot figures from snooker.org century data (R + CSV)
Year Centuries High Break_Makers
2026 81
2025 107 147 Mark Allen
2024 63 142 Jackson Page, Mark J Williams and Ricky Walden
2023 90 147 Kyren Wilson and Mark Selby
2022 109 147 Neil Robertson
2021 108 144 Shaun Murphy
2020 79 147 John Higgins
2019 100 143 John Higgins
2018 84 146 John Higgins
"start_year","end_year","start_value","end_value","change_value","pct_change","winner","winner_label","period","is_original_window"
1900,1910,1000,1057.58394685222,57.5839468522165,5.75839468522165,"Ehrlich","Ehrlich (prices rose)","1900->1910",FALSE
1901,1911,1000,1386.4192309077,386.4192309077,38.64192309077,"Ehrlich","Ehrlich (prices rose)","1901->1911",FALSE
1902,1912,1000,1341.73020560188,341.730205601884,34.1730205601884,"Ehrlich","Ehrlich (prices rose)","1902->1912",FALSE
1903,1913,1000,1487.37147860107,487.371478601067,48.7371478601067,"Ehrlich","Ehrlich (prices rose)","1903->1913",FALSE
1904,1914,1000,1135.6068795084,135.606879508398,13.5606879508398,"Ehrlich","Ehrlich (prices rose)","1904->1914",FALSE
1905,1915,1000,1881.17122655875,881.171226558753,88.1171226558753,"Ehrlich","Ehrlich (prices rose)","1905->1915",FALSE
1906,1916,1000,2024.47833008782,1024.47833008782,102.447833008782,"Ehrlich","Ehrlich (prices rose)","1906->1916",FALSE
1907,1917,1000,1527.06554576622,527.06554576622,52.706554576622,"
@cavedave
cavedave / bigbags.py
Last active March 23, 2026 18:20
Skittles charts: fun-size (Clare Wallace Excel) + full-size packs (possibly-wrong/skittles). https://www.clarewallace.co.uk/skittles | https://github.com/possibly-wrong/skittles | https://github.com/cavedave/skittles
"""
Skittles Analysis — Possibly Wrong dataset
-------------------------------------------
Analyzes 468 full-size Skittles packs from the possibly-wrong dataset.
Same chart style as the Clare Wallace fun-size analysis.
Source: https://github.com/possibly-wrong/skittles
Usage:
pip install pandas matplotlib
"""
Extract coal electricity generation (TWh) by year from Ember data.
China coal can use monthly or yearly data; World uses yearly.
"""
import argparse
import pandas as pd
from pathlib import Path
@cavedave
cavedave / Disruptions.csv
Last active March 12, 2026 13:42
Timeline for Iranian Nuclear weapon
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
start_date,end_date,speaker,role,horizon,claim,source,source_url
1992-10-01,1999-12-31,Shimon Peres,Israeli FM,"by 1999","Iran ""set to have nuclear warheads by 1999"" (as reported in later timelines).",The Christian Science Monitor,https://www.csmonitor.com/World/Middle-East/2011/1108/Imminent-Iran-nuclear-threat-A-timeline-of-warnings-since-1979/Israel-paints-Iran-as-Enemy-No.-1-1992
1992-01-01,1997-12-31,Benjamin Netanyahu,Israeli MK,"within 3–5 years",Iran becoming autonomous in ability to develop/produce a nuclear bomb.,Al Jazeera,https://www.aljazeera.com/gallery/2025/6/18/the-history-of-netanyahus-rhetoric-on-irans-nuclear-ambitions
1993-02-01,1999-12-31,Benjamin Netanyahu,Israeli MK,"by 1999","In a Feb 1993 column (Yedioth Ahronoth) Netanyahu wrote that Iran would develop its first nuclear bomb by 1999.",Ynet,https://www.ynetnews.com/article/4633272
1995-01-05,2000-01-05,Senior US & Israeli officials (quoted),quoted,"less than five years","""Less than five years away"" from having a nuclear bomb (quot
@cavedave
cavedave / america.py
Last active February 22, 2026 10:53
Irelands alcohol consumption over time
import pandas as pd
url = "https://sdmx.oecd.org/public/rest/data/OECD.ELS.HD,DSD_HEALTH_LVNG@DF_HEALTH_LVNG_AC,1.0/.A.....?dimensionAtObservation=AllDimensions&format=csvfilewithlabels&startPeriod=1960"
df = pd.read_csv(
url,
storage_options={
"User-Agent": "Mozilla/5.0"
}
)
@cavedave
cavedave / data-FdN4y.csv
Last active February 17, 2026 16:27
us wedding costs by state data from https://www.markbroumand.com/pages/research-wedding-cost-and-marriage-length interestng paper diamonds are forever that goes into more individual data https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2501480
State Average Wedding Cost Average Marriage Length
Alabama 34000 20.3
Arizona 32000 20.6
Arkansas 25000 19.4
California 41000 19.9
Colorado 34000 17.9
Connecticut 44000 21.4
Delaware 39000 21.9
DC 42000 10.8
Florida 34000 20.3
decade global_stations tv_power_escaping_mw radio_power_escaping_mw seti_detectable_mw total_anthropogenic_rf_mw
1920s 5 0.0005 0.005 0.0055 0.01
1930s 15 0.003 0.25 0.253 0.05
1940s 55 0.2 0.5 0.7 1
1950s 550 5 1 6 5
1960s 3000 30 2 32 40
1970s 7500 75 3 78 100
1980s 12500 125 4 129 165
1990s 17500 175 5 180 260
2000s 22500 125 6 131 300
import re
from io import StringIO
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
DATA = """pasta\tbox time\tactual al dente\tdifference
install.packages("readr", quiet = TRUE)
library(readr)
data https://mqscores.wustl.edu/measures.php
justices_df <- read_csv("justices.csv")
library(dplyr)
library(ggplot2)
# 1. Sitting Justices as of 2026
keep <- c("CThomas", "SAAlito", "JGRoberts", "EKagan", "SSotomayor",