Skip to content

Instantly share code, notes, and snippets.

View agoose77's full-sized avatar
🏠
Working from home

Angus Hollands agoose77

🏠
Working from home
View GitHub Profile
@agoose77
agoose77 / README.md
Last active November 3, 2025 14:32
Demo of content generation with MyST

MyST content generation

This Gist contains a Flask app that emulates a MyST content server. We dynamically generate AST on the fly.

Usage

  1. npm run theme:book in MyST Theme repo
  2. flask --app app run --port 3100
  3. Go!
@agoose77
agoose77 / check-quotas.py
Last active October 17, 2025 17:52
Quota Policies
#!/usr/bin/env python
import subprocess
import json
import argparse
import math
import sys
NFS_TEMPLATE = """
jupyterhub-home-nfs:
quotaEnforcer:
#!/usr/bin/env bash
set -eu
# We ensure that nothing has the wrong project by clearing project IDs
# Clear the /export/staging project (it's not actually a project, but this works)
xfs_quota -x -c "project -C -p /export/staging 0" /export -D /dev/null -P /dev/null
# We ensure no quotas are set, so that the reconciliation loop happens
# Clear all quotas
cut -d: -f1 /etc/projid | tail -n+2 | xargs -I{} xfs_quota -x -c 'limit -p bhard=0 {}' -D /etc/projects -P /etc/projid /export
import retextSpell from "retext-spell";
async function loadDictionary(dictionary) {
const baseUrl = new URL(`https://unpkg.com/dictionary-${dictionary}@latest/`);
const [aff, dic] = await Promise.all([
fetch(new URL("index.aff", baseUrl)),
fetch(new URL("index.dic", baseUrl)),
]);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
.jp-NotebookPanel-toolbar {
display: none;
& ~ *{
top: 0px!important;
}
}
@agoose77
agoose77 / .flake8
Last active August 30, 2025 12:52
Launch JupyterLab with basic LSP support
[flake8]
# Match black
max-line-length = 88
# Allow asymmetric commas, etc.
extend-ignore =
E203,
# Spurious warnings in JupyterLab for code cells that follow Markdown cells
E303
exclude = .git,__pycache__,build,dist,.venv
max-complexity = 10
"jupyter.lab.menus": {
"main": [
{
"id": "jp-mainmenu-run",
"items": [
{
"command": "apputils:run-all-enabled",
"args": {
"commands": [
"notebook:clear-all-cell-outputs",
  1. Run npm install
  2. Run npm run build
  3. Use node dist/provision.cjs **/*.md inside your top-level Python virtual environment that is used by MyST to run Jupyter Server
#!/usr/bin/env python3
import re
import sys
import tomllib
import json
import argparse
import pathlib
import shutil
import subprocess