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/ruby | |
# This script installs to /usr/local only. To install elsewhere you can just | |
# untar https://github.com/sceaga/homebrew/tarball/tiger anywhere you like. | |
module Tty extend self | |
def blue; bold 34; end | |
def white; bold 39; end | |
def red; underline 31; end | |
def reset; escape 0; end | |
def bold n; escape "1;#{n}" end |
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
char **ifs_split(const char *str, const char *ifs) | |
{ | |
size_t index = 0; | |
size_t size = 1; | |
char *segment = NULL; | |
char *start = NULL; | |
char *rest = NULL; | |
char **tab = NULL; // Thou shall free thee. | |
start = dupstr(str); |
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(my_tests). | |
-include_lib("eunit/include/eunit.hrl"). | |
e_test () -> | |
{setup, fun () -> ok end, | |
fun () -> ok end, | |
fun () -> {inorder, [ | |
?_assertMatch(fail, hard) %% Does not fail! | |
]} end}. |
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
otp_vsn () -> | |
R = fun (D, U) -> 10 * (D - $0) + U - $0 end, | |
case erlang:system_info(otp_release) of | |
[$R, D,U ] -> R(D,U) + 0.00; | |
[$R, D,U, $A ] -> R(D,U) + 0.01; | |
[$R, D,U, $B ] -> R(D,U) + 0.02; | |
[$R, D,U, $B, DD,UU] -> R(D,U) + R(DD,UU) / 10 + 0.00 | |
end. | |
%% On R16B02: otp_vsn() = 16.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
%% Copyright © 2013 Pierre Fenoll ‹[email protected]› | |
%% See LICENSE for licensing information. | |
%% -*- coding: utf-8 -*- | |
-module(keyfold). | |
%% keyfold: extension to stdlib's lists module. | |
%% Intersection of lists:fold{l,r}/3 and lists:keymap/3. | |
-include_lib("eunit/include/eunit.hrl"). |
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
%% Copyright © 2013 Pierre Fenoll ‹[email protected]› | |
%% See LICENSE for licensing information. | |
%% -*- coding: utf-8 -*- | |
-module(ifdef_in_fun). | |
%% 12:40 < stobix>| Grr... It would seem that I can't use ifdef directives inside function bodies. Any reason why, or is it just a design flaw? | |
%% 1> c(ifdef_in_fun). | |
%% ifdef_in_fun.erl:16: syntax error before: '-' | |
%% ifdef_in_fun.erl:18: syntax error before: '-' |
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(thear). | |
-export([simplify/1]). | |
-spec simplify (E) -> E when E::term(). | |
simplify (E) -> | |
S = fun | |
({add,E1,{num,0}}) -> | |
S(E1); |
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
# For rπ only: -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard | |
git clone [email protected]:ckolivas/cgminer.git cgminer.git | |
cd cgminer.git/ | |
git checkout v4.2.3 # The latest | |
./autogen.sh | |
CFLAGS="-O2 -Wall -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard" ./configure --enable-bflsc | |
CXXFLAGS="-O2 -Wall -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard" make | |
sudo ./cgminer -o stratum+tcp://eu-stratum.btcguild.com:3333 -u radioxid_monolith -p 123b |
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(propfolding). | |
-export([get/1]). | |
get (Doc) -> | |
{Stars, AreaID, CheckinDate, HotelID, Rooms} = | |
lists:foldl( | |
fun | |
({<<"stars">>, Stars}, Acc) -> setelement(1, Acc, Stars); | |
({<<"areaID">>, AreaID}, Acc) -> setelement(2, Acc, AreaID); | |
({<<"checkinDate">>, <<Year:4, $-, Month:2, $-, Day:2>>}, Acc) -> |
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
%% -*- coding: utf-8 -*- | |
-module(wat_clauses). | |
%% wat_clauses: | |
%% a warning should be emitted as 2nd clause will never match (given 1st clause) | |
-export([authenticate_nouns/1]). | |
%% API |
OlderNewer