Skip to content

Instantly share code, notes, and snippets.

View mrchrisadams's full-sized avatar

Chris Adams mrchrisadams

View GitHub Profile
@mrchrisadams
mrchrisadams / 1.readme.md
Last active February 9, 2026 10:02
How to use Marimo with energy disclosing inference providers.
@mrchrisadams
mrchrisadams / 01 - PROPOSAL.md
Last active February 13, 2026 09:34
RFC: Energy Tracking as First-Class Citizen in OpenCode - Proposal for native energy/carbon tracking with plugin hooks

Proposal: Energy Tracking as a First-Class Citizen in OpenCode

Summary

This proposal adds native energy and carbon tracking to OpenCode by:

  1. Capturing measured energy data from providers that supply it (GreenPT, Neuralwatt)
  2. Estimating energy for providers that don't measure it
  3. Storing energy data alongside existing token/cost data
  4. Providing plugin hooks for customization and external integration
@mrchrisadams
mrchrisadams / opencode-energy-tracking.md
Last active February 8, 2026 17:21
Research: Energy and Carbon Tracking for OpenCode - Analysis of instrumenting OpenCode with energy/carbon data similar to llm-greenpt and llm-neuralwatt

Energy and Carbon Tracking for OpenCode

Research Document: Instrumenting OpenCode with Energy/Carbon Data

Date: January 2025
Author: Research analysis based on llm-greenpt, llm-neuralwatt, and OpenCode codebase


Executive Summary

@mrchrisadams
mrchrisadams / 1. WordPress with SQLite on FrankenPHP.md
Last active February 4, 2026 21:21
WordPress + FrankenPHP + SQLite with systemd socket activation (start on demand, stop when idle)

WordPress with SQLite on FrankenPHP

A lightweight WordPress setup using SQLite instead of MySQL/MariaDB, powered by FrankenPHP. No database server required.

Quick Start

For a fresh Ubuntu 24.04 server:

curl -fsSL https://raw.githubusercontent.com/YOUR_REPO/setup.sh | sudo bash -s -- yourdomain.com 8000
@mrchrisadams
mrchrisadams / readme.md
Last active July 29, 2025 08:02
This is an example wordpress plugin to add carbon.txt headers into wordpress.

What's this?

This is is an minimal wordpress plugin we would need to allow any WordPress site to link to a carbon.txt file we would need to set up linked domains to work with the Green Web Platform.

How would it need to work?

  1. Install this plugin
  2. Activate the plugin
  3. Set the location of the carbon.txt file (see the screenshot)
@mrchrisadams
mrchrisadams / devcontainer.json
Last active November 13, 2024 09:25
codespaces do not seem to respect new features added when building. this is me troubleshooting
{
"// filepath-in-my-repo": ".devcontainer/devcontainer.json",
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {},
"ghcr.io/eitsupi/devcontainer-features/just:0": {}
}
}
@mrchrisadams
mrchrisadams / local-llm-with-ollama.md
Last active August 16, 2025 18:53
Experimenting with getting a chat interface running with a local LLM using Marimo. Run with marimo edit `local-llm-with-ollama.py`
title marimo-version width
Local Llm With Ollama
0.9.1
medium
import marimo as mo
import llm
import markdown
@mrchrisadams
mrchrisadams / sizes-of-mariadb-tables.sql
Last active July 14, 2023 10:26
This command, when run in a MySQL compatible database like MariaDB will return a list of all the tables, in descending order of tables size in megabyes.
select table_schema as database_name,
table_name,
round(
sum((data_length + index_length + data_free)) / power(1024, 2),
2
) as table_size
from information_schema.tables
where table_schema = 'table_name' -- put your database name here
and table_type = 'BASE TABLE'
group by table_schema,
@mrchrisadams
mrchrisadams / README.md
Last active November 29, 2023 12:50
How to do application level scale to zero with Gunicorn

What's this?

This is an experiment with making gunicorn gracefully scale down to zero after X seconds, as a way to do application-level scale-to-zero behaviour in applications that use a webserver like Gunicorn. The idea here is that you do not need to mess too much internal logic of an existing application, nor put it in a container if you use this.

Instead you use the web server's own support for handling SIGTERM signals, to allow gracefully scaling down of processes when they are not in use.

If you're using Linux to run a server, the chances of Systemd being used to manage your processes is fairly high, as it's the default option for a number of linux distributions now.

It also means you might not need a complicated "serverless" system to orchestrate scaling up and down, to reclaim memory on a server for us in other tasks if you have a website or webservice that isn't continually serving traffic.

Grace for submission to the Regent House under Special Ordinance A (ii) 5 (fossil fuel industry ties)

21 July 2022

The Council has received the following Grace, which has been initiated under Special Ordinance A (ii) 5 by 84 members of the Regent House:

The University of Cambridge has a strong, stated commitment to addressing the climate crisis and to keeping global heating below a 1.5 degrees Celsius increase from pre‐industrial levels.

The University currently maintains research funding partnerships with major fossil fuel companies, including Shell and BP (https://www.cam.ac.uk/about‐research/energy‐sector‐partnerships).