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
xterm_colors = [
# colors 0..15: 16 basic colors
(0x00, 0x00, 0x00), # 0
(0xCD, 0x00, 0x00), # 1
(0x00, 0xCD, 0x00), # 2
(0xCD, 0xCD, 0x00), # 3
(0x00, 0x00, 0xEE), # 4
(0xCD, 0x00, 0xCD), # 5
(0x00, 0xCD, 0xCD), # 6
(0xE5, 0xE5, 0xE5), # 7
@agoose77
agoose77 / README.md
Created March 27, 2026 14:07
Generate nbgitpuller-aware permalinks

Modify user-direct URLs to include permalinks

This script takes two URLs, the permalink URL for a hub profile, and a user-direct URL (e.g. an nbgitpuller URL), and fuses them together.

python ./permalink.py <USER-URL> <PERMALINK-URL>

The output is the fixed URL.

Basic JupyterHub CLI

Spin up named servers from a CLI

python jupyterhub-cli.py --server <SERVER-NAME> --profile-option="profile=<PROFILE-SLUG>" https://my-hub.com/hub/api/ <API-TOKEN>

You can use this with xargs to spin up several servers.

@agoose77
agoose77 / flake.lock
Last active February 13, 2026 11:47
MyST Flake
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1770841267,
"narHash": "sha256-9xejG0KoqsoKEGp2kVbXRlEYtFFcDTHjidiuX8hGO44=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ec7c70d12ce2fc37cb92aff673dcdca89d187bae",
"type": "github"
@agoose77
agoose77 / README.md
Created January 22, 2026 16:19
Start a JupyterHub from the CLI

I always feel like state machines can quickly become a lot of pain. Although I have had my reservations about the Python case/match feature, it's a perfect fit for this.

@agoose77
agoose77 / social-cats.js
Created January 22, 2026 14:56
Google Meet custom reacts
// ==UserScript==
// @name Custom Meet GIFs
// @namespace http://tampermonkey.net/
// @version 2026-01-22
// @description try to take over the world!
// @author You
// @match https://meet.google.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
kernelspec
name display_name
python3
Python 3

Markup Generation

:name: demo
@agoose77
agoose77 / app.mjs
Last active March 27, 2026 12:45
Prototype for extend/override in MyST extends
import { readFileSync } from "node:fs";
import { parseYaml, extend } from "./config.mjs";
const [baseConfig] = parseYaml(readFileSync("base.yml", { encoding: "utf-8" }));
const [extendsConfig, extendsStrategy] = parseYaml(
readFileSync("child.yml", { encoding: "utf-8" }),
);
console.dir(extendsStrategy, {depth:null});
const result = extend(baseConfig, extendsConfig, extendsStrategy);
console.dir(result, {depth:null});
@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: