Skip to content

Instantly share code, notes, and snippets.

View rfk's full-sized avatar

Ryan Kelly rfk

View GitHub Profile
#
# This is a little script to populate Firefox Sync with
# fake password records. Use it like so:
#
# $> pip install PyFxA syncclient cryptography
# $> python ./upload_fake_passwords.py 20
#
# It will prompt for your Firefox Account email address and
# password, generate and upload 20 fake password records, then
# sync down and print all password records stored in sync.
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;

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 sys
import base64
import getpass
import hashlib
import urllib2
import optparse
import requests
@rfk
rfk / gist:afeff888c3a95732d800
Created January 12, 2015 23:52
script to delete user data on a sync1.1 storage node
import sys
import base64
import getpass
import hashlib
import urllib2
import optparse
import requests
/*
* 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
@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
@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.
import time
import os
import cPickle as pickle
import cjson
import ujson
import tnetstring
cjson.dumps = cjson.encode
cjson.loads = cjson.decode