Skip to content

Instantly share code, notes, and snippets.

@jrgm
jrgm / gist:3063839
Created July 7, 2012 02:04
fix static_resources test
diff --git a/tests/static-resource-test.js b/tests/static-resource-test.js
index 66a83a9..76307a4 100755
--- a/tests/static-resource-test.js
+++ b/tests/static-resource-test.js
@@ -23,7 +23,15 @@ suite.addBatch({
var res = resources.resources;
assert.ok(files['/production/dialog.css'].length >= 3);
// Get ride of non-localized asset bundles
- ['/production/communication_iframe.js', '/production/include.js', '/production/dialog.css', '/production/browserid.css', '/production/ie8_main.css', '/production/ie8_dialog.css', '/production/relay.js', '/production/html5shim.js'].forEach(
+ ['/production/communication_iframe.js',
@jrgm
jrgm / log-smtp-direct-rtt.py
Created July 23, 2012 07:57
log-smtp-direct-rtt.py
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# check direct delivery email via localhost:25 to http://restmail.net
import base64
import hashlib
@jrgm
jrgm / log-smtp-rtt.py
Created July 23, 2012 08:03
log-smtp-rtt.py
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# check delivery of stage_user email to http://restmail.net
import base64
import hashlib
@jrgm
jrgm / check-persona-url.py
Created August 22, 2012 05:48
enumerate possible urls
#!/usr/bin/env python
import json
import os
import requests
# https://bugzilla.mozilla.org/show_bug.cgi?id=781838
# - POSTs MUST never redirect
# - POST over non-SSL MUST fail 400 Bad Non-SSL
# - GETs to the old domains MUST redirect to the new domain
# - www. MUST always redirect
@jrgm
jrgm / awsnap.js
Created November 13, 2012 23:41
If you visit login.dev.persona.org first, there is no Aw, snap!
#!/usr/bin/env node
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//
// Two switches to control how this runs:
// 1) VISIT_PERSONA=1 - Load the login.dev.anosrep.org first
@jrgm
jrgm / gist:4490638
Last active December 10, 2015 20:48
enable NSPR HTTP logging for b2g phones...
#!/bin/sh
# You may of course prefer not to trust this script and do the below
# manually, step by step, with an editor, etc., ;-).
#
# make /system/bin writable
#
DISK_DEVICE=`adb shell mount | grep '/system' | awk '{ print $1 }'`
adb shell "mount -o remount,rw $DISK_DEVICE /system"
@jrgm
jrgm / gist:4490664
Last active December 10, 2015 20:48
Stupid hack to track response times with b2g requests when NSPR_LOG_MODULES is enabled in this way.
use strict;
$| = 1;
# Stupid hack to track response times with b2g requests.
# You need to set 'export NSPR_LOG_MODULES=timestamp,cookie:5,nsSocketTransport:5,nsHttp:5'
# in /system/bin/b2g.sh. See https://gist.github.com/4490638 (but probably will
# want to remove the busybox section, installed from /home/jrgm ;-) ).
#
# usage: `adb logcat | tee /tmp/raw.txt | perl thisfile.pl`
@jrgm
jrgm / parse-ss.js
Last active December 11, 2015 22:39
Count the tcp socket states from `ss(8)`
// Count the tcp socket states from `ss(8)`
// usage: `while [ 1 ]; do ss -tanp | node ~/parse-ss-localports.js; sleep 5; done`
var _ = require('underscore');
var FIELDS = { STATE: 0, RECVQ: 1, SENDQ: 2, LOCAL: 3, REMOTE: 4 };
function uniqueEphemeral(list) {
return _.uniq(list).filter(isEphemeral).length;
}
@jrgm
jrgm / grab-a-socket.js
Last active December 11, 2015 22:39
Exercise the local ephemeral port range and see if it's exhausted
// Exercise the local ephemeral port range and see if it's exhausted
// usage: `while [ 1 ]; do node ~/grab-a-socket.js; sleep 1; done`
var net = require('net');
var options = {
port: 63300,
host: '127.0.0.1'
};
@jrgm
jrgm / sc.js
Created January 31, 2013 06:57
Measure time and responses
// Measure time and responses
// usage: while [ 1 ]; do node sc.js; sleep 5; done
// or: while [ 1 ]; do SC_HEARTBEAT=1 node sc.js; sleep 5; done
var http = require('http');
var path, heartbeat;
if (process.env.SC_HEARTBEAT) {
heartbeat = true;
path = '/__heartbeat__';