Skip to content

Instantly share code, notes, and snippets.

@justinmklam
justinmklam / karabiner-custom-capslock.json
Last active April 15, 2024 21:31
Map caps lock to esc (if tapped) or control (if held down or combined with another key). Use with Karabiner Elements on MacOS
{
"title": "Change caps_lock to Esc and Control",
"rules": [
{
"description": "Post Esc if Caps is tapped, Control if held.",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active April 26, 2024 01:52
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@vderyagin
vderyagin / priority_queue.go
Last active November 27, 2022 18:50
Priority Queue data structure implementation in Go
package priority_queue
import "errors"
type Elem struct {
Score int
Data interface{}
}
type priorityQueue struct {