Skip to content

Instantly share code, notes, and snippets.

@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}")"
diff --git a/ingest/defaults/config.yaml b/ingest/defaults/config.yaml
index 7bd0362..dfddd22 100644
--- a/ingest/defaults/config.yaml
+++ b/ingest/defaults/config.yaml
@@ -39,9 +39,11 @@ curate:
# For the Nextstrain team, this is currently
# "https://raw.githubusercontent.com/nextstrain/ncov-ingest/master/source-data/gisaid_geoLocationRules.tsv"
geolocation_rules_url: "https://raw.githubusercontent.com/nextstrain/ncov-ingest/master/source-data/gisaid_geoLocationRules.tsv"
- # The path to the local geolocation rules within the pathogen repo
+ # General global defaults are sourced from the geolocation_rules_url URL above.
#!/bin/bash
set -euo pipefail
REPO="$(basename $PWD)"
mkdir -p .github
cat > .github/dependabot.yml <<~~
# Dependabot configuration file
# <https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file>
/* Color values from RTD's Doc Diff addon's CSS */
.doc-diff-added { --bgcolor: rgb(171, 242, 188) }
.doc-diff-removed { --bgcolor: rgba(255, 129, 130, 0.4) }
/* Doesn't work in Firefox 131… not sure why… *//*
.doc-diff-removed {
--bgcolor: color(
from rgba(255, 129, 130, 0.4)
srgb
calc(((1 - alpha) * 255) + (alpha * r))
defaults:
a:
x: 1
y: 2
b:
z: 3
builds:
global:
a:
diff --git a/src/reference/ca-certificates.rst b/src/reference/ca-certificates.rst
index 086e37e..583d030 100644
--- a/src/reference/ca-certificates.rst
+++ b/src/reference/ca-certificates.rst
@@ -68,7 +68,8 @@ OpenSSL is the most common library used to provide TLS/SSL support in
application software. Its `default locations of trusted CA certificates
<https://docs.openssl.org/3.0/man3/SSL_CTX_load_verify_locations/>`__ can be
overridden by setting the ``SSL_CERT_FILE`` and/or ``SSL_CERT_DIR`` environment
-variables.
+variables. Filenames in the latter must be hashed with OpenSSL's ``c_rehash``
/* Revert *some* of what RTD's force-readthedocs-addons.js does.
*
* <https://github.com/readthedocs/common/blob/c766aa84a01b74d83c5fac061d92e31d512df99f/dockerfiles/force-readthedocs-addons.js#L96-L118>
*/
let esc = text => String(text).replace(/[&<>"']/g, x => `&#${x.charCodeAt(0)};`);
// This HTML is very specific to sphinx_rtd_theme.
let rstVersions = `
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="Versions">
<span class="rst-current-version" data-toggle="rst-current-version">