Skip to content

Instantly share code, notes, and snippets.

View lpgauth's full-sized avatar
😄
busy building cool stuff

Louis-Philippe Gauthier lpgauth

😄
busy building cool stuff
View GitHub Profile
-module(swirl_flow_generate).
-export([
compile_and_load/1,
test/0
]).
compile_and_load(Strings) ->
Forms = [begin
{ok, S, _} = erl_scan:string(String),
% swirl_flow 0.2
-spec map(stream_name(), event(), mapper_opts()) -> list(update()) | update() | ignore.
-spec reducer(flow(), row(), reducer_opts()) -> update() | ignore.
-spec output(flow(), period(), list(row()), output_opts() -> ok.
@lpgauth
lpgauth / gist:9833400
Created March 28, 2014 13:57
test.erl:15: variable '_Else' unsafe in 'case' (line 5)
-module(test).
-compile([export_all]).
test() ->
case true of
true ->
ok;
_Else ->
ok
end,
filelib:ensure_dir/1 is broken when there's a symlink in the path.
the offending commit:
https://github.com/erlang/otp/commit/f11aabdc9fec593c31e6c4f3fa25c1707e9c35df
e.g.
~ $ mkdir test
~ $ ln -s test test2
@lpgauth
lpgauth / gist:10c4d4f77ca532d294d1
Created June 27, 2014 16:31
Fix filelib:ensure_dir/1
--- lib/stdlib/src/filelib.erl 2014-06-27 12:18:40.000000000 -0400
+++ lib/stdlib/src/filelib.erl 2014-06-27 12:19:22.000000000 -0400
@@ -227,7 +227,7 @@
ok;
ensure_dir(F) ->
Dir = filename:dirname(F),
- case do_is_dir(Dir, file) of
+ case do_is_dir(Dir, directory) of
true ->
ok;
28: Client using the binary protocol
<28 Read binary protocol data:
<28 0x80 0x1d 0x00 0x04
<28 0x08 0x00 0x00 0x00
<28 0x00 0x00 0x00 0x0c
<28 0x00 0x00 0x00 0x01
<28 0x00 0x00 0x00 0x00
<28 0x00 0x00 0x00 0x00
>28 Writing an error: Invalid arguments
>28 Writing bin response:
=== Entering application hipe
ERLC ../ebin/hipe_rtl.beam
hipe_rtl.erl: internal error in native_compile;
crash reason: undef
in function hipe:compile/4
called as hipe:compile(hipe_rtl,[],
<<70,79,82,49,0,0,231,136,66,69,65,77,65,116,111,109,0,0,12,162,0,0,1,32,8,
104,105,112,101,95,114,116,108,6,109,107,95,114,116,108,3,114,116,108,7,114,
116,108,95,102,117,110,10,114,116,108,95,112,97,114,97,109,115,14,114,116,
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="4"
inherit git-2
DESCRIPTION="Erlang programming language, runtime environment, and large collection of libraries"
HOMEPAGE="http://www.erlang.org/"
@lpgauth
lpgauth / gist:2b3220f4bceeed6f62d0
Created July 18, 2014 18:11
HiPE lock contention
(rtb-gateway@h033.bloomdigital.com)9> lcnt:start(), lcnt:rt_opt({copy_save, true}), lcnt:clear(), timer:sleep(250), lcnt:collect(), lcnt:conflicts().
lock id #tries #collisions collisions [%] time [us] duration [%]
----- --- ------- ------------ --------------- ---------- -------------
hipe_mfait_lock 1 156537 156367 99.8914 2832642 1119.0905
pollset 1 5002 195 3.8984 17340 6.8505
drv_ev_state 16 6683 46 0.6883 2031 0.8024
timeofday 1 10206 301 2.9492 602 0.2378
run_queue 28 62350 107 0.1716 122 0.0482
timer_wheel 1 9350 123 1.3155 114 0.0450
proc_link 8902 21641 16 0.0739 91 0.0360
@lpgauth
lpgauth / gist:27e66f7a2104d8b5af74
Created July 25, 2014 15:42
erl_lock_count segfault
h033 / # gdb /usr/lib64/erlang/erts-6.1.2/bin/beam.smp core
GNU gdb (Gentoo 7.5 p1) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...