Skip to content

Instantly share code, notes, and snippets.

View fjebaker's full-sized avatar
🪴
automating my houseplants...

Fergus Baker fjebaker

🪴
automating my houseplants...
View GitHub Profile
Base.@kwdef struct CustomDisplay <: AbstractDisplay
image_dir::String = "figs"
end
image_directory(c::CustomDisplay) = c.image_dir
_mime_extension(::MIME"image/png") = "png"
_mime_extension(::MIME"image/svg") = "svg"
function Base.display(c::CustomDisplay, m::MIME, @nospecialize(x))
@fjebaker
fjebaker / ytdl_chapters.py
Last active July 6, 2021 14:48
Add a `--split-chapters` option to `youtube-dl`
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# hacky way of adding a new option to the parser, and subsequently working out what the filename is called
import subprocess
import sys
import os
import glob
import re
@fjebaker
fjebaker / custom-admonitions.md
Last active April 19, 2024 12:36
Custom Admonition Classes in MyST and Jupyter Book

Custom Admonition Classes in MyST for Jupyter Book

I'm writing a Jupyter Book which presents mathematical theorems, and I'd like to have a special admonition for displaying lemmas and theorems.

This can be done by editing the sphinx configuration settings in _config.yml to include a path to your custom styles:

sphinx:
  config:
    html_css_files:
      - "_static/mystyle.css"
@fjebaker
fjebaker / bbc_radio.sh
Last active March 3, 2021 18:13
mpd BBC Radio Streams
#!/bin/bash
# station urls found in http://www.suppertime.co.uk/blogmywiki/2015/04/updated-list-of-bbc-network-radio-urls/
# script inspired by https://gist.github.com/stengland/4052479
STATIONS=(
radio1 radio1xtra radio2 radio3
radio4fm radio4lw radio4extra
radio5live 6music asianet
cymru foyle nangaidheal scotlandfm
@fjebaker
fjebaker / zotero-webdav.md
Last active March 22, 2024 22:09
How to setup a private Zotero sync using WebDAV and Docker.

Zotero Sync with WebDAV and Docker

Zotero is another tool for keeping track of research papers, except Zotero does much more than that: the open source software ships with a browser extension which allows you to add almost anything (papers, book, videos, wikipedia pages) to your library with a single click, keep notes and additional resources close at hand, and export citations in a whole mass of different formats.

In addition to all that, Zotero also comes with a cloud storage sync, so you can back up all of your library and sync it on other machines.

Zotero provides a WebDAV client so that you can host your own, however this isn't particuarly well documented to date.

  • Requisites:

You'll need Docker and a Zotero login (file sync is prevented without a login, so you can create a throw away one if so desired).