Skip to content

Instantly share code, notes, and snippets.

View joaofnds's full-sized avatar

João Fernandes joaofnds

View GitHub Profile

Keybase proof

I hereby claim:

  • I am joaofnds on github.
  • I am joaofnds (https://keybase.io/joaofnds) on keybase.
  • I have a public key whose fingerprint is 1D72 95B2 7D3B C292 068A 6533 064E 0BAC E988 9F9C

To claim this, I am signing this object:

package main
import (
"fmt"
"math"
)
func main() {
memAddress := uint(26)
@joaofnds
joaofnds / alacritty theme switcher.md
Last active November 15, 2021 17:46
Easily switch between themes on alacritty

Please note that this is just for you to experiment with themes, your alacritty config will be overwritten without the comments, so I strongly recommend you to back up your file first and apply the theme yourself once you find out the one you like.

@joaofnds
joaofnds / copy_heroku_env.rb
Last active June 16, 2019 15:11
Copies heroku env from one app to another. Call it with `ruby copy_heroku_env.rb my-app-to-copy-from my-app-to-copy-to`
require 'json'
from_app, to_app = ARGV
envs_to_ignore = ['DATABASE_URL']
config =
JSON.parse(`heroku config --app #{from_app} --json`)
.reduce('') do |memo, (key, value)|
if envs_to_ignore.include? key
@joaofnds
joaofnds / heroku_clear_env.rb
Last active June 16, 2019 15:12
remove all heroku env variables except for database_url. Call it with `ruby heroku_clear_env.rb my-app`
require 'json'
app = ARGV[0]
envs_to_ignore = ['DATABASE_URL']
keys =
JSON.parse(`heroku config --app #{app} --json`)
.reduce('') do |memo, (key, _value)|
if envs_to_ignore.include? key
const customers = [
{ name: 'foo', orders: 4 },
{ name: 'bar', orders: 3 },
{ name: 'baz', orders: 2 },
{ name: 'qux', orders: 1 }
]
const arrayReducer = (arr, elem) => arr.concat(elem)
const tmap =
@joaofnds
joaofnds / mac-home.log
Created September 16, 2019 11:57
output of `ls -al` from a fresh macos install
total 24
drwxr-xr-x+ 15 joaofnds staff 480 Sep 14 23:56 .
drwxr-xr-x 5 root admin 160 Sep 14 23:52 ..
-r-------- 1 joaofnds staff 7 Sep 14 23:52 .CFUserTextEncoding
-rw-r--r--@ 1 joaofnds staff 6148 Sep 14 23:55 .DS_Store
drwx------ 2 joaofnds staff 64 Sep 14 23:55 .Trash
-rw------- 1 joaofnds staff 0 Sep 14 23:56 .bash_history
drwx------ 11 joaofnds staff 352 Sep 15 00:25 .bash_sessions
drwx------@ 8 joaofnds staff 256 Sep 15 00:25 Desktop
drwx------@ 16 joaofnds staff 512 Sep 15 00:12 Documents
@joaofnds
joaofnds / notable-export.js
Last active September 24, 2019 03:41
Export notable files to a filetree structure using the first encountered tag
const fs = require("fs");
const path = require("path");
const { promisify } = require("util");
const matter = require("gray-matter"); // required since notable use it to encode
const glob = promisify(require("glob"));
const mkdir = promisify(fs.mkdir);
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
@joaofnds
joaofnds / pipe.lisp
Last active October 20, 2019 14:30
Naive implementation of a "pipe" macro (does *not* support lambdas)
(defmacro -> (args &body forms)
(flet ((ensure-list (arg) (if (listp arg) arg (list arg))))
(reduce
(lambda (args f)
(ensure-list
(case (type-of f)
(function (apply f args))
(symbol (apply f args))
(cons (apply (car f) (append (cdr f) args))))))
forms
git clone https://github.com/eulerto/wal2json -b master --single-branch \
&& cd wal2json \
&& git checkout d2b7fef021c46e0d429f2c1768de361069e58696 \
&& make && make install \
&& cd .. \
&& rm -rf wal2json