Skip to content

Instantly share code, notes, and snippets.

Fighting software entropy

Roberto Aloi robertoaloi

Fighting software entropy
View GitHub Profile
dszoboszlay / perftest.erl
Last active Aug 30, 2021
Small utility for comparing the time to execute various Erlang functions
View perftest.erl
-export([test/1, test/2]).
-define(MIN_INNER_LOOPS, 50).
-define(STOP_OUTER_MSG, stop_outer_loop).
-define(EMPTY_LOOP, "empty loop").
test(Fs) ->
test(Fs, timer:seconds(1)).
jlouis / test_tcp.erl
Created Sep 8, 2014
Improved version of test_tcp
View test_tcp.erl
-export([run_tcp/3, recv_tcp/3, send_tcp/4]).
-define(SOCKET_OPTS, [{active, false}, binary, {delay_send, true}, {packet, 4}]).
run_tcp(Port, P, N) ->
spawn_link(fun() ->
recv_tcp(Port, P, N)
charlesjohnson / gemrc.erb
Last active Aug 29, 2015
Use a .gemrc file with Omnibus chef-client
View gemrc.erb
- http://<%= node['gem_file']['host'] %>:<%= node['gem_file']['port'] %>/

On the Viability of Erlang Releases and CouchDB

There has been some discussion on what versions of Erlang CouchDB should support, and what versions of Erlang are detrimental to use. Sadly there were some pretty substantial problems in the R15 line and even parts of R16 that are landmines for CouchDB. This post will describe the current state of things and make some potential recommendations on approach.

Scheduler Collapse

d11wtq / docker-ssh-forward.bash
Created Jan 29, 2014
How to SSH agent forward into a docker container
View docker-ssh-forward.bash
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
rainchen / gist:6363948
Created Aug 28, 2013
Install specific version of Homebrew formula
View gist:6363948
# Install specific version of Homebrew formula
# usage example:
# $ brew-install ssh-copy-id 6.0p1
function brew-install {
local formula version formula_hash
cd `brew --prefix`
git_last_commit_id=`git rev-parse --short HEAD`
View .bash_profile
export PATH="$HOME/erlang/current/bin:$PATH"
erlcur() {
DIR=`ls -lr $HOME/erlang | awk '/current/ { print $NF }'`
echo -n ${DIR##*/}
erlsw() {
TARGET=`find $HOME/erlang -depth 1 -type d -name "*$1*" | head -1`
if [ -z "$TARGET" ]; then
caniszczyk /
Created Oct 9, 2012
Clone all repos from a GitHub organization
curl -s | ruby -rubygems -e 'require "json"; JSON.load( { |repo| %x[git clone #{repo["ssh_url"]} ]}'
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

gcatlin / gist:1847248
Created Feb 16, 2012
Install specific version of Homebrew formula
View gist:1847248
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17