From 8e8a70c71ec44dbf3347cce0c69652dddb47c586 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 1 Sep 2018 11:01:31 +0100 Subject: [PATCH 1/6] Remove obsolete baz* scripts --- bazpath | 22 ---------------------- bazresolved | 8 -------- baztag | 38 -------------------------------------- 3 files changed, 68 deletions(-) delete mode 100755 bazpath delete mode 100755 bazresolved delete mode 100755 baztag diff --git a/bazpath b/bazpath deleted file mode 100755 index 8311b4b..0000000 --- a/bazpath +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh -e -# Work out Bazaar archive names for branches or tags of the current -# directory. - -WANTED="$1" -ME="$(baz tree-version)" - -if [ "$WANTED" ]; then - ARCHIVE="$(baz parse-package-name --arch "$ME")" - CATEGORY="$(baz parse-package-name --category "$ME")" - case $WANTED in - *--*) - echo "$ARCHIVE/$CATEGORY--$WANTED" - ;; - *) - VERSION="$(baz parse-package-name --vsn "$ME")" - echo "$ARCHIVE/$CATEGORY--$WANTED--$VERSION" - ;; - esac -else - echo "$ME" -fi diff --git a/bazresolved b/bazresolved deleted file mode 100755 index 4faed8f..0000000 --- a/bazresolved +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -e -# Same as 'baz resolved', but also cleans up .orig and .rej files. - -baz resolved "$@" - -for file; do - rm -f "$file.orig" "$file.rej" -done diff --git a/baztag b/baztag deleted file mode 100755 index 5ddb42f..0000000 --- a/baztag +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -e - -usage () { - cat <&2 - exit 1 -fi - -while :; do - case $1 in - --help) usage; exit 0 ;; - -n|--no-act) - NOACT=echo - shift - ;; - --) shift; break ;; - *) usage >&2; exit 1 ;; - esac -done - -if [ $# -eq 0 ]; then - VERSION="$(dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)" -else - VERSION="$1" -fi - -$NOACT baz branch "$(bazpath)" "$(bazpath "releases--$VERSION")" -- 2.30.2 From c8b58bf81e6ed3fa646a18c49eef697bbed8914c Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 22 Dec 2018 15:10:48 +0000 Subject: [PATCH 2/6] get-rfc: switch to HTTPS --- get-rfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get-rfc b/get-rfc index 3e41df8..03aaa73 100755 --- a/get-rfc +++ b/get-rfc @@ -2,5 +2,5 @@ # Depends: wget mkdir -p "$HOME/misc/rfc" cd "$HOME/misc/rfc" -[ -f "rfc$1.txt" ] || wget "http://www.ietf.org/rfc/rfc$1.txt" +[ -f "rfc$1.txt" ] || wget "https://www.ietf.org/rfc/rfc$1.txt" ${PAGER:-pager} "rfc$1.txt" -- 2.30.2 From bda8b3fffbd6c60095ea2ab36de639f414c1baa6 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 11 Nov 2020 23:42:33 +0000 Subject: [PATCH 3/6] weekly-covid-average: new script --- weekly-covid-average | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 weekly-covid-average diff --git a/weekly-covid-average b/weekly-covid-average new file mode 100755 index 0000000..bbaf8dd --- /dev/null +++ b/weekly-covid-average @@ -0,0 +1,67 @@ +#! /usr/bin/python3 + +from argparse import ArgumentParser +from email.message import EmailMessage +import io +import json +from smtplib import SMTP +import statistics + +import requests +import toml + + +def fetch_data(): + # Fetch new case counts for Cambridgeshire. + data = requests.get( + "https://api.coronavirus.data.gov.uk/v1/data", + params={ + "filters": "areaType=utla;areaName=Cambridgeshire", + "structure": json.dumps( + ["date", "newCasesBySpecimenDate"], separators=(",", ":") + ), + }, + ).json()["data"] + + # Skip the first three days of the response. This seems to be what the + # website does, presumably because recent dates don't have reliable + # enough numbers yet. + data = data[3:] + + last_week = data[:7] + mean = statistics.mean([new_cases for _, new_cases in last_week]) + return last_week, mean + + +def main(): + parser = ArgumentParser() + parser.add_argument( + "--config", type=toml.load, default={}, + help="Configuration file (TOML format)") + parser.add_argument("--email", action="store_true") + args = parser.parse_args() + + last_week, mean = fetch_data() + formatted = io.StringIO() + print( + "Most recent week's worth of new cases in Cambridgeshire, " + "by specimen date:", + file=formatted) + print(file=formatted) + print(f"Mean: {mean:.1f}", file=formatted) + for date, new_cases in last_week: + print(f"{date}: {new_cases}", file=formatted) + if args.email and "email" in args.config: + new_cases_message = EmailMessage() + new_cases_message["From"] = args.config["email"]["from"] + new_cases_message["To"] = ", ".join(args.config["email"]["to_always"]) + new_cases_message["Subject"] = f"Cambridgeshire case count: {mean:.1f}" + new_cases_message.set_content(formatted.getvalue()) + with SMTP("localhost") as smtp: + smtp.send_message(new_cases_message) + else: + print(formatted.getvalue(), end="") + + +if __name__ == "__main__": + main() -- 2.30.2 From fce32253fe000090e349a92fd0d3218dc5e6b0a0 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 11 Nov 2020 23:45:08 +0000 Subject: [PATCH 4/6] sops-virginizer: remove The name is gross, and I haven't used it for probably over a decade anyway. --- sops-virginizer | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100755 sops-virginizer diff --git a/sops-virginizer b/sops-virginizer deleted file mode 100755 index 6b35fb1..0000000 --- a/sops-virginizer +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Depends: gs - -# This script virginizes (de-fucks) StarOffice postscript, for use in -# mpage and other tools. -# Author: Karsten M. Self -# Date: Tuesday, November 28, 2000 -# Credits: George Smiley (georgesmiley@my-deja.com) for the idea -# License: This work is public domain -# ---------------------------------------- -# Arguments: $1= infile, $2= outfile -# ---------------------------------------- - -if [ X$1 = "X" -o X$2 = "X" ]; then - echo "usage: $( basename $0 ) infile outfile" 1>&2; exit 1 -fi - -export PATH=/usr/bin:/bin -TMPFILE=$( mktemp /tmp/sops1.XXXXXX ) || exit 1 -trap 'rm -f $TMPFILE; exit 1' 1 2 3 13 15 - -ps2ps $1 $TMPFILE && ps2ps -dLanguageLevel=1 $TMPFILE $2 -rm -f $TMPFILE -- 2.30.2 From 219d3a23faa85b55102b032862cd3b29cc49ad64 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 11 Nov 2020 23:47:58 +0000 Subject: [PATCH 5/6] my-debmirror: miscellaneous updates Switch to ftp.uk.debian.org; drop wheezy and jessie; add buster and bullseye; switch from i386 to amd64; verify using /usr/share/keyrings/debian-archive-keyring.gpg. --- my-debmirror | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/my-debmirror b/my-debmirror index 7a3cc28..3e00327 100755 --- a/my-debmirror +++ b/my-debmirror @@ -1,12 +1,13 @@ #! /bin/sh set -e unset http_proxy -DEB_MIRROR=${DEB_MIRROR:-ftp.se.debian.org} +DEB_MIRROR=${DEB_MIRROR:-ftp.uk.debian.org} debmirror /mirror/debian -h "$DEB_MIRROR" --method http \ - --dist=wheezy,jessie,sid,experimental \ + --dist=buster,bullseye,sid,experimental \ --section=main,main/debian-installer \ - --arch=i386 --getcontents \ + --arch=amd64 --getcontents \ --rsync-extra=doc,indices,tools,trace \ --i18n \ + --keyring=/usr/share/keyrings/debian-archive-keyring.gpg \ --exclude='i18n/Translation-' --include='i18n/Translation-en' \ "$@" -- 2.30.2 From e477ec7da6ec8d0aac833ede7451404f4d3c85ae Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 11 Nov 2020 23:49:07 +0000 Subject: [PATCH 6/6] bugzilla-show: use HTTPS; drop warthogs and ubuntu --- bugzilla-show | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/bugzilla-show b/bugzilla-show index bf1d19f..034f365 100755 --- a/bugzilla-show +++ b/bugzilla-show @@ -5,25 +5,19 @@ case $1 in ROOT='http://subversion.tigris.org/issues' ;; openssh) - ROOT='http://bugzilla.mindrot.org' - ;; - warthogs) - ROOT='http://bugzilla.warthogs.hbd.com/bugzilla' - ;; - ubuntu) - ROOT='http://bugzilla.ubuntu.com' + ROOT='https://bugzilla.mindrot.org' ;; gnome) ROOT='http://bugs.gnome.org' ;; mozilla) - ROOT='http://bugzilla.mozilla.org' + ROOT='https://bugzilla.mozilla.org' ;; redhat) ROOT='http://bugzilla.redhat.com/bugzilla' ;; kernel) - ROOT='http://bugzilla.kernel.org' + ROOT='https://bugzilla.kernel.org' ;; freedesktop) ROOT='http://bugs.freedesktop.org' @@ -32,8 +26,6 @@ case $1 in echo "Unknown Bugzilla installation '$1'. Recognized are:" >&2 echo ' subversion' >&2 echo ' openssh' >&2 - echo ' warthogs' >&2 - echo ' ubuntu' >&2 echo ' gnome' >&2 echo ' mozilla' >&2 echo ' redhat' >&2 -- 2.30.2