Skip to content

Instantly share code, notes, and snippets.

View leifdenby's full-sized avatar
🌍

Leif Denby leifdenby

🌍
View GitHub Profile
@leifdenby
leifdenby / anemoi_core_config_init_args.md
Created January 23, 2026 07:51
Anemoi core classes that take "config" arguments

Anemoi Classes With Config init Arguments

Class inventory for anemoi graphs, models, and training modules, listing classes whose init takes config-like arguments. Built on 2026-01-23 08:49:30 , commit 27bd3dd.

Total classes: 85

Class init argument(s) Module
AnemoiDatasetNodes dataset: DictConfig anemoi-graphs
@leifdenby
leifdenby / anemoi_core_class_names_and_counts.md
Last active January 23, 2026 07:26
Anemoi classes inventory

Anemoi Class Inventory

Class inventory for anemoi graphs, models, and training modules, listing base/derived classes, files, and markers for abstract and torch module inheritance.

Built on 23/1/2026, from commit 27bd3dd committed 10/10/2025

Table of contents:

Module Base count Non-base count
@leifdenby
leifdenby / s3-cheat-sheet.md
Last active April 14, 2025 16:12
Commands that I frequently use when using AWS S3 like services from command line

Credentials

Tool AWS Profile Support & CLI Argument Custom Endpoint Support & Method Set public-read ACL?
aws s3 --profile <profile-name> --endpoint-url <url> --acl public-read
s3cmd ❌ No profile support, ✅ Env vars: AWS_ACCESS_KEY_ID, etc. ✅ Config-only: host_base, host_bucket in ~/.s3cfg --acl-public
s5cmd --profile <profile-name> or AWS_PROFILE --endpoint-url <url> or AWS_ENDPOINT_URL --acl public-read
s3-credentials --profile ❌ Not supported
@leifdenby
leifdenby / ecmwf-event-parser.py
Last active December 1, 2022 09:55
Parser for ECWMF event pages
import requests
import bs4
import dateutil.parser
import pandas as pd
def parse_event_details(url):
"""
Parse event details from ECMWF event page and return title, timings,
speaker name, speaker affiliation, talk pdf and video URLs as a
pandas.DataFrame
@leifdenby
leifdenby / formattedSkimNotes.scpt
Created June 28, 2021 07:20
applescript for Skim annotations export
tell application "Skim"
set theFile to the file of the front document
set outText to ""
set newLine to ASCII character 10
set docTitle to "## Detailed notes"
# This used the commandline tool pdftk to figure out where the table of
@leifdenby
leifdenby / cmip6.py
Last active May 24, 2021 12:22
Example CMIP load from JASMIN
"""
Utility functions for contructing paths and finding files for CMIP6 data
Leif Denby, v3, 24/5/2021
Historical runs (1850-2014) are in
`<data_root>/CMIP/<institute>/<model>/historical/<variant>/<table_id>/<variable>/<grid>/<version>/`
Scenario runs are in
@leifdenby
leifdenby / generic_consumer_task.py
Created March 29, 2021 09:35
Consumer task with dynamic number of requirements
import luigi
def pack(cls, **kwargs):
return dict(class_name=cls.__name__, kwargs=kwargs)
def unpack(class_name, kwargs):
TaskClass = globals()[class_name]
return TaskClass(**kwargs)
@leifdenby
leifdenby / build.sh
Last active February 2, 2021 18:10
Building vim with python3 support against conda python (into ~/.local)
# create a conda environment with python3 and activate it
git clone https://github.com/vim/vim
cd vim
./configure --with-features=huge --enable-python3interp=dynamic --prefix=$HOME/.local
# add the following lines to ~/.vimrc, changing `py36` do your env name and possible the python version in `libpython3.7m.so`
#
# set pythonthreedll=$HOME/anaconda2/envs/py37/lib/libpython3.7m.so
# set pythonthreehome=$HOME/anaconda2/envs/py37/
@leifdenby
leifdenby / httpcors
Created January 16, 2021 13:13 — forked from gkatsev/httpcors
simple python3 http server with CORS enabled
#!/usr/bin/env python
import http.server
class CORSHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
@leifdenby
leifdenby / filter_bibliography.py
Created June 10, 2020 09:47
Filter bibliography file based on citations used in tex document
# coding: utf-8
"""
Created a filtered .bib-file from citations used in a specific .tex source file
"""
import pybtex
import pybtex.database
import pybtex.errors
import re