Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Fighting software entropy

Roberto Aloi robertoaloi

:octocat:
Fighting software entropy
View GitHub Profile
View gist:991452
[Wed, 25 May 2011 08:54:58 -0700] INFO: Starting Chef Run (Version 0.9.12)
: stdout
[default] /usr/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest/auth_credentials.rb:62:in `load_signing_key': stderr
[default] : : stderr
[default] I cannot read /etc/chef/client.pem, which you told me to use to sign requests!: stderr
[default] (: stderr
[default] Chef::Exceptions::PrivateKeyMissing: stderr
[default] )
: stderr
[default] from /usr/lib/ruby/gems/1.8/gems/chef-0.9.12/bin/../lib/chef/rest/auth_credentials.rb:33:in `initialize'
@robertoaloi
robertoaloi / rebar_compiledeps_plugin.erl
Created Aug 15, 2011
Rebar plugin to compile dependencies
View rebar_compiledeps_plugin.erl
-module(rebar_compiledeps_plugin).
-export([pre_compile/2]).
pre_compile(_, _) ->
Cwd = rebar_utils:get_cwd(),
case lists:suffix("my_dep", Cwd) of
true ->
Opts = [{cd, Cwd}],
case filelib:is_regular(filename:join([Cwd, "Makefile"])) of
true ->
@robertoaloi
robertoaloi / display.sh
Created Aug 31, 2011
Weird behaviour when calling Erlang from a Makefile on Mac
View display.sh
#!/bin/sh
CMD="erl -noinput -eval 'erlang:display({foo, bar}).' -s init stop"
echo "Exec: $CMD"
exec $CMD
@robertoaloi
robertoaloi / README
Created Jul 27, 2012
Highlighting lines in code listings
View README
Compiling it with:
latexmk -pdf main.tex
@robertoaloi
robertoaloi / erlang-after-arrow.el
Created Nov 21, 2012
Improvement to the Erlang Mode for Emacs: Do not jump to a new line after -> when writing specs.
View erlang-after-arrow.el
(defun erlang-after-arrow ()
"Return true if point is immediately after a function arrow (`->').
Make a special case when in a spec line."
(and
(save-excursion
(beginning-of-line)
(not (save-match-data (looking-at "-\\(spec\\|type\\)"))))
(and (>= (point) 2)
(and
(save-excursion
View gist:4130202
%% Recursively copy directories
-spec recursive_copy(list(), list()) -> ok.
recursive_copy(From, To) ->
{ok, Files} = file:list_dir(From),
[ok = rec_copy(From, To, X) || X <- Files],
ok.
-spec rec_copy(list(), list(), list()) -> ok.
rec_copy(_From, _To, [$. | _T]) -> %% Ignore Hidden
ok;
@robertoaloi
robertoaloi / efind.sh
Created Dec 12, 2012
Find the application for your favourite Erlang module
View efind.sh
#!/bin/sh
ROOTDIR=`which erl | sed -ne '/^ROOTDIR=/s///p'`
find $ROOTDIR -name $1.erl | awk -F / '{print $(NF-2)}' | awk -F - '{print $1}'
@robertoaloi
robertoaloi / hardwork.sh
Last active Dec 15, 2015
Count the number of lines of an Erlang application (excluding comments, type specs, empty lines).
View hardwork.sh
find . -type f \( -name *.erl -or -name *.hrl -or -name *.app.src \) -exec cat {} \; | sed '/^\s*$/d;/^\s*\%\%/d;/^\-spec*/d' | wc -l
@robertoaloi
robertoaloi / R15B01 Output
Last active Dec 19, 2015
Potential issue with Erlang Common Test when ct:pal/X is called from a config callback module.
View R15B01 Output
$ erl
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:8:8] [async-threads:0] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G)
1> test:do().
Common Test starting (cwd is /.../ct-bug)
----------------------------------------------------
2013-06-28 13:43:17.525
View debugging-notes
````
(<0.80.0>) call ct_logs:tc_print(info,50,"...")
(<0.80.0>) call ct_util:get_testdata({verbosity,info})
(<0.80.0>) call ct_util:call({get_testdata,{verbosity,info}})
(<0.80.0>) call ct_util:call({get_testdata,{verbosity,info}},infinity)
(<0.80.0>) call erlang:whereis(ct_util_server)
HANGS
````