Skip to content

Instantly share code, notes, and snippets.

@dannycoates
dannycoates / test.js
Created August 20, 2013 20:40
simplesmtp _onData bug
var smtp = require('simplesmtp')
var net = require('net')
var server = net.createServer(
function (c) {
console.log('connected')
c.write('220 127.0.0.1\r\n')
c.on('data',
function (data) {
console.log(data.toString())
@dannycoates
dannycoates / log.js
Created August 31, 2013 18:31
logging with domains
/* 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/. */
var Domain = require('domain')
var inherits = require('util').inherits
var Logger = require('bunyan')
function Overdrive(options) {
Logger.call(this, options)
@dannycoates
dannycoates / db.js
Created October 24, 2013 21:38
abstract db interface
/*/
# Notes
All endpoints that use HAWK require tokens and the token must be read from the
db to validate the request. Ideally all data required for an endpoint to do it's
job can be read in the same db call.
Different db implementations will have different data layouts. For example, SQL
may use a join to get the keys for a keyFetchToken, while Cassandra will store
var cluster = require('cluster')
var Client = require('../../client')
var origin = process.env.PICL_ORIGIN || 'http://127.0.0.1:9000'
var password = 'foobar'
var threads = 50
if (cluster.isMaster) {
@dannycoates
dannycoates / doc.md
Last active December 27, 2015 03:08
MySQL instructions for FXA testing

MySQL setup

Install MySQL

Mac

Installation is easy with homebrew. I use mariadb which is a fork of mysql but either should work.

brew install mariadb
@dannycoates
dannycoates / fptt.js
Created November 6, 2013 23:45
hack the test
/* 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/. */
var test = require('tap').test
var log = { trace: function() {} }
var timestamp = Date.now()
// increment timestamp by 500ms each time now is called
function now() { return (timestamp += 500) }
@dannycoates
dannycoates / tooslow.js
Created November 11, 2013 06:55
js version of toobusy
var interval = 500
var maxLag = 70
var lag = 0
var decay = 3
var mark = []
var timer = null
function tooslow() {
return (lag > maxLag) &&
Math.random() < ((lag - maxLag) / maxLag)

Auth Server config changes

additions

{
  "smtp": {
    "passwordResetUrl": "https://api-accounts.firefox.com/v1/complete_reset_password",
    "redirectDomain": "firefox.com"
 },
{"name":"fxa-auth-server","hostname":"ip-10-80-227-43","pid":28040,"level":60,"err":{"message":"You must pass a string or Handlebars AST to Handlebars.compile. You passed undefined","name":"Error","stack":"Error: You must pass a string or Handlebars AST to Handlebars.compile. You passed undefined\n at new Error (<anonymous>)\n at Error.Exception (/home/app/code/node_modules/handlebars/dist/cjs/handlebars/exception.js:13:41)\n at compile (/home/app/code/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:442:11)\n at HandlebarsEnvironment.hb.compile (/home/app/code/node_modules/handlebars/dist/cjs/handlebars.js:19:12)\n at Request._callback (/home/app/code/mailer.js:85:51)\n at Request.self.callback (/home/app/code/node_modules/request/request.js:123:22)\n at Request.EventEmitter.emit (events.js:98:17)\n at Request.<anonymous> (/home/app/code/node_modules/request/request.js:893:14)\n at Request.EventEmitter.emit (events.js:117:20)\n at IncomingMessage.<anonymous> (/ho
@dannycoates
dannycoates / cloud.md
Last active August 29, 2015 13:56
open cloud services

Mozilla's cloud services need to advance the state of the web in privacy, security, and usability in order to compete and keep the web open. We need a platform that has a user experience closer to mobile where building, signing up, using, and managing apps is easy. We need the cloud to integrate well with our mobile, desktop, and lifestyle devices. We need choice in how our data is used. We need to trust the services we use. To do this we should build a platform that lets us run our cloud apps (service instances) individually, in the cloud or on our own servers.

As technical people, today we can enjoy the benefits of owning some of our web identities and data by running our own services on our own servers. We can register our own domains, manage MX records, setup shared hosting or VPS, make our own blogs, host our own email, and even run our own Firefox Sync service because we own our servers, or at least the data. Even for the most dedicated of us its time consuming and complicated to setup and maintain. It