Skip to content

Instantly share code, notes, and snippets.

@bradfordw
bradfordw / .gitignore
Created November 30, 2009 22:40
A n00bs crack at an evolutionary algorithm in Erlang
*.beam
;;; prelude-osx.el --- Emacs Prelude: OSX specific settings.
;;
;; Copyright © 2011-2015 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
-module(exp_parser).
-export([parse/1]).
% Parse simple math expressions.
% Currently works (for certain definitions of "works")
% for addition, subtraction and multiplication.
% Eventually it should handle a unary negation operator (~)
% The goal is to do the following:
% parse("(2 + 3)") => {plus, {num, 2}, {num, 3}}
decode_element(Stream) ->
decode_element(Stream, <<"">>).
decode_element(<<>>, Output) -> Output;
decode_element(<<$&,$l,$t,$;,Rest/binary>>, Output) ->
decode_element(Rest, <<Output/binary, $<>>);
decode_element(<<$&,$g,$t,$;,Rest/binary>>, Output) ->
decode_element(Rest, <<Output/binary, $>>>);
decode_element(<<E:1/binary, Rest/binary>>, Output) ->
decode_element(Rest, <<Output/binary, E/binary>>).
!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$
@bradfordw
bradfordw / hardwork.sh
Last active November 4, 2015 21:46 — forked from robertoaloi/hardwork.sh
Count the number of lines of an Erlang application (excluding comments, type specs, empty lines).
# for osx users
find . -type f \( -name "*.erl" -or -name "*.hrl" -or -name "*.app.src" \) -exec cat {} \; | sed '/^\s*$/d;/^\s*\%\%/d;/^\-spec*/d' | wc -l
-module(nfp_bank_atm).
-behaviour(gen_server).
%% API
-export([start_link/0,
create_account/1,
deposit/2,
withdraw/2,
delete_account/1]).
-module(my_server).
-behaviour(gen_server).
%% API
-export([start_link/0]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
Pixels = <<213,45,132,64,76,32,76,0,0,234,32,15>>,
RGB = [ {R,G,B} || <<R:8,G:8,B:8>> <= Pixels ].
#!/bin/bash
gcc -undefined dynamic_lookup -dynamiclib -D OCI_IMPORT_LINKAGE -D OCI_CHARSET_ANSI -L/usr/local/oracle/instantclient_10_2/ -lclntsh -L/usr/local/lib -locilib -L/usr/local/Cellar/erlang/R14B04/lib/erlang/usr/include/ prophet.c -o prophet.so