chiark / gitweb /
bugzilla-show: use HTTPS; drop warthogs and ubuntu master
authorColin Watson <cjwatson@debian.org>
Wed, 11 Nov 2020 23:49:07 +0000 (23:49 +0000)
committerColin Watson <cjwatson@debian.org>
Wed, 11 Nov 2020 23:49:07 +0000 (23:49 +0000)
bazpath [deleted file]
bazresolved [deleted file]
baztag [deleted file]
bugzilla-show
get-rfc
my-debmirror
sops-virginizer [deleted file]
weekly-covid-average [new file with mode: 0755]

diff --git a/bazpath b/bazpath
deleted file mode 100755 (executable)
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 (executable)
index 4faed8f..0000000
+++ /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 (executable)
index 5ddb42f..0000000
--- a/baztag
+++ /dev/null
@@ -1,38 +0,0 @@
-#! /bin/sh -e
-
-usage () {
-       cat <<EOF
-$0 [options] VERSION
-
-Options:
-  -n, --no-act          Don't tag; just print the command that would be run.
-
-EOF
-}
-
-NOACT=
-
-if ! eval set -- "$(getopt -o n -l help,no-act -- "$@")"; then
-       usage >&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")"
index bf1d19f67de2cea4bf22bc3c1110232ce2147e8f..034f365534e85c6fe07822437bd6347d4e34d6a5 100755 (executable)
@@ -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
diff --git a/get-rfc b/get-rfc
index 3e41df8c1b8ae1d5b9d9a5dffd6e6642655e81d3..03aaa738bbd93fd1842d3de06d55f860d73ae7c2 100755 (executable)
--- 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"
index 7a3cc28e2798f890fcad514ce9f4c2c6d3b8fbe0..3e00327027a239fd190b5eaf194a9d914c48d255 100755 (executable)
@@ -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' \
          "$@"
diff --git a/sops-virginizer b/sops-virginizer
deleted file mode 100755 (executable)
index 6b35fb1..0000000
+++ /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
diff --git a/weekly-covid-average b/weekly-covid-average
new file mode 100755 (executable)
index 0000000..bbaf8dd
--- /dev/null
@@ -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()