Skip to content

Instantly share code, notes, and snippets.

import gzip
import json
import sys
with gzip.GzipFile(sys.args[1], mode='r') as fh:
line = fh.readline()
if not line:
break
data = json.loads(line)
@indygreg
indygreg / builbot-slave-efficiency.py
Last active December 21, 2015 20:09
Obtain efficiency of buildbot slaves.
# The mozautomation package can be found at https://hg.mozilla.org/users/gszorc_mozilla.com/hgext-gecko-dev/
# Usage: python this_script.py 2013-08-25 4
import datetime
import sys
import time
from mozautomation.buildbotdata import BuildbotDump
start, count = sys.argv[1:]
@indygreg
indygreg / monthly.tsv
Created May 6, 2013 18:33
Mozilla Automation Load
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 3 columns, instead of 1. in line 1.
Month Jobs Total Seconds
2009-10 86282 145708647
2009-11 73745 104793047
2009-12 106958 140034276
2010-01 129051 139464570
2010-02 127558 127330968
2010-03 154582 240207284
2010-04 129628 165059589
2010-05 153820 234477436
2010-06 233934 366909207
@indygreg
indygreg / hgrc
Last active December 16, 2015 23:09
Mercurial config
[extensions]
color =
graphlog =
histedit =
mq =
pager =
progress =
purge =
rebase =
transplant =
@indygreg
indygreg / requirements.txt
Last active December 16, 2015 20:10
Gecko session recording
For the *current* session, FHR needs the following:
c1) The UTC day the session started
c2) The current total length of the session in seconds
c3) {main, firstPaint, sessionRestored} times (from nsIAppStartup or equivalent)
c4) User activity for this session. Currently this is recorded as a count of the number of user-interaction-active observers that were fired.
For *previous* sessions, FHR needs:
p1) All of the above
@indygreg
indygreg / test.js
Last active December 14, 2015 10:39
JavaScript testing framework
/**
* This is a proof of concept for a JS testing API.
*
* The eventual goal is to unify and replace the testing API across all of Firefox's
* testing frameworks (xpcshell, mochitest, etc).
*
* How it Works
* ===========
* Tests are declared in JavaScript files which are loaded by a test harness dependent
* mechanism. Traditionally, the set of files is declared in a manifest somewhere and
@indygreg
indygreg / print_random_ints.py
Created November 25, 2012 00:27
Logging Benchmarks
#!/usr/bin/python
# Print N integers have M digits.
#
# Usage: print_random_ints.py digit-count count
import random
import sys
digit_count = int(sys.argv[1])
@indygreg
indygreg / gist:3085797
Created July 10, 2012 19:51
mozilla-warnings
accessible/src/base/nsAccessiblePivot.cpp:81:1330 [-Wdelete-non-virtual-dtor] delete called on 'nsAccessiblePivot' that has virtual functions but non-virtual destructor
accessible/src/base/nsCoreUtils.cpp:206:24 [-Wtautological-compare] comparison of unsigned expression >= 0 is always true
accessible/src/generic/ARIAGridAccessible.cpp:268:12 [-Wunused-variable] unused variable 'rowCount'
accessible/src/generic/HyperTextAccessible.cpp:1812:8 [-Wunused-variable] unused variable 'isOnlyCaret'
accessible/src/html/HTMLTableAccessible.cpp:769:12 [-Wunused-variable] unused variable 'rv'
accessible/src/html/HTMLTableAccessible.cpp:789:12 [-Wunused-variable] unused variable 'rv'
accessible/src/mac/mozAccessible.mm:314:295 [-Wformat-extra-args] data argument not used by format string
accessible/src/mac/mozAccessible.mm:634:324 [-Wformat-extra-args] data argument not used by format string
accessible/src/mac/mozAccessible.mm:653:296 [-Wformat-extra-args] data argument not used by format string
accessible/src/mac/mozAcces
@indygreg
indygreg / strptime_bench.py
Created March 15, 2012 00:15
strptime is slow
#!env python
from time import clock
from time import strptime
value = '2012-02-28 12:23:35Z'
fmt = '%Y-%m-%d %H:%M:%SZ'
total = 300000
start_time = clock()
@indygreg
indygreg / patch to browserid wiki
Created December 21, 2011 01:32
BrowserID Wiki Update
From ccb1c937714766e545753060946d872b57a1f2c7 Mon Sep 17 00:00:00 2001
From: Gregory Szorc <gps@mozilla.com>
Date: Tue, 20 Dec 2011 17:30:23 -0800
Subject: [PATCH] add link to lower-level details
---
How-BrowserID-Works.md | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/How-BrowserID-Works.md b/How-BrowserID-Works.md