Skip to content

Instantly share code, notes, and snippets.

View jaredhirsch's full-sized avatar
🙃
mostly working in mozilla repositories these days

Jared Hirsch jaredhirsch

🙃
mostly working in mozilla repositories these days
View GitHub Profile
@jaredhirsch
jaredhirsch / :-(
Created July 9, 2019 22:17
fxa-auth-server: trying to install on node 10.16.0 / mac 10.14.5
[15:15:11 fxa-auth-server (mozilla-master) ]$ npm install
> @newrelic/native-metrics@3.1.2 install /Users/jh/codez/github/mozilla-fxa/packages/fxa-auth-server/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics
> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 6 native_metrics
CXX(target) Release/obj.target/native_metrics/src/native_metrics.o
CXX(target) Release/obj.target/native_metrics/src/GCBinder.o
CXX(target) Release/obj.target/native_metrics/src/LoopChecker.o
@jaredhirsch
jaredhirsch / foo
Created July 9, 2019 16:01
fxa-js-client errors after npm setup && npm test without separately installing intern-geezer
[09:00:49 fxa-js-client (mozilla-master) ]$ npm run test
> fxa-js-client@1.0.14 test /Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client
> grunt test
Running "intern:node" (intern) task
DEBUG: 'failed to load resource (/Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client/node_modules/intern-geezer/node_modules/dojo/_base/array.js)'
DEBUG: { Error: ENOENT: no such file or directory, open '/Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client/node_modules/intern-geezer/node_modules/dojo/_base/array.js'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
@jaredhirsch
jaredhirsch / foo.diff
Created January 26, 2019 00:36
Converting hostname to login title: the PSL approach
commit d67700eadc05178d275d526bd696f2dacaf83221
Author: Jared Hirsch <ohai@6a68.net>
Date: Tue Jan 22 16:21:23 2019 -0800
Add Logins API utility method to get domain name, minus TLD, from a URL
diff --git a/src/experiments/logins/api.js b/src/experiments/logins/api.js
index 15dbf53..71412a2 100644
--- a/src/experiments/logins/api.js
+++ b/src/experiments/logins/api.js
@jaredhirsch
jaredhirsch / gist:4761fee0a92c9559d0666e4edfbde851
Last active April 13, 2018 10:26
query monitoring: postgres on AWS

I did a little preliminary research today on how to measure postgres performance, including on AWS.

How Postgres query performance measurement works

Postgres can be configured to log query-related data.

These logs can be exported to tools like pgbadger or hosted tools like pganalyze. Datadog seems to have some options, too.

Postgres query measurement on RDS

@jaredhirsch
jaredhirsch / foo.js
Created March 15, 2017 21:05
trying to shutdown + restart embedded webextensions without a restart
// 1. This seems to work. Is it safe to use?
const { EmbeddedExtensionManager } = Cu.import("resource://gre/modules/LegacyExtensionsUtils.jsm");
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: 'pageshot@mozilla.org'});
webext.shutdown();
webext.started = false;
webext.startup(); // throws no errors, toolbar button reappears, messaging works
// 2. This doesn't work:
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: 'pageshot@mozilla.org'});
webext.shutdown();
@jaredhirsch
jaredhirsch / foo.md
Created October 24, 2017 18:22
debugging is fun yay

this is webpack require 8 in studyutils.jsm, beautified:

module.exports = {
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "study setup",
    "type": "object",
    "definitions": {
        "idString": {
            "description": "between 1,100 chars, no spaces, unicode ok.",
@jaredhirsch
jaredhirsch / gist:c3ede1aa90f0b3a1a1a9
Last active September 5, 2017 20:04
tmux step by step

update

tmux just didn't do it for me. I'm good enough with vim splits and multiple terminal windows. Sharing a tmux session to do remote pairing is a great feature, but I work solo these days. Giving up for now. Feel free to use this doc if it helps you, though.


meta:

  • Based on my experience learning and teaching vim, I think the most effective way to learn similar tools (like tmux, with oh so many options/commands) is to start with a core set of commands and their inverses, then add fancy bits later.
  • Starting with the core vocabulary, working our way up to the advanced stuff later.
@jaredhirsch
jaredhirsch / foo.md
Created August 10, 2017 16:27
Screenshots - Bug 1387598 / Intermittent sessionrestore_no_auto_restore | application crashed [@ GetNameOperation]

I got pinged on bug 1387598, some Windows-only crashes in a Talos test that deliberately prevents the sessionstore-windows-restored event from firing. Screenshots 10.10 seemed to cause the regression. (As a reminder, 10.10 includes a fix to synchronize startup and shutdown, see discussion in screenshots pull request #3260.)

Looking at the Talos test definition on dxr, it appears that the test causes the event to never fire:

# inside mozilla-central/testing/talos/talos/test.py, revision 4c5fbf493763, line 181:

@register_test()
class sessionrestore_no_auto_restore(sessionrestore):
    """
@jaredhirsch
jaredhirsch / foo.js
Last active July 7, 2017 21:33
messin with firefox context menu
Cu.import('resource://gre/modules/Console.jsm');
// get a pointer to the context menu
// TODO: seems to be per-window. how to iterate and attach to all windows? :-(
menu = document.getElementById("contentAreaContextMenu");
// create a hidden menu item
xuldoc = menu.ownerDocument;
item = xuldoc.createElement('menuitem');
item.setAttribute('id', 'minvid-item');
@jaredhirsch
jaredhirsch / foo.md
Created June 20, 2017 15:31
Firefox Browser Toolbox: just reopen it when you get NS_ERROR_CONNECTION_REFUSED :-)

I've seen this error so many times when I first open the Firefox Browser toolbox:

Error opening Browser Toolbox:
Component returned failure code: 0x804b000d (NS_ERROR_CONNECTION_REFUSED) [nsIInputStream.available]

The fix is almost always to close and reopen the toolbox, and it'll connect just fine.