Skip to content

Instantly share code, notes, and snippets.

@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.
@cavedave
cavedave / addsteps.py
Last active December 24, 2025 14:04
staircase.ipynb
# 1) find every record‐breaking year ≥ 1980
post80 = ts.where(ts.index >= 1980)
current_max = -np.inf
record_years = []
record_values = []
for yr, val in post80.items():
if np.isnan(val):
continue
if val >= current_max:
@cavedave
cavedave / .env
Last active July 5, 2025 13:12
coachbase and gemini check. Code to check if my env file lets us talk to Gemini and Coachbase correctly. A hello world to make sure a connection works. before you start doing clever LLM chats to is.
# Google API Key (required)
GOOGLE_API_KEY=
# Couchbase Capella Configuration (required)
COUCHBASE_CONN_STR=couchbases://cb....
COUCHBASE_USERNAME=...
COUCHBASE_PASSWORD=...
COUCHBASE_BUCKET=travel-sample
@cavedave
cavedave / worldpopulation.ipynb
Created June 27, 2025 19:39
worldpopulation.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.