Skip to content

Instantly share code, notes, and snippets.

View gmcabrita's full-sized avatar

Gonçalo Mendes Cabrita gmcabrita

View GitHub Profile

Fast data algorithms

From: https://jolynch.github.io/posts/use_fast_data_algorithms/

Application Common Bad Performance Choices Better Performance Choices Expected Performance Gain
Trusted data hashing md5, sha2, crc32 xxhash ~10x
Untrusted data hashing md5, sha2, sha1 blake3 ~10x
Fast compression snappy, gzip (zlib) lz4 10x over gzip~2x over snappy
Good compression gzip (zlib) zstd ~2-10x
{
"name": "Minimal",
"author": "Gonçalo Cabrita",
"variables":
{
"black": "#000000",
"white": "#ffffff",
"green": "#009300",
"red": "#ff0000",
"yellow": "#cccc00"
DetectHiddenWindows True
EXCEPT:="Progman WorkerW Shell_TrayWnd"
#!LButton::
{
moveActiveWindow
Return
}
@gmcabrita
gmcabrita / file.rb
Created December 12, 2022 15:39
How to install a ruby gem and load it directly in the console without changing the Gemfile
gem_name = "ruby-progressbar"
`gem install #{gem_name}`
gem_folder_path = `gem which #{gem_name}`.strip.toutf8.gsub("#{gem_name}.rb", "")
$: << gem_folder_path
@gmcabrita
gmcabrita / discord-light.slack-theme
Created September 8, 2022 18:22
discord light theme colors for slack
#F3F3F4,#121016,#DEDFE1,#060607,#DEDFE1,#313335,#558A66,#B16364,#E4E5E7,#313335
@gmcabrita
gmcabrita / main.go
Created July 20, 2020 12:08
Efficient deletion of a Firestore collection.
package main
import (
"context"
"fmt"
"sync"
"cloud.google.com/go/firestore"
firebase "firebase.google.com/go"
)
var (
@gmcabrita
gmcabrita / settings.json
Created July 19, 2020 15:29
windows terminal settings json
// This file was initially generated by Windows Terminal 1.0.1811.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
function $e(tag='div', props={}, children=[]){
let element = document.createElement(tag);
Object.assign(element, props);
element.append(...children);
return element;
}
// With `elem.append(...children)` - with the added benefit that plain strings passed to .append() get turned into text nodes automatically, so you probably don't need $t any more.
var $t=document.createTextNode.bind(document);