This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% -*- erlang -*- | |
%% As an example, let's make the dialyzer plugin available regardless of | |
%% whether the project in question uses it: | |
{plugins, [rebar_dialyzer_plugin]}. | |
%% config.script uses this new variable to find it: | |
{plugin_home, ["/Users/magnus/.rebar"]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ROOTDIR=`which erl | sed -ne '/^ROOTDIR=/s///p'` | |
find $ROOTDIR -name $1.erl | awk -F / '{print $(NF-2)}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% -*- erlang -*- | |
{sys, | |
[ | |
{lib_dirs, ["../apps"]}, | |
{rel, "bar_rel", "1", [foo_app]}, | |
{rel, "start_clean", "1", [kernel, stdlib]}]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
-mode(compile). | |
epoch() -> | |
{Mega,Sec,Mili} = os:timestamp(), | |
(Mega * 1000000) + Sec + (Mili / 1000000). | |
measure(F) -> | |
Ini = epoch(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%% This module tests the impact of message queue size on the runtime | |
%%% of file:write/2. | |
%%% | |
%%% The idea is that something somewhere needs more references in a | |
%%% selective receive (OTP-8623, introduced in R14A). | |
-module(filewrite). | |
-export([testit/1, testit_raw/1, testit/2]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(slugs). | |
-export([slugify/1]). | |
-define(tolower(C), (C+32)). | |
-define(islower(C), (C >= $a andalso C =< $z)). | |
-define(isupper(C), (C >= $A andalso C =< $Z)). | |
-define(isdigit(C), (C >= $1 andalso C =< $9)). | |
-define(isspace(C), ( | |
C =:= $\s orelse C =:= $\n orelse C =:= $\t orelse C =:= $\r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro my-dolist-with-progress-reporter (spec message &rest body) | |
(declare (indent 2) (debug ((symbolp form &optional form) form body))) | |
(let ((list-var (make-symbol "list")) | |
(length-var (make-symbol "length")) | |
(counter-var (make-symbol "counter")) | |
(progress-var (make-symbol "progress"))) | |
`(let* ((,list-var ,(nth 1 spec)) | |
(,length-var (length ,list-var)) | |
(,counter-var 0) | |
(,progress-var (make-progress-reporter ,message 0 ,length-var))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires Erlang/OTP 19.0. Invoke as: | |
# | |
# iex --erl "-proto_dist Elixir.Epmdless -start_epmd false -epmd_module Elixir.Epmdless_epmd_client" --name frobozz3 | |
# A module containing the function that determines the port number | |
# based on a node name. | |
defmodule Epmdless do | |
def dist_port(name) when is_atom(name) do | |
dist_port Atom.to_string name | |
end |