Skip to content

Instantly share code, notes, and snippets.

View jakub-g's full-sized avatar

jakub-g jakub-g

  • Antibes, France
  • 11:23 (UTC +01:00)
View GitHub Profile
@jakub-g
jakub-g / delete-git-branch-cannot-lock-ref.md
Created February 10, 2025 16:49
Delete a git branch which can't be deleted
$ git branch -d foobar

> cannot lock ref ..> foobar.lock: File exists.

$ git update-ref -d foobar

✅
@jakub-g
jakub-g / GIT_DEPTH_1_vs_GIT_DEPTH_2.md
Created January 24, 2025 15:11
git clone --depth 1 vs git clone --depth 2: push issue
@jakub-g
jakub-g / gist:7bdbd19907227ffdb25e57bcc58e1da3
Created January 7, 2025 11:01
`git rebase` when using promisor = true partialclonefilter = tree:0
```
git rebase
```
```
remote: Enumerating objects: 31850, done.
remote: Counting objects: 100% (10345/10345), done.
remote: Compressing objects: 100% (10334/10334), done.
remote: Total 31850 (delta 34), reused 11 (delta 11), pack-reused 21505 (from 1)
@jakub-g
jakub-g / readme.md
Last active January 17, 2024 16:57
Microsoft Sculpt Ergonomic Keyboard x MacOS x Karabiner settings
@jakub-g
jakub-g / md5-nodejs.js
Created October 26, 2023 12:43
md5 nodejs
let md5 = str => require('crypto').createHash('md5').update(str).digest("hex")
@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 / 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 / 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 / git-log-examples.sh
Last active November 18, 2021 15:30
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 noreply@github.com
@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);