Skip to content

Instantly share code, notes, and snippets.

View rfk's full-sized avatar

Ryan Kelly rfk

View GitHub Profile
use anyhow::{Context, Result};
use cobalt_aws::s3;
use futures::io::AsyncReadExt;
use tokio::runtime::Runtime;
fn main() -> Result<()> {
// This "block_on" magic lets you execute an "async" function without having
// to worry about making all of the surrounding code also be an "async" function.
let config = Runtime::new()?.block_on(
// Have one error class that exposed by UniFFI, defined in your `.udl` file
// and with a correspondong struct definition in `lib.rs`. It's flat, because
// UniFFI doesn't pass nice nested structure in errors (yet).
//
// Instances of this error will only ever appear on the boundary of your API,
// where they get handed off to the foreign-language code.
//
pub enum LoginsError {
UnexpectedLoginsStorageError(String),
@rfk
rfk / aet_ping.json
Last active June 22, 2020 04:40
AET test values
{
"type": "account-ecosystem-main",
"payload": {
"ecosystemClientId": "4f6f83cc-4e63-4185-924a-0e89ce4222de",
"ecosystemDeviceId": "1883fd2a-2096-4ade-904b-ed769bf2a9a9",
"ecosystemAnonId": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImVwayI6eyJjcnYiOiJQLTI1NiIsImV4dCI6dHJ1ZSwia3R5IjoiRUMiLCJ4IjoiazByWWVzOVlKb0w1QWdxeVZCVmViNk4xekVlcnItLVQtazVVNHFoOHFTNCIsInkiOiJBaGl3Vy1JdGZ6X0lzdUZFWmhCSHNKNl9XYVdVcHdpUDJobEVMYXN0dTQwIn19..B-GwRcb_5Ii1c3N1.XnFTMM9vFJSLnl3QhQuNC9oLlB-NFteAEJhK1_5xSFM.TV6Gs_tbYek6NJe48eWo3Q",
"previousEcosystemAnonIds": [],
},
}
05-27 18:05:13.144 25309 25410 I sync15::sync_multiple: Syncing history engine!
05-27 18:05:13.144 25309 25410 I sync15::sync: Syncing collection history
05-27 18:05:14.712 25309 25410 I sync15::client: Successful request to "/1.5/137697556/storage/history", incoming x-last-modified=ServerTimestamp(1590566116750)
05-27 18:05:15.068 25309 25410 I sync15::sync: Downloaded 5000 remote changes (request 0 of 1)
05-27 18:05:15.243 25309 25401 D SyncWorker: Starting sync... Tagged as: [Immediate, mozilla.components.service.fxa.sync.WorkManagerSyncWorker, Common]
05-27 18:05:15.243 25309 25401 D sync_manager_ffi: sync_manager_set_places
05-27 18:05:16.563 25309 25410 D places::db::tx::coop_transaction: ChunkedCoopTransaction commiting after taking allocated time
05-27 18:05:17.994 25309 25410 D places::db::tx::coop_transaction: ChunkedCoopTransaction commiting after taking allocated time
05-27 18:05:19.083 25309 25410 D places::db::tx::coop_transaction: ChunkedCoopTransaction commiting after taking allocated time
05-
import sys
from collections import defaultdict
with open(sys.argv[1]) as f:
lines = (ln.strip() for ln in f)
# Skip headers.
assert next(lines).startswith("File")
# Sum up serde-related things vs total.
totalSize = 0
import sys
with open(sys.argv[1]) as f:
lines = (ln.strip() for ln in f)
# Skip headers.
assert next(lines).startswith("Lines")
assert next(lines).startswith("-----")
assert next(lines).endswith("(TOTAL)")
# Sum up serde-related things vs total.
//
// This is a JavaScript implementation of (an approximate subset of)
// the Noise Protocol Framework [1], using the WebCrypto API.
//
// It's not spec-compliant but it aims to be about as close as we
// can possibly get. Key points of divergence:
//
// * Uses P-256 rather than Curve25519 for ECDH, since Curve25519
// is not available in WebCrypto.
//
<html>
<head>
<script src="http://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script type="text/javascript">
// UI code to hook up buttons etc.
$(function() {
import os
import time
import argparse
import multiprocessing
import psutil
import pymysql
parser = argparse.ArgumentParser()
@rfk
rfk / recovery_key_test_vectors.py
Last active July 10, 2018 22:45
Test Code for FxA Account Recovery Keys
#
# To run this script, you'll need to install some dependencies:
#
# $> pip instal hkdf jwcrypto crockford
#
# Then you can run it without arguments, and it will print out
# a series of test vectors for checking compatibility of other
# implementations of Recovery Keys.
#
# $> python ./recovery_key_test_vectors.py