Skip to content

Instantly share code, notes, and snippets.

View leifdenby's full-sized avatar
🌍

Leif Denby leifdenby

🌍
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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