Skip to content

Instantly share code, notes, and snippets.

View mlb-'s full-sized avatar

Matthew Batema mlb-

View GitHub Profile
%% @copyright Geoff Cant 2009, 2010
%% @author Geoff Cant <nem@erlang.geek.nz>
%% @version {@vsn}, {@date} {@time}
%% @doc Erlang shell code to trace the messages for one process.
%% @end
dbg:stop_clear(),
f(GL).
GL=group_leader(),
dbg:tracer(process,

How to create, build and run an OTP application using Rebar

Get Rebar from bitbucket.org

hg clone http://hg.basho.com/rebar/

Build Rebar

  ./bootstrap 
==> rebar (compile)
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
%% @copyright Geoff Cant 2010
%% @author Geoff Cant <nem@erlang.geek.nz>
%% @doc Erlang shell code to cause a gen* process to evaluate a fun.
%%
%% @license This code was translated from an ancient tome in the
%% Arkham university library (restricted section, 4th vault). As such,
%% use of this code is restricted to only those who see it as the
%% manifestly evil. Using this code under any circumstances other than in
%% dire need while debugging revokes your right to use, view, posess
%% said code.
@jlouis
jlouis / gist:661272
Created November 3, 2010 16:03
Make a text message into a brainfuck program
%%%-------------------------------------------------------------------
%%% File : bfize.erl
%%% Author : Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
%%% Description : Brainfuckize a text message
%%%
%%% Created : 27 Oct 2010 by Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
%%%-------------------------------------------------------------------
-module(bfize).
%% API, the single export from the module, taking one parameter
@eproxus
eproxus / virus.erl
Created March 4, 2011 09:26
A small module that jumps between connected nodes
%% @doc A small module that jumps between connected nodes.
%% @author Gianfranco Alongi <gianfranco.alongi@gmail.com>
%% @author Adam Lindberg <hello@alind.io>
-module(virus).
-export([start/0]).
-export([start/1]).
start() -> spawn_process(code:get_object_code(?MODULE)).
start(Beam) -> spawn_process(Beam).
(defmodule egs_proto (export (parse_packet 1) (dsl_test 0)))
;; Subset of binaries.
;;
;; Looks like little-endian 32 bit floats are hella broken.
;; Unsure why.
(defmacro egs-prot (chunks
(flet* ((chunk2bin
(((list name n)) (when (is_integer n))
`(,name little integer (size ,(* 8 n))))
app="myapp"
function gen-ups {
rebar generate-appups previous_release=$1
cat $app/lib/*/ebin/*.appup
}
# This uses a dirty bunch of hacks to "generate" downgrade instructions
# (upgrade instructions in the opposite direction) with the current rebar
# version.
@fujin
fujin / foo.rb
Created January 31, 2012 21:49
template override between cookbooks
template "/tmp/foo.rb"
source "foo.rb.erb"
cookbook "banana"
end
@jlouis
jlouis / t.erl
Created June 12, 2012 19:28
Percept example
-module(t).
-export([start/0, go/0, analyze/0, server/0]).
start() ->
percept:profile("test.dat", {t, go, []}, [procs]).
go() ->
Led = led:start(1),
Led1 = led:start(1),
@kaezarrex
kaezarrex / massive-props.user.js
Created July 5, 2012 22:09
Give massive props on Twitter
// ==UserScript==
// @name Massive Props
// @namespace https://twitter.com
// @include https://twitter.com/*
// @description https://twitter.com/ryanqnorth/status/220970058548121600
// ==/UserScript==
var script = document.createElement('style');
script.innerHTML = '\
.favorite { \