Skip to content

Instantly share code, notes, and snippets.

View rfk's full-sized avatar

Ryan Kelly rfk

View GitHub Profile
import sys
import base64
import getpass
import hashlib
import urllib2
import optparse
import requests

Keybase proof

I hereby claim:

  • I am rfk on github.
  • I am rfkelly (https://keybase.io/rfkelly) on keybase.
  • I have a public key whose fingerprint is E071 C568 AFF3 039C 47A1 EDC7 21CC 6BCE C81C 03C9

To claim this, I am signing this object:

import time
import os
import cPickle as pickle
import cjson
import ujson
import tnetstring
cjson.dumps = cjson.encode
cjson.loads = cjson.decode
@rfk
rfk / example.py
Created October 27, 2011 01:10
strawman sauropod client API
# Each application has some credentials identifing it
# as an authorized application. They are the same for
# all requests.
store = Sauropod("https://sauropod.mozilla.com",
"MY APPLICATION ID",
"MY APPLICATION PRIVATE KEY")
# You always interact with the store as a particular user.
# Provide credentials to start a session.
# They might be a BrowserID, a "super-credential", whatever.
@rfk
rfk / gist:7889642
Created December 10, 2013 12:09
testcase for inefficient code generation in emscripten
/*
* A silly little test program involving switches, loops, and gotos.
* It's designed to emulate the kind of spaghetti-goto code produced by
* PyPy for its bytecode interpretation loop.
*
* This program takes a string as command-line argument, counts the number
* of zeros in the string, checks for the presence of the digits 1 through 4,
* and prints its findings to stdout. Example:
*
* $> js test_degenerate_switch.js 00203
/*
* A silly little test program involving switches, loops, and gotos.
* It's designed to emulate the kind of spaghetti-goto code produced by
* PyPy for its bytecode interpretation loop.
*
* This program takes a string as command-line argument, counts the number
* of zeros in the string, checks for the presence of the digits 1 through 4,
* and prints its findings to stdout. Example:
*
* $> js test_degenerate_switch.js 00203
MariaDB [weave0]> EXPLAIN SELECT * FROM bso0 WHERE ttl < (UNIX_TIMESTAMP() - 1000) ORDER BY ttl LIMIT 10000;
+------+-------------+-------+-------+---------------+-------------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+-------------+---------+------+------+-------------+
| 1 | SIMPLE | bso0 | range | bso_ttl_idx | bso_ttl_idx | 4 | NULL | 5 | Using where |
+------+-------------+-------+-------+---------------+-------------+---------+------+------+-------------+
1 row in set (0.00 sec)
MariaDB [weave0]>
MariaDB [weave0]> EXPLAIN SELECT * FROM batch_upload_items0 WHERE batch < (UNIX_TIMESTAMP() - 1000) * 1000 ORDER BY batch LIMIT 100000;
@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
import os
import time
import argparse
import multiprocessing
import psutil
import pymysql
parser = argparse.ArgumentParser()
<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() {