Skip to content

Instantly share code, notes, and snippets.

View DMRobertson's full-sized avatar

David Robertson DMRobertson

View GitHub Profile
\echo nuke table\\
DROP TABLE IF EXISTS e2e_one_time_keys_json;
\echo Make table\\
CREATE TABLE e2e_one_time_keys_json (
user_id text NOT NULL,
device_id text NOT NULL,
algorithm text NOT NULL,
key_id text NOT NULL,
ts_added_ms bigint NOT NULL,
@DMRobertson
DMRobertson / dmr_test.go
Created January 25, 2023 12:20
Complement test for join-leave-join sync response
package csapi_tests
import (
"github.com/matrix-org/complement/internal/b"
"github.com/matrix-org/complement/internal/client"
"testing"
)
func TestRejoinBehaviour(t *testing.T) {
deployment := Deploy(t, b.BlueprintFederationOneToOneRoom)
2022-09-01T11:49:14.2849952Z Requested labels: ubuntu-latest
2022-09-01T11:49:14.2850001Z Job defined at: matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@refs/tags/v1
2022-09-01T11:49:14.2850026Z Waiting for a runner to pick up this job...
2022-09-01T11:51:36.0897292Z Job is waiting for a hosted runner to come online.
2022-09-01T11:51:42.1548707Z Job is about to start running on the hosted runner: GitHub Actions 32 (hosted)
2022-09-01T11:51:45.8973087Z Current runner version: '2.296.0'
2022-09-01T11:51:45.9004998Z ##[group]Operating System
2022-09-01T11:51:45.9005612Z Ubuntu
2022-09-01T11:51:45.9006242Z 20.04.4
2022-09-01T11:51:45.9006643Z LTS
2022-08-31T12:10:34.5346008Z Requested labels: ubuntu-latest
2022-08-31T12:10:34.5346053Z Job defined at: matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@refs/tags/v1
2022-08-31T12:10:34.5346101Z Waiting for a runner to pick up this job...
2022-08-31T12:10:36.7247093Z Job is waiting for a hosted runner to come online.
2022-08-31T12:10:39.8616101Z Job is about to start running on the hosted runner: GitHub Actions 18 (hosted)
2022-08-31T12:10:43.5238682Z Current runner version: '2.296.0'
2022-08-31T12:10:43.5276721Z ##[group]Operating System
2022-08-31T12:10:43.5277671Z Ubuntu
2022-08-31T12:10:43.5277978Z 20.04.4
2022-08-31T12:10:43.5278309Z LTS
@DMRobertson
DMRobertson / compare-builds.sh
Last active April 4, 2022 17:30
Compare synapse wheels and sdists, before an after poetry
#! /usr/bin/env bash
# This script compares the wheels and sdists for Synapse built using poetry and using existing tooling.
# See https://github.com/matrix-org/synapse/pull/12337 and https://github.com/matrix-org/synapse/issues/11537.
set -xeuo pipefail
git switch dmr/pyproject-poetry
POETRY_BRANCH_VERSION=$(poetry version -s)
python -m build --outdir dist-poetry
$ ./install-deps.pl
Starting with version 2.29 of the cpan shell, a new download mechanism
is the default which exclusively uses cpan.org as the host to download
from. The configuration variable pushy_https can be used to (de)select
the new mechanism. Please read more about it and make your choice
between the old and the new mechanism by running
o conf init pushy_https
@DMRobertson
DMRobertson / parse.py
Created December 17, 2021 18:30
dirty script to ingest synapse request logs into sqlite
#! /usr/bin/env python3
import argparse
import re
import sqlite3
import sys
# Sorry everyone.
# Use nongreedy matches to make this well fast.
@DMRobertson
DMRobertson / dirty.py
Last active November 15, 2021 17:18
Dirty store inheritance script
import sys
import re
import subprocess
import networkx
from networkx import is_directed_acyclic_graph, descendants
oneline_class_pattern = re.compile("^class (.*)\((.*)\):$")
opening_class_pattern = re.compile("^class (.*)\($")
@DMRobertson
DMRobertson / example.py
Created October 28, 2021 13:58
Requiring multiple zope Interfaces
#! /usr/bin/env python3
from zope.interface import Interface, implementer
class IA(Interface):
def do_a() -> None:
...
class IB(Interface):
@DMRobertson
DMRobertson / any-exprs.txt
Created October 27, 2021 11:54
Synapse `Any` reports
Name Anys Exprs Coverage
---------------------------------------------------------------------------------
__main__ 18 46 60.87%
synapse.api.auth 132 772 82.90%
synapse.api.auth_blocking 20 167 88.02%
synapse.api.constants 0 214 100.00%
synapse.api.errors 19 582 96.74%
synapse.api.filtering 35 660 94.70%
synapse.api.presence 1 62 98.39%
synapse.api.ratelimiting 4 319 98.75%