Skip to content

Instantly share code, notes, and snippets.

<html>
<style type="text/css">
#timeline ol {
list-style: none;
}
.sender {
float: left;
width: 200px;
<html>
<style type="text/css">
#timeline {
list-style: none;
}
.sender {
float: left;
width: 200px;
@ara4n
ara4n / gist:079e2296774158504a897c863b445094
Created September 9, 2018 22:31
CBOR and MessagePack initial sync profiling
random interesting factoid:
lazyloading reduces most of my accounts initial sync by about 4-5x
i was wondering about ways to shrink further (short of paginated sync)
and so tried expressing it as CBOR
doing something like:
perl -MJSON::XS -MCBOR::XS -MFile::Slurp -e '$z=read_file(\*STDIN); print encode_cbor(decode_json($z));'
turns out for @matthew2's initial sync, this reduces 4.5MB of JSON to 3.7MB of CBOR.
@ara4n
ara4n / gist:71df14d9112ac8c94613ae56bedc3e07
Created September 9, 2018 22:26
Shifting subtitle timings
# Moving subtitles 4 seconds into the future:
cat subs.txt | perl -ne 'sub fix { $t=$_[0]*60*1000 + $_[1]*1000 + $_[2]; $t+=4000; return sprintf("%02d:%02d.%03d", int($t/(60*1000)), int($t/1000) % 60, $t % 1000); } if (/^0:(..):(..).(...),0:(..):(..).(...)$/) { $a=fix($1,$2,$3); $b=fix($4,$5,$6); print "0:$a,0:$b\n" } else { print $_ }' > subs2.txt
@ara4n
ara4n / gist:527e57d50bc96f02c5ac35752c848b8e
Last active September 9, 2018 22:30
Matthew & Amandine olm keys
@matthew:matrix.org
Riot/Web (Chrome, new MBP)
Device ID: QEOYHMYOKQ
Device key: fHP8 sbsK KgNy dwgS Smtr ipQA Y21+ 8eC9 UIXB 0ut/ BOk
Riot/iOS (iPhone 7+)
Device ID: KONWLQRIIC
Device key: 4/A4 1wrI xZX3 GSiY pME1 aZqP 7iGs ifi9 79UC oNyL JO8
@ara4n
ara4n / display_hints.py
Last active February 18, 2018 00:05
How i'd parse display_hints
#!/usr/bin/env python
# see https://docs.google.com/document/d/1m4VTRqclB3JEMZBjbr4t5cvIMQUNSGxy6rYN4YtopIk/edit#heading=h.92ptkhvsmxtd
def recognised(type):
# a smart client who understands indexed types will strip off any indexing:
# import re
# type = re.sub(r'\.\d+$', '', type)
# a typical smart client:
@ara4n
ara4n / matrixCal.md
Last active February 7, 2018 23:27
matrixCal: a saner(?) mapping of iCal into JSON than jCal:

matrixCal: a saner(?) mapping of iCal into JSON than jCal

BEGIN:VCALENDAR
PRODID:-//Apple Inc.//Mac OS X 10.11.6//EN
VERSION:2.0
METHOD:REQUEST
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/London
@ara4n
ara4n / AVCaptureDepthDataOutput.patch
Created January 25, 2018 20:42
wip experimentation with AVCaptureDepthData in webrtc
diff --git a/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.h b/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.h
index 8b73a8086..6b23e8a81 100644
--- a/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.h
+++ b/sdk/objc/Framework/Classes/Video/RTCAVFoundationVideoCapturerInternal.h
@@ -24,6 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface RTCAVFoundationVideoCapturerInternal
: NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
+@interface RTCAVFoundationVideoCapturerInternal
+ : NSObject <AVCaptureDepthDataOutputDelegate>
@ara4n
ara4n / matrix ansibles.md
Last active January 17, 2018 16:05
Quick review of synapse ansible playbooks on github as of Jan 17 2018

https://github.com/7adietri/ansible-synapse - installs a virtualenv'd synapse from source into /opt/synapse, and maintains a templated config file with a bunch of variables. Last updated Jan 9 2018

https://github.com/atb00ker/ansible-matrix-synapse - installs debian packaged synapse, with nginx + letsencrypt (certbot) Last updated Jan 15 2018

https://github.com/Sifungurux/ansible-matrix-synapse - installs debian packaged synapse with minimal configuration options Last updated Dec 20 2017

https://github.com/binRick/ansible-deploy-synapse - not a playbook; installs via pip into a venv; lots of other stuff too

@ara4n
ara4n / nheko-mobile.md
Last active September 28, 2017 15:58
Making a Librem5 Prototype out of an Ubuntu Phone

Making a Librem5 Prototype out of an Ubuntu Phone using Nheko

Starting point: one old BQ Aquaris E5 ubuntu phone, running some old version of Ubuntu Touch which had got completely stuck (UI only unfreezing for 2-3 seconds every 2-3 minutes).

Step one: flash to latest UBPorts image: