Skip to content

Instantly share code, notes, and snippets.

@diracdeltas
diracdeltas / covid.md
Last active Oct 1, 2020
COVID-19 in SF calculations
View covid.md

WARNING: THIS IS NOT REAL SCIENCE

I am NOT a subject matter expert. The calculations below rely on some oversimplifying assumptions which are probably wrong. This is NOT intended to be public health advice.

Bayes Theorem

P(B|A) = P(A|B) * P(B) / P(A)

Probability of being COVID-negative when you test positive for COVID in SF

@diracdeltas
diracdeltas / hotcues-to-memory-cues.py
Last active Sep 8, 2020
copy all your rekordbox hotcues to memory cues
View hotcues-to-memory-cues.py
# usage: python3 hotcues-to-memory-cues.py $XML_FILENAME
# see https://djfile.com/how-import-beatgrids-cue-points-and-tags-using-rekordbox-xml for XML export/import instructions
import xml.etree.ElementTree as ET
import sys
print('converting ' + sys.argv[1])
tree = ET.parse(sys.argv[1])
root = tree.getroot()
View gist:41d117566206e298f092c0c69fcc9045
3e44720d807c0c959a44a6a12904aed972d3d4212139542e638836346458c782
952a050dc39d64e3f751b7988419898d5c8a5baa047e912c5bee59929b29a6dc
@diracdeltas
diracdeltas / verification-spec.md
Last active Jun 14, 2017
protocol for domain ownership verification in Brave Payments
View verification-spec.md

Intro

The Brave browser now includes a way for users to allocate ~monthly anonymized micropayments for online publishers. These payments are held in an escrow wallet managed by Brave Inc., which must then provide a way for publishers to claim their total allocated funds (minus processing fees).

Note that for 1.0, we only support allocating payments at the domain-name level. Hence, nytimes.tumblr.com and forbes.tumblr.com would count as separately payable publishers, but any funds calculated based on pageviews for myspace.com/forbes and myspace.com/nytimes would simply go to myspace.com. Note that currently Brave includes an exception list that prevents us from paying platforms with user-generated content, like youtube.com.

Verification steps

  1. foo.example.com is eligible to claim payments if its total contributed amount is at least $10. Once this happens, Brave sends verification initiation emails from `paym
@diracdeltas
diracdeltas / jquery.min.js
Created Aug 23, 2015
a sketchy fork of jquery 1.11.3
View jquery.min.js
/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},sl
@diracdeltas
diracdeltas / test-httpse.sh
Created Jun 27, 2014
sample test script for https everywhere
View test-httpse.sh
#!/bin/bash
set -e
# should be the root of the HTTPS E git repo
cd "`dirname $0`"
# path to a dummy Jetpack addon that contains HTTPS-E tests
TEST_ADDON_PATH=../privacybadgerfirefox/
@diracdeltas
diracdeltas / https-everywhere-heartbleed.txt
Created Apr 8, 2014
How to check that your HTTPS Everywhere signing keys are correct
View https-everywhere-heartbleed.txt
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
To check that you have a "good" copy of HTTPS Everywhere (one with the
correct update signing keys), you can do the following:
# Firefox:
1. Go to your Firefox profile directory:
https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data#w_how-do-i-find-my-profile.
View keybase.md

Keybase proof

I hereby claim:

  • I am diracdeltas on github.
  • I am bcrypt (https://keybase.io/bcrypt) on keybase.
  • I have a public key whose fingerprint is BDE7 D508 3BB3 5EDC 7A66 BD97 388C E229 FAC7 8CF7

To claim this, I am signing this object:

@diracdeltas
diracdeltas / update
Created Nov 4, 2013
A server-side Git update hook for HTTPS Everywhere that forces ruleset validation before accepting commits.
View update
#!/bin/sh
#
# Hook script to validate rules and check locales before accepting
# pushed changes on the server side.
# See http://stackoverflow.com/questions/4541417/how-can-i-make-it-so-git-rejects-pushing-code-that-wont-compile
#
# By default, this should run in the root of the git repository.
# --- Command line
refname="$1"
View httpse_deterministic_check.sh
#!/bin/sh
PWD=`pwd`
git clone https://github.com/diracdeltas/https-everywhere.git ./tmp/https-everywhere
cd ./tmp/https-everywhere
git checkout deterministic
git log --abbrev-commit -n 1
# TODO: replace the following with Python that does unicode normalization
find ./src/ -type f -print0 | LC_ALL=C sort -z | xargs -0 cat | shasum
./makexpi.sh
shasum pkg/https-everywhere-4.0development.11~pre.xpi