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 / 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
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.

@jaredhirsch
jaredhirsch / foo.md
Last active May 9, 2017 00:50
Measuring the performance impact of Firefox Screenshots

I'm helping to land a Test Pilot experiment (Page Shot, now dubbed Firefox Screenshots) in Firefox.

We're landing it as a system addon~, preffed off, but it still has some unknown impact on memory consumption and startup performance.

This will be my first time profiling anything in Gecko, and it seems like it might be worth writing down my steps, both for others wanting to try it out, and to identify rough spots in the APIs or missing bits of documentation.

Steps:

@jaredhirsch
jaredhirsch / foo.md
Last active April 10, 2017 22:51
how to get screenshots code into git-cinnabar to push to try

I keep forgetting this and relearning how to do it.

  1. apply patch from bug
    • go to bug 1346825

    • find the build system commit (currently attachment 8855871)

    • just apply the raw diff locally to the various files (for whatever reason, I often find patch barfs on the diff)

  • commit the changes locally
@jaredhirsch
jaredhirsch / usps-phone-number.md
Created April 4, 2017 15:03
USPS customer service direct phone number

The direct number to USPS customer service is: 678-279-7980.

Be prepared for a 30-60 minute wait, but you will actually speak to a person.


I spent hours digging through amazon/ebay/etc seller forums, and eventually uncovered the phone number above. When I called, I waited about an hour to speak to someone, then the person at the other end added a comment to my lost package case number, asking the person assigned to the case to actually work on it, and my

@jaredhirsch
jaredhirsch / patch.diff
Created March 28, 2017 22:26
Patch that fixes browser/ test breakage
diff --git a/browser/components/customizableui/CustomizableUI.jsm b/browser/components/customizableui/CustomizableUI.jsm
index aee38b72af35..cffbd5942c1d 100644
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -257,6 +257,20 @@ var CustomizableUIInternal = {
navbarPlacements.push("pocket-button");
}
+ function _screenshotsDisabled() {
+ return (Services.prefs.getPrefType("extensions.screenshots.system-disabled") &&
@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
Last active March 7, 2017 19:54
strings in page shot

strings in the page shot WebExtension

Total: 20 strings, 126 words

selector/ui.js

7 unique strings

24 words

@jaredhirsch
jaredhirsch / foo.md
Created November 30, 2016 17:19
universal search: last minus one version