Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import requests
import pandas as pd
import matplotlib.pyplot as plt
# Replace these with your own repository details and personal access token
GITHUB_TOKEN = 'hunter42'
REPO_OWNER = 'matrix-org'
REPO_NAME = 'matrix-doc'
ara4n /
Created December 21, 2022 02:13
Compiling rust libraries under Catalyst (macabi) on Ventura (macOS 13.1)

Fixing rust to support compiling libraries for use with Catalyst (Dec 2022)

The problem is that rustc emits synthetic libraries (symbols.o and lib.rmeta) which Apple's ld then chokes on when targetting aarch64-apple-ios-macabi, as they lack an LC_BUILD_VERSION load command to identify them as being intended for use with Catalyst.

The errors produced look like:

ld: in /Users/matthew/workspace/matrix-rust-sdk/target/aarch64-apple-ios-macabi/dbg/deps/libstatic_assertions-fdafb4b8ba800a8a.rlib(lib.rmeta), building for Mac Catalyst, but linking in object file built for , file '/Users/matthew/workspace/matrix-rust-sdk/target/aarch64-apple-ios-macabi/dbg/deps/libstatic_assertions-fdafb4b8ba800a8a.rlib' for architecture arm64

ara4n / megolm-test.js
Created October 20, 2021 02:20
megolm test jig
import olm from "olm";
import sdk from "matrix-js-sdk";
import { MatrixEvent } from "matrix-js-sdk";
import { LocalStorage } from "node-localstorage";
global.Olm = olm;
const myUserId = "";
const myAccessToken = "secret";
const matrixClient = sdk.createClient({
ara4n / todevice-test.js
Created October 20, 2021 01:22
Test jig for sending encrypted to-device messages
import olm from "olm";
import sdk from "matrix-js-sdk";
import { LocalStorage } from "node-localstorage";
global.Olm = olm;
const myUserId = "";
const myAccessToken = "secret";
const matrixClient = sdk.createClient({
baseUrl: "",
ara4n / gist:a3e0bfbf9be086bb57b22202a4d01851
Created March 18, 2020 22:44
Print all timestamps of messages in a room
while true
do curl -s '!'$t'&limit=20&dir=b&filter=%7B%22lazy_load_members%22%3Atrue%7D' -H "authorization: Bearer $at" > msg.json >> msgs.json
cat msg.json | jq '.chunk[].origin_server_ts'
t=`cat msg.json | jq -r '.end'`
sleep 0.5
dendrite-sw.js: v0.0.2 SW init
19:34:08.387 dendrite-sw.js?6ec0:45 dendrite-sw.js: v0.0.2 starting dendrite.wasm...
19:34:11.092 wasm_exec.js?3f15:44 dendrite.js starting...
19:34:11.092 p2pLocalNode.js?8092:42 p2plocalnode called with org.matrix.p2p.experiment and /dns4/ with seed
19:34:11.092 p2pLocalNode.js?8092:49 init existing ed25519 key from seed...
19:34:11.093 dendrite-sw.js?6ec0:51 dendrite-sw.js: v0.0.2 claiming open browser tabs
19:34:11.116 p2pLocalNode.js?8092:52 Public key bytes: Ed25519PublicKey
19:34:11.117 p2pLocalNode.js?8092:61 added PeerInfo
19:34:11.117 p2pLocalNode.js?8092:62 id: {"id":"12D3KooWR7weBT7ecN5tQMyAESw7tWpcENq7gW7rMeCZaVg646Vj","privKey":"CAESYIw1dXRfV9XomJMZDCso+BgK2QMK0PhpFPaIhCI1x3eW42AGlvThjJ3T/7cAw0WApfI8WDPbqEhL6Ubff8N7rt7jYAaW9OGMndP/twDDRYCl8jxYM9uoSEvpRt9/w3uu3g==","pubKey":"CAESIONgBpb04Yyd0/+3AMNFgKXyPFgz26hIS+lG33/De67e"}
19:34:11.124 p2pLocalNode.js?8092:122 p2p starting now
ara4n / matrix-appservice-irc
Created March 5, 2020 16:24
bucephalus:tmp matthew$ git clone git+ssh://
Cloning into 'matrix-appservice-irc'...
remote: Enumerating objects: 197, done.
remote: Counting objects: 100% (197/197), done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 16877 (delta 100), reused 118 (delta 50), pack-reused 16680
Receiving objects: 100% (16877/16877), 3.85 MiB | 5.95 MiB/s, done.
Resolving deltas: 100% (12119/12119), done.
bucephalus:tmp matthew$ cd matrix-appservice-irc/
bucephalus:matrix-appservice-irc matthew$ yarn install
ara4n /
Last active August 30, 2019 15:03
Mini proposal for fixing aliases (MSC2260bis)

Mini proposal for fixing aliases

Problem tries to be a list of possible aliases for a given room; useful for discovering alternative routes into a room (for those already in the room), and for educating users about how Matrix works by illustrating multiple aliases per room. It also helps give a perception of the size of the network (look how many people found it useful to set an alias for this room!).

ara4n /
Last active August 1, 2019 10:39
MSC2134 notes

We consider three attackers:

  1. A malicious third party trying to discover the identity server mappings in the homeserver.

The malicious third party scenario can only be protected against by rate limiting lookups, given otherwise it looks identical to legitimate traffic.

  1. An attacker who has stolen an IS db

In theory the 3PIDs could be stored hashed with a static salt to protect a stolen DB. This has been descoped from this MSC, and is largely an orthogonal problem. XXX: is this the right thing to have done?

  1. A compromised or malicious identity server, who may be trying to determine the contents of a user's addressbook (including non-Matrix users)
ara4n /
Last active July 16, 2021 09:49
Everything you need to know about Perl5

I once wrote one of these before for @NegativeMjark but I think I lost it. So here's another.

All you need to know is:

  • $foo is a scalar (i.e. a single dimensional variable)
  • @foo is an array. $foo[n] is the element of an array.
  • %foo is a hash. $foo{'moo'} aka $foo{moo} is the value in the hash for key 'foo'.
  • \ is the reference operator. it returns a scalar which points to the address of the variable (like & in C).
  • (1, 2, 3) is a list. (an array is a variable which contains a list).
  • [1, 2, 3] (rarely: \(1,2,3)) is a reference to a list - aka arrayref
  • $foo->[n] gives an element of an arrayref