Skip to content

Instantly share code, notes, and snippets.

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
@cavedave
cavedave / young.py
Created September 15, 2025 19:54
Neil Young Age
import numpy as np
import matplotlib.pyplot as plt
# People (first name, birth year)
people = [
("Neil", 1945),
("Paul", 1956),
("Angus", 1955),
("Sean", 1959),
("Esme", 1949),
@cavedave
cavedave / plot_actual_solar.py
Created August 30, 2025 19:38
Solar PV Generation Data and Plotting Script - Historical data vs IEA WEO projections
#!/usr/bin/env python3
"""
Simple script to plot actual solar generation observations with projection lines.
"""
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
def plot_actual_solar_with_projections():
@cavedave
cavedave / bls.py
Last active August 4, 2025 11:37
how much are bls estimates out by?
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
import datetime
# data from https://www.bls.gov/news.release/empsit.nr0.htm
excel_file = '/content/cesvin00.xlsx'
df_data = pd.read_excel(excel_file, sheet_name='Data', header=2)
# Reference‐months
@cavedave
cavedave / coaluk.ipynb
Created July 26, 2025 09:33
coaluk.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.