Skip to content

Instantly share code, notes, and snippets.

View jakub-g's full-sized avatar
💭
I may be slow to respond.

jakub-g jakub-g

💭
I may be slow to respond.
  • Antibes, France
  • 15:26 (UTC +02:00)
View GitHub Profile
@jakub-g
jakub-g / github-code-search-syntax.md
Created February 17, 2021 08:13
Searching files on GitHub

GitHub search docs: here

  • org:ORGNAME to filter down to org
  • org:ORGNAME -repo:ORGNAME/NOISY to filter out some repos
  • path:PATH to search by location
  • language:... or extension:... to filter by lang/extension
  • in:file, in:path, in:file,path to include contents or file paths
@jakub-g
jakub-g / README.md
Last active June 6, 2023 16:39
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
bash firefox_enable_enterprise_roots_macos.sh
@jakub-g
jakub-g / gist:7451108
Last active March 13, 2023 18:35
Find git commits touching only files from a specific folder
git log --reverse --format="%h / %cd / %an / %s" --date=short master -- src/main/static
@jakub-g
jakub-g / safari-release-notes-history+stable-technical-preview-mapping.md
Last active February 22, 2023 02:33
Mapping Safari releases to Safari TP versions
@jakub-g
jakub-g / hn.md
Last active January 19, 2023 04:21
Hacker News Links

Hacker News "hidden" URLs

Many of HN URLs are not easily discoverable as there are no links to them in a prominent part on the page, or sometimes even nowhere. The following is a list of links to standard and "special" HN pages. The ones is bold are the less discoverable ones.

See also: https://github.com/minimaxir/hacker-news-undocumented

Posts

@jakub-g
jakub-g / 1-unicode-js-regex.md
Last active December 22, 2022 08:03
Unicode-aware JavaScript regex cheat sheet

Unicode-aware JavaScript regex (Unicode property escapes /\p{..}\P{..}/u) cheat sheet

Browser support MDN

@jakub-g
jakub-g / README.md
Last active November 25, 2022 19:35
Karabiner-Elements: Remap cmd-capslock to cmd-backtick(tilde) (Switch window within an app)

What this rule does

On MacOS, cmd-tab only toggles between different apps. To toggle between different windows of the same app, you need to use cmd-` . However this is cumbersome for regular usage, as it requires stretching your fingers unnaturally. This rule allows to use cmd-CapsLock instead, which is much easier.

To enable the rule

  • Install Karabiner Elements and give it all permissions it asks for
  • cd ~/.config/karabiner/assets/complex_modifications and put the json file below there
  • Restart Karabiner Elements
  • Go to "Complex Modifications > Add rule"
@jakub-g
jakub-g / analyze-trace.mjs
Created November 17, 2021 15:50
analyze-tsc-trace-longest-checkSourceFile
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
jakub-g / jq-bash-vs-zsh.txt
Last active September 29, 2022 16:41
jq JSON with newlines output formatting madness - bash vs zsh discrepancy
$ jq --version
jq-1.6
---
bash-3.2$ jq --null-input --compact-output --raw-output --monochrome-output --arg test 'A\nB' '{test: $test}'
{"test":"A\\nB"}
bash-3.2$ OUT=$(jq --null-input --compact-output --raw-output --monochrome-output --arg test 'A\nB' '{test: $test}'); echo $OUT
{"test":"A\\nB"}
@jakub-g
jakub-g / macos-energy-drains.md
Last active September 24, 2022 10:21
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