Skip to content

Instantly share code, notes, and snippets.

@jedp
jedp / gist:5506266
Created May 2, 2013 23:36
New strings for b2g persona sign-in flow
client.pot:
"Add an email address"
"Create a Password"
"Enter password"
"Error"
"signing in"
"Sign in with Persona"
@jedp
jedp / b2g-test.html
Last active December 15, 2015 06:09
Test RP for b2g/picl
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="pragma" content="no-cache">
<title>B2G Persona test</title>
<link rel="stylesheet" type="text/css" href="style/style.css">
</head>
@jedp
jedp / server.js
Last active December 15, 2015 06:09
static file server
/**
* Static file server
* Drop files in ./public
*/
var
Hapi = require('hapi'),
server = Hapi.createServer('localhost', process.env['STATIC_SERVER_PORT'] || 9000);
server.route({
#
#!optional
#!rest
#(
#\
#\altmode
#\backnext
#\backspace
#\call
#\linefeed
@jedp
jedp / gist:4741148
Created February 8, 2013 18:59
Check processes with OOM score on b2g
watch -n.5 adb shell b2g-ps --oom
@jedp
jedp / gist:4611182
Created January 23, 2013 18:14
François' throttle script
#!/bin/sh
tc qdisc del dev eth0 root 2> /dev/null
if [ "z$1" = "zdialup" ] ; then
echo "Brace yourself, enabling dialup preset..."
BANDWIDTH=56kbit
LATENCY=200msec
elif [ "z$1" = "z2g" ] ; then
echo "Enabling 2G preset..."
@jedp
jedp / gist:4552786
Last active December 11, 2015 05:29
Jed's (was) another Perl Hacker

Thanks to the Way Back Machine, I found the perl sigs that I wrote while avoiding doing work on my Latin PhD in the years 2000 and 2001 AD.

I have no idea if these still work with anything other than Perl 4 or whatever it was at the time. I also have no idea how to write perl anymore. But I was addicted to playing games with it at the time. You could write beautiful numerical and lexical puzzles and poems with that crazy language. It was so much fun to explore with. And the Perl Journal was awesome.

1

':2F5D)W,@86YO=&AE<B!P97)L(&AA8VME<@H'=~/.*/&& print unpack ("u",$&);
@jedp
jedp / gist:4532412
Created January 14, 2013 19:04
pretty-print a browserid assertion
import base64
import json
from datetime import datetime
def decodeB64(b64input):
"""
Add padding to b64input if necessary. I think python's base64
implementation is broken and this should not be necessary.
"""
out = b64input.strip()
@jedp
jedp / gist:4262053
Last active October 13, 2015 21:58
Setting Up Marionette Tests

##Overview

For Identity, we have a native implementation of persona for b2g. We have a quantity of native firefox (gecko) code to test, and we have a quantity of front-end (gaia) code to test. Our code is exercised through DOM API calls. To have assurance that all our code works correctly in concert, we require a robust suite of front-end tests. So we want to contribute to automated testing on b2g. This gist describes how someone writing gecko, gaia, apps, or all of the above can do that.

The following movie demonstrates a marionette test suite driving a gaia test_app to

@jedp
jedp / gist:4239157
Created December 8, 2012 07:43
Making small strings out of big numbers
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
function baseFoo(num) {
num = Math.abs(num);
var base = chars.length;
var out = "";
var rem;
if (num === 0) return chars[0];