Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️
chillin

Jared Hirsch 6a68

🏖️
chillin
View GitHub Profile
@6a68
6a68 / foo.md
Last active Nov 6, 2019
attaching debuggers to things
View foo.md

(Note: I moved this info into the main FxA readme at https://github.com/mozilla/fxa.)

Attaching a debugger to a running node process, sadly, requires running google chrome (AFAIK).

How to do it:

  1. Start google chrome and open up chrome://inspect.

  2. Run a node process using the --inspect or --inspect-brk flags (see specific command-line incantations below)

@6a68
6a68 / ugh
Created Jul 9, 2019
fxa monorepo npm install = node-gyp dumpster fires
View ugh
[15:51:37 mozilla-fxa (mozilla-master) ]$ npm install
> fxa@2.0.0 postinstall /Users/jh/codez/github/mozilla-fxa
> _scripts/postinstall.sh
+ '[' '' = true ']'
+ _scripts/install_all.sh
+ _scripts/check.sh
++ which rustup
+ [[ ! -n /Users/jh/.cargo/bin/rustup ]]
View foo
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/Users/jh/codez/github/mozilla-fxa/packages/fxa-email-service/target/debug/build/backtrace-sys-a925084960b3e8d2/out" "-fvisibility=hidden" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktr
@6a68
6a68 / :-(
Created Jul 9, 2019
fxa-auth-server: trying to install on node 10.16.0 / mac 10.14.5
View :-(
[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
@6a68
6a68 / foo
Created Jul 9, 2019
fxa-js-client errors after npm setup && npm test without separately installing intern-geezer
View foo
[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)
@6a68
6a68 / foo.diff
Created Jan 26, 2019
Converting hostname to login title: the PSL approach
View foo.diff
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
@6a68
6a68 / foo.md
Created Oct 24, 2017
debugging is fun yay
View foo.md

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.",
@6a68
6a68 / foo.md
Created Aug 10, 2017
Screenshots - Bug 1387598 / Intermittent sessionrestore_no_auto_restore | application crashed [@ GetNameOperation]
View foo.md

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):
    """
@6a68
6a68 / gist:4761fee0a92c9559d0666e4edfbde851
Last active Apr 13, 2018
query monitoring: postgres on AWS
View gist:4761fee0a92c9559d0666e4edfbde851

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

@6a68
6a68 / foo.js
Last active Jul 7, 2017
messin with firefox context menu
View foo.js
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');
You can’t perform that action at this time.