Skip to content

Instantly share code, notes, and snippets.

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 September 8, 2025 08:10
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.
@cavedave
cavedave / electricity.ipynb
Last active June 19, 2025 23:10
electricity.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 / july1976.ipynb
Created June 14, 2025 08:19
july1976.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.