Skip to content

Instantly share code, notes, and snippets.

From ac5609c2f0cb65886fe6e7e8f41971b3ce1807f3 Mon Sep 17 00:00:00 2001
From: Thomas Sibley <[email protected]>
Date: Wed, 12 Feb 2025 13:24:59 -0800
Subject: [PATCH] Excise Vercel's sponsorship
It's no more.
---
README.md | 20 -------------------
.../src/assets/img/powered-by-vercel.svg | 1 -
.../src/components/Layout/Footer.tsx | 5 -----
@tsibley
tsibley / README.md
Created February 10, 2025 17:58
Augur/Auspice accession and url demo
$ augur export v2 --tree test.nwk --metadata test.tsv --metadata-columns accession url --output test.json
WARNING: You didn't provide information on who is maintaining this analysis.

Validating produced JSON
Validating schema of 'test.json'...
Validating that the JSON is internally consistent...
Validation of 'test.json' succeeded.
#!/usr/bin/env python3
from copy import copy
from shutil import copyfileobj
from sys import argv, stderr
from zipfile import ZipFile
zi = ZipFile(argv[1], "r")
zo = ZipFile(argv[2], "w")
xform = argv[3]
@tsibley
tsibley / alt
Created February 3, 2025 19:27
def pathogen_version_for_setup(name_version_url: str) -> "PathogenVersion":
# XXX FIXME docstring
"""
TKTK
"""
name, version, url = spec = PathogenSpec.parse(name_version_url)
if not name:
raise UserError(f"""
No name specified in {name_version_url!r}.
#!/bin/python3
from argparse import ArgumentParser, ArgumentError
from contextlib import contextmanager
@contextmanager
def scoped_setattr(obj, name, value):
dne = object()
try:
#!/bin/python3
import argparse
class OverloadAction(argparse.Action):
class OverloadParser(argparse.ArgumentParser):
def exit(self, status = 0, message = None):
raise argparse.ArgumentError(None, message)
def _print_message(self, message, file = None):
@tsibley
tsibley / Snakefile
Last active November 12, 2024 18:29
"""
For Cécile, re: <https://bedfordlab.slack.com/archives/C0K3GS3J8/p1731108015913239>.
The rule-of-thumb is: if you need to read from a file output by rule A in order
to determine what rule B will declare as input, then rule A needs to be a
checkpoint and rule B needs to use an input function that reads from the file.
In this example, the intermediate rule is naive to the checkpoint and input
function: it's a basic rule that uses two wildcards. The final rule uses an
input function to declare input files that "pass thru" the global {scenario}
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
from sys import argv, stdin, stdout
layer = argv[1]
doc = ET.parse(stdin)
root = doc.getroot()
for g in root.findall(".//{http://www.w3.org/2000/svg}g[@id]"):
id = g.get("id")
@tsibley
tsibley / clockins
Last active November 9, 2024 03:53
#!/bin/bash
# usage: clockins [<since>]
#
# <since> defaults to "yesterday".
set -euo pipefail
since="${1:-yesterday}${1:+ ago}"
{
journalctl \
@tsibley
tsibley / plx
Created November 3, 2024 17:06
#!/bin/bash
# usage: plx install <module> [args…]
# plx link <module>
# plx ls [<module>]
# plx --help
#
# Install Perl programs into isolated environments.
set -euo pipefail
PREFIX="$(realpath "${PREFIX:-$HOME/.local}")"