Skip to content

Instantly share code, notes, and snippets.

View bermi's full-sized avatar

Bermi Ferrer bermi

View GitHub Profile
@bermi
bermi / template.sh
Last active February 4, 2022 17:18
Simple bash and sed templating using delimiters.
#!/usr/bin/env bash
# Simple bash and sed templating using delimiters.
#
# For example, given a template /template-a with the contents
#
# # This is template A
# #
# ### EXAMPLE_TEMPLATE_BEGIN
# echo "Hello from template A"
@bermi
bermi / README.md
Last active May 31, 2023 16:55
DuckDB cluster mode issues

This gist showcases how DuckDB on nodejs fails silently to handle the same read only database on multiple nodejs processes when running in cluster mode. This behaviour is consistent with the duckdb CLI interface.

Calling (using an in :memory: database)

node cluster.js

outputs the correct result

Forked child

Forked child

@bermi
bermi / anf.ex
Created March 14, 2021 20:57 — forked from m1dnight/anf.ex
defmodule Anf do
@moduledoc
"""
Author: Christophe De Troyer
"""
require Logger
##############################################################################
# API #
##############################################################################
@bermi
bermi / Quantopian Lectures.md
Created November 15, 2020 22:43 — forked from ih2502mk/list.md
Quantopian Lectures
@bermi
bermi / yaml-source.sh
Created March 9, 2020 18:35
Exposes key value pairs on a yaml file as environment variables
#!/usr/bin/env bash
# Exports a flat yaml key:value pairs as environment variables
#
# To source a yaml file as environment variables run
#
# . yaml-source env.yml
#
eval $(
cat $1 |
@bermi
bermi / casesafe.sh
Last active December 14, 2017 12:33 — forked from scottsb/casesafe.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
#!/bin/bash
# ---------------------------------------------------------
# Customizable Settings
# ---------------------------------------------------------
VOLUME_NAME="${CASE_SAFE_VOLUME_NAME:-casesafe}"
MOUNT_POINT="${CASE_SAFE_MOUNT_POINT:-${HOME}/${VOLUME_NAME}}"
VOLUME_PATH="${CASE_SAFE_VOLUME_PATH:-${HOME}/.${VOLUME_NAME}.dmg.sparseimage}"
VOLUME_SIZE="${CASE_SAFE_VOLUME_SIZE:-1g}"
@bermi
bermi / keybase.md
Created December 14, 2016 18:04
keybase.md

Keybase proof

I hereby claim:

  • I am bermi on github.
  • I am bermi (https://keybase.io/bermi) on keybase.
  • I have a public key whose fingerprint is 4310 50E0 D622 6BC5 D75C 2EF6 8D1A 9BED 20A3 E86C

To claim this, I am signing this object:

@bermi
bermi / index.js
Created January 16, 2015 03:24
requirebin sketch
var
iframe = document.createElement("iframe");
iframe.src = "http://localhost:5000/";
iframe.style.width = "320px";
iframe.style.height = "568px";
document.body.appendChild(iframe);
+------------------------------+----------------+---------------+
| │ vanilla │ clojure |
+------------------------------+----------------+---------------+
| [load] Vans │ 2,823 ops/sec │ 2,805 ops/sec |
+------------------------------+----------------+---------------+
| [load] Reebok │ 2,778 ops/sec │ 2,796 ops/sec |
+------------------------------+----------------+---------------+
| [recipe.setDefault()] Vans │ 2,882 ops/sec │ ERROR |
+------------------------------+----------------+---------------+
| [recipe.setDefault()] Reebok │ 1,400 ops/sec │ ERROR |
function urlencode() {
node -p 'encodeURIComponent(process.argv.slice(1))' $@
}