Skip to content

Instantly share code, notes, and snippets.

View nox's full-sized avatar
🥖

Anthony Ramine nox

🥖
View GitHub Profile
@nox
nox / gist:4031472
Created November 7, 2012 13:02
Erlang's lists BIFs
$ grep 'bif lists:' erts/emulator/beam/bif.tab
bif lists:member/2
bif lists:reverse/2
bif lists:keymember/3
bif lists:keysearch/3
bif lists:keyfind/3
@nox
nox / gist:3981420
Created October 30, 2012 16:43
wtf is sofs useful for
1> ParentChildRel = sofs:relation([{michel,gertrude},{robert,mickael},{brigitte,gertrude},{brigitte,sophia}], [{parent, child}]).
{'Set',[{brigitte,gertrude},
{brigitte,sophia},
{michel,gertrude},
{robert,mickael}],
{parent,child}}
2> ParentChildrenRel = sofs:relation_to_family(ParentChildRel).
{'Set',[{brigitte,[gertrude,sophia]},
{michel,[gertrude]},
{robert,[mickael]}],
@nox
nox / dre.erl
Created October 22, 2012 07:27
-module(dre).
-compile(export_all).
-type re() :: empty
| eps
| {char,Value::char()}
| {cat,Left::re(),Right::re()}
| {alt,This::re(),That::re()}
| {rep,InnerRE::re()}.
nox@Shinkirou:~/src/otp[erl_parse-range=]$ cat blah.erl
-module(blah).
blah() -> ?LINE.
nox@Shinkirou:~/src/otp[erl_parse-range=]$ bin/erl
Erlang R15B02 (erts-5.9.2) [source] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.2 (abort with ^G)
1> epp:parse_file("blah.erl", {1,1}, [], [], [range]).
{ok,[{attribute,1,file,{"blah.erl",1}},
{attribute,[{column,2},
nox@Shinkirou:~$ cat blah.erl
-module(blah).
-compile(export_all).
-compile({inline, get/2}).
answer() ->
get(answer, [{<<"answer">>, 42}]).
get(Key, List) ->
proplists:get_value(list_to_binary(atom_to_list(Key)), List).
$ cat blah.erl
-module(blah).
-compile(export_all).
blah() -> 42;
foo(X) -> {bar, X}.
$ bin/erlc blah.erl
blah.erl:5:1: head mismatch
foo.erl:2:6: Warning: variable 'UnusedVar' is unused
foo( UnusedVar ) -> bar.
^~~~~~~~~
_UnusedVar
brew install sl >&/dev/null; echo alias ls=sl >>~/.bash_profile && tput cuu1 && tput el && history -d $(history | tail -n 1 | awk '{print $1}')
@nox
nox / gettext-0.18.1.1-js.patch
Last active October 2, 2015 20:57
Gettext support for Javascript
diff --git c/gettext-tools/libgettextpo/Makefile.am w/gettext-tools/libgettextpo/Makefile.am
index a96c36d..245f333 100644
--- c/gettext-tools/libgettextpo/Makefile.am
+++ w/gettext-tools/libgettextpo/Makefile.am
@@ -70,6 +70,7 @@ libgettextpo_la_AUXSOURCES = \
../src/format-librep.c \
../src/format-scheme.c \
../src/format-java.c \
+ ../src/format-javascript.c \
../src/format-csharp.c \
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index 9296075..70c18db 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -137,7 +137,9 @@ for remove in DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
Xa xstrconst "xc99=none" AC99 \
- unroll2 ip mp restrict
+ unroll2 ip mp restrict \