Skip to content

Instantly share code, notes, and snippets.

@jfacorro
jfacorro / missing_otp_17.5.txt
Created November 25, 2015 15:04
Erldocs - OTP 17.5 - Missing .erl source files (and specs)
====== /Users/jfacorro/.kerl/builds/17.5/otp_src_17.5/erts ======
driver_entry
erl_driver
erl_nif
erl_prim_loader
erlang
erts_alloc
init
zlib
====== /Users/jfacorro/.kerl/builds/17.5/otp_src_17.5/lib/tools ======
@jfacorro
jfacorro / hoare-emperors-clothes.md
Last active September 7, 2016 15:10
The Emperor's Old Clothes - by C.A.R. Hoare - Communications of the ACM, 1981

The Emperor's Old Clothes

By C.A.R. Hoare

Communications of the ACM, 1981

My first and most pleasant duty in this lecture is to express my profound gratitude to the Association for Computing Machinery for the great honor which they have bestowed on me and for this opportunity to address you on a topic of my choice. What a difficult choice it is! My scientific achievements, so amply recognized by this award, have already been amply described in the scientific literature. Instead of repeating the abstruse technicalities of my trade, I would like to talk informally about myself, my personal experiences, my hopes and fears, my modest successes, and my rather less modest failures. I have learned more from my failures than can ever be revealed in the cold print of a scientific article and now I would like you to learn from them, too. Besides, failures are much more fun to hear about afterwards; they are not so funny at the time.

I start my story in August 1960, when I became a programmer with a small computer

@jfacorro
jfacorro / chromecast
Last active April 26, 2023 12:15
Cast X server to chromecast
# https://github.com/thibauts/node-castv2-client
# https://github.com/thibauts/node-castv2
sudo apt-get install xserver-xorg-core
sudo apt-get install xvfb
sudo apt-get install scrot
sudo apt-get install libav-tools
# https://weblog.lkiesow.de/20160215-raspberry-pi-screen-mirroring/
avconv -f x11grab -s 1024x768 -i :0.0 -c:v mpeg4 -f mpegts udp://192.168.0.8:8888
@jfacorro
jfacorro / pattern.erl
Created February 26, 2017 12:50
Pattern matching in function arguments
-module(pattern).
-export([is_equal/2]).
is_equal(X,X) -> 1;
is_equal(X,Y) -> 0.
@jfacorro
jfacorro / loop-let.clj
Last active March 6, 2017 23:24
loop macro, wrapping let
(require '[clojure.walk :as walk])
(walk/macroexpand-all '(loop [[x & xs] xs a 3]))
(let* [G__1249 xs
vec__1250 G__1249
x (clojure.core/nth vec__1250 0 nil)
xs (clojure.core/nthnext vec__1250 1)
a 3]
(loop* [G__1249 G__1249 a a]
(let* [vec__1251 G__1249
@jfacorro
jfacorro / pattern_list.erl
Last active March 18, 2017 11:52
sys_core_fold generates invalid Core Erlang
Module =
{c_module,[],
{c_literal,[],cerl_eval0},
[{c_var,[],{eval,0}},
{c_var,[],{module_info,0}},
{c_var,[],{module_info,1}}],
[{{c_literal,[],clojure},{c_literal,[],true}}],
[{{c_var,[],{eval,0}},
{c_fun,[],[],
{c_case,[1,{file,[]}],
@jfacorro
jfacorro / gist:7519d5013545930b98b04abbecd04526
Created October 3, 2017 10:55
Change retention for graphite
find ./ -type f -name '*.wsp' -exec whisper-resize.py --nobackup {} 10s:6h 10min:180d 12h:2y \;
@jfacorro
jfacorro / install-picotts.sh
Created February 12, 2018 11:00
Install PicoTTS in CentOS
#!/bin/bash
# Installer for SVOX Pico TTS on non-Debian platforms
# Author: Steven Mirabito <smirabito@csh.rit.edu>
# Check architechure
if [ $(uname -m) == 'x86_64' ]; then
pkgarch="amd64"
else
pkgarch="i386"
@jfacorro
jfacorro / fn-predicate.clj
Last active May 19, 2019 10:29
Clojure on the BEAM: finding a fast and correct implementation for the fn? predicate
(ns fn-pred)
(defn fn?-1
"Returns true if x is either a function"
{:added "1.0"}
[x] (erlang/is_function x))
(defn fn?-2
"Returns true if x is a function"
{:added "1.0"}
@jfacorro
jfacorro / vector_comparison.clj
Last active July 3, 2019 06:14
Clojure persistent vector implementation benchmark comparison
(ns vector-comparison)
(defn compare-creation []
(doseq [n [0 100 1000 10000]]
(println "compare-creation with" n)
(let [coll (->erl (range n))
runs 10000]
(simple-benchmark [] (array/from_list coll) runs)
(simple-benchmark [] (clj_vector/new coll) runs))))