Skip to content

Instantly share code, notes, and snippets.

"""
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 4, 2026 19:52
Timeline for Iranian Nuclear weapon
date category target location summary attribution_reported sources
1984-03-24 Bombing (aerial) Bushehr nuclear power plant (under construction) Bushehr, Iran Iraq conducted an air raid on the Bushehr nuclear power plant during the Iran–Iraq War (reported as one of several strikes). Iraq https://www.npolicy.org/article.php?aid=1188&rid=4 ; https://www.iaea.org/sites/default/files/infcirc341.pdf
1987-11-17 Bombing (aerial) Bushehr nuclear power plant (under construction) Bushehr, Iran Iraqi air attack on Bushehr reported by Iran to the UN; part of repeated strikes on the site during the war. Iraq https://docs.un.org/en/A/42/829 ; https://www.upi.com/Archives/1987/11/17/Iraqi-warplanes-twice-bombed-an-unfinished-nuclear-power-plant/3564564123600/
2010-01-12 Assassination Masoud Ali‑Mohammadi (scientist described by Iran as linked to nuclear work) Tehran, Iran Killed by a remote‑controlled bomb (reported attached to a motorcycle). Iran blamed U.S./Israel; attribution disputed https://www.reuters.com/article
@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",
@cavedave
cavedave / club.py
Last active January 10, 2026 18:45
Cheesburgers are not possible before refrigeration and modern farming. The really soft burger buns were not very possible but around harvest time something approaching it was possible. Later breads got dryer. Cheese keeps itself but the mild cheese on cheeseburgers not that long unlike the cavey ones. In general it was not made until later in th…
import pandas as pd
from io import StringIO
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
csv_data = """Product,Start Date,End Date,Notes,Color
Bread (Wheat Flour),2024-01-01,2024-12-31,Grain can be stored year-round,#C2A14D
Bacon (Cured Pork),2024-01-01,2024-12-31,Pigs slaughtered in winter and meat cured for year-round storage,#C45A4A
Turkey,2024-11-01,2025-01-31,Traditional seasonal consumption around holidays,#E8D2C5
Lettuce,2024-05-15,2024-09-30,Cool-season crop; short shelf life before modern cooling,#4CAF50
@cavedave
cavedave / chinacoal.py
Created December 12, 2025 17:16
china coal usage for electrocoty
#get all ember energy data
import pandas as pd
df = pd.read_csv("https://storage.googleapis.com/emb-prod-bkt-publicdata/public-downloads/monthly_full_release_long_format.csv",low_memory=False)
#get coal usage
import pandas as pd
df_china_coal_twh = df[
Phase of Flight,Number of Accidents
LANDING,788
TAKE OFF,128
APPROACH,124
INITIAL CLIMB,92
CRUISE,70
TAXI IN,49
TAXI OUT,45
ENGINE START OR DEPART,44
GO AROUND,29