This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '''Typer with optional TOML configuration files.''' | |
| import tomllib | |
| from pathlib import Path | |
| from typing import Annotated | |
| import typer | |
| def config_callback(ctx: typer.Context, configs: list[Path]): | |
| '''Overwrite default options.''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| #$ -j y | |
| #$ -o "$JOB_ID.$TASK_ID" | |
| #$ -t 1-1 | |
| #$ -ac d=none | |
| #$ -jc pcc-large | |
| # this script can be used to run a matrix of different combinations of | |
| # variables as an array job on SGE-like clusters | |
| # adapt the header above for your cluster-specific needs | |
| # submit this script with `bash path/to/script.sh [optional args...]` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| die(){ | |
| echo "$@" | |
| exit 1 | |
| } | |
| APIKEY="$(gpg -qd ~/.config/apikey/openai.gpg)" | |
| [ "$APIKEY" ] || die "Failed to fetch api key." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| die(){ | |
| echo "${@}" | |
| exit 1 | |
| } | |
| list-targets(){ | |
| find "${OTPDIR}" -type f -name '*.gpg' -printf '%P\n' | sed 's/.gpg$//g' | |
| exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os | |
| from zipfile import ZipFile | |
| import click | |
| from jinja2 import Template | |
| MANIFEST = r''' | |
| <manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from datetime import datetime | |
| import click | |
| from khal.settings import get_config | |
| from khal.cli import build_collection | |
| from icalendar import Calendar | |
| @click.command() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from argparse import ArgumentParser | |
| from os import unlink, chmod | |
| from os.path import expanduser | |
| from socket import socket, AF_UNIX | |
| from subprocess import run, Popen | |
| from sys import stderr | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S gawk -f | |
| $1~/^##+$/ && $0!~/Table of Contents$/{ | |
| intoc = 0 | |
| if (l > length($1)) for (k in num) if (k > length($1)) delete num[k] | |
| l = length($1) | |
| num[l] += 1 | |
| r = q = substr($0, l + 2) | |
| gsub(" ", "-", q); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S gawk -f | |
| $1~/^##+$/ && $0!~/Table of Contents$/{ | |
| if (l > length($1)) for (k in num) if (k > length($1)) delete num[k] | |
| l = length($1) | |
| num[l] += 1 | |
| r = substr($0, l + 2) | |
| p = ""; for (i in num) p = p num[i] "." | |
| if (length(num) > 1) p = substr(p, 0, length(p) - 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S gawk -f | |
| $1~/^##+$/{ | |
| l = length($1); | |
| r = q = substr($0, l + 2); | |
| gsub(" ", "-", q); | |
| printf "%" ((l - 2) * 4 + 2) "s[%s](#%s)\n", "* ", r, q | |
| } |
NewerOlder