Skip to content

Instantly share code, notes, and snippets.

View WillKoehrsen's full-sized avatar
🌆
building

Will Koehrsen WillKoehrsen

🌆
building
View GitHub Profile
@WillKoehrsen
WillKoehrsen / README.md
Created October 14, 2026 18:50
Claude Code status line with real-time ERCOT and PJM prices and fuel mix from the Grid Status API

Grid Snapshot Status Line

A Claude Code status line built on ccstatusline that shows real-time ERCOT and PJM hub prices and fuel mix from the Grid Status API, alongside the model, context use, weekly usage, the clock and local weather.

Model: Opus 5.5 | Context: [███░░░░░░░░░░░░░] 184k/1.0M (18%) | Weekly: 20.0% | Wed Oct 14 13:45:19 CDT | Austin 84°F (feels 88°F) | ERCOT $45.98 ████████████████████ gas 35% solar 28% wind 21% | PJM $65.21 ████████████████████ gas 40% nuclear 24% coal 18%

Prices are real-time LMPs in $/MWh at ERCOT's hub average and PJM Western Hub. Each fuel mix bar is 20 cells wide (one cell is 5% of current generation), colored with the same fuel colors as the charts on gridstatus.io, and followed by the three largest fuels. Battery charging counts as load, so it is left out.

def house_price_in_aus_from_model(usd_per_floor,
usd_per_bathroom_squared,
floor_count,
bathroom_count,
usd_to_aus_rate):
"""
Calculate the house price in Australian dollars from
a polynomial regression model
"""
PIXEL_NORMALIZATION_FACTOR = 12.5
PIXEL_OFFSET_FACTOR = 150
for row_index in range(row_count):
for column_index in range(column_count):
for color_channel_index in range(color_channel_count):
normalized_pixel_value = (
original_pixel_array[row_index][column_index][color_channel_index]
* PIXEL_NORMALIZATION_FACTOR
)
define(['base/js/namespace', 'base/js/events'], function (Jupyter, events) {
// Template cells including markdown and imports
var setUp = function () {
Jupyter.notebook.insert_cell_at_index('markdown', 0)
.set_text(`# Introduction
State notebook purpose here`)
Jupyter.notebook.insert_cell_at_index('markdown', 1).set_text(`### Imports
Import libraries and write settings here.`)
// Define imports and settings
Jupyter.notebook.insert_cell_at_index('code', 2)
import pandas as pd
import numpy as np
# Pandas options
pd.options.display.max_columns = 30
pd.options.display.max_rows = 20
from IPython import get_ipython
ipython = get_ipython()
def show_stats_by_tag(tag):
return(df.groupby(f'<tag>{tag}').describe()[['views', 'reads']])
stats = interact(show_stats_by_tag,
tag=widgets.Dropdown(options=['Towards Data Science', 'Education',
'Machine Learning', 'Python', 'Data Science']))
# Create widgets
directory = widgets.Dropdown(options=['images', 'nature', 'assorted'])
images = widgets.Dropdown(options=os.listdir(directory.value))
# Updates the image options based on directory value
def update_images(*args):
images.options = os.listdir(directory.value)
# Tie the image options to directory value
directory.observe(update_images, 'value')
# Create interactive version of function with DatePickers
interact(stats_for_article_published_between,
start_date=widgets.DatePicker(value=pd.to_datetime('2018-01-01')),
end_date=widgets.DatePicker(value=pd.to_datetime('2019-01-01')))
import cufflinks as cf
@interact
def scatter_plot(x=list(df.select_dtypes('number').columns),
y=list(df.select_dtypes('number').columns)[1:],
theme=list(cf.themes.THEMES.keys()),
colorscale=list(cf.colors._scales_names.keys())):
df.iplot(kind='scatter', x=x, y=y, mode='markers',
xTitle=x.title(), yTitle=y.title(),
# Correlation between two columns with dropdown
@interact
def correlations(column1=list(df.select_dtypes('number').columns),
column2=list(df.select_dtypes('number').columns)):
print(f"Correlation: {df[column1].corr(df[column2])}")
# Stats of a column with dropdown
@interact
def describe(column=list(df.columns)):
print(df[column].describe())