Skip to content

Instantly share code, notes, and snippets.


jakub-g jakub-g

View GitHub Profile
jakub-g /
Last active Feb 23, 2022
Make Firefox on MacOS trust CA certificates from system keychain

Add a self-signed TLS certificate to MacOS system keychain, and make Firefox trust it

Tested on MacOS 11.6.4

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $FILENAME.crt
jakub-g /
Last active Nov 18, 2021
git log examples
git log --since="27 SEP 2021" --until="28 SEP 2021" --pretty='%ci %h %s %cn %ce ' | grep 'Merge pull'
# 2021-09-27 19:22:53 +0200 2bd0ea1b765 Merge pull request #123 from org/repo GitHub
jakub-g / analyze-trace.mjs
Created Nov 17, 2021
View analyze-trace.mjs
import * as fsp from 'fs/promises';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
// eslint-disable-next-line no-underscore-dangle
const __dirname = dirname(fileURLToPath(import.meta.url));
const dirNameLen = __dirname.length;
const file = await fsp.readFile('../trace.json');
const trace = JSON.parse(file);
jakub-g /
Last active Oct 25, 2021
macos big sur disable all energy drains - MacBookPro 2020

MacOS Big Sur MacBookPro 2020 disable energy drains

Disable settings that prevent the Mac from sleeping or let it wake up overnight in your backpack and drain half of battery.

On top of those, it's probably best to not leave any USB thing plugged to the Mac before putting it to sleep (including YubiKeys).

Enable hibernation (i.e. write to disk)

sudo pmset -a hibernatemode 25 
jakub-g /
Last active Nov 11, 2021
vscode mac shortcuts
Action Shortcut
Show hover infobox cmd-k,cmd-i
jakub-g /
Last active Feb 4, 2022
Migrate/convert JavaScript to TypeScript cheatsheet

Relevant official docs

Migrating NodeJS CJS files (require, module.exports)

First steps

  1. Rename the file from .js to .ts
  2. Change module.exports = to export =
  3. Change all exports.foobar = to export const foobar =
  4. Update top-level require calls to static import.
jakub-g /
Last active Mar 24, 2021
WebPageTest wishlist 2021

0. Filmstrip page

  • There's no link back to waterfall page
  • Custom end time URL param is not validated. I can put -e:99 and will have 99s worth of filmstrip images (while the test was shorter than that)

1. Re-run the test equivalent which allows changing config

Sometimes I have very elaborate test config which I want to reuse, but slightly change one thing (e.g. add one param to URL). I can easily re-run the test with exact same config, but it's not easy to slightly change config and re-run. You need to re-create the config from scratch by checking multiple checkboxes, and hoping you come up with same exact set of params as before

jakub-g /
Last active Mar 11, 2021
preact-redux: where can `props` come from
import { compose } from 'redux'
import { connect } from 'react-redux'


compose(func1, func2, func3, func4) === func1(func2(func3(func4))))
jakub-g /
Last active Mar 22, 2021

Test query

({a: window.PerformanceObserver.supportedEntryTypes, b: window.PerformancePaintTiming, c: navigator.userAgent})


A TP blog says shipped in TP75 which would mean 12.1 stable but I tested in 12.1 and it's not true. It returns undefined. So I asssume 13.0 (I don't have 13.0 to test).

jakub-g /
Last active Mar 2, 2021
Configure popular tools to work with ES modules

Things to do before you start using ES modules and put "type": "module" in package.json

The correct behavior of all tools is to assume that .js files are in ES modules format. Hence you must convert existing .js files (including config files) to ESM format, or rename them to .cjs if you want to keep them intact.

eslint, prettier

You should rename .eslintrc.js/.prettierrc.js to .cjs extension, or make them a valid JSON with .json extension

doc: eslint prettier