Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Fighting software entropy

Roberto Aloi robertoaloi

:octocat:
Fighting software entropy
View GitHub Profile
@dszoboszlay
dszoboszlay / perftest.erl
Last active Aug 30, 2021
Small utility for comparing the time to execute various Erlang functions
View perftest.erl
-module(perftest).
-export([test/1, test/2]).
-define(SCHEDULER_REDUCTIONS_LIMIT, 2000).
-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
jlouis / test_tcp.erl
Created Sep 8, 2014
Improved version of test_tcp
View test_tcp.erl
-module(test_tcp).
-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)
end),
@charlesjohnson
charlesjohnson / gemrc.erb
Last active Aug 29, 2015
Use a .gemrc file with Omnibus chef-client
View gemrc.erb
:sources:
- http://<%= node['gem_file']['host'] %>:<%= node['gem_file']['port'] %>/
View on_the_viability_of_erlang_releases_and_couchdb.md

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
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
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
formula=$1
version=$2
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
caniszczyk / clone-all-twitter-github-repos.sh
Created Oct 9, 2012
Clone all repos from a GitHub organization
View clone-all-twitter-github-repos.sh
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

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 = git@github.com:joyent/node.git

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
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
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#