Skip to content

Instantly share code, notes, and snippets.

View fenollp's full-sized avatar

Pierre Fenoll fenollp

View GitHub Profile
@fenollp
fenollp / grp.py
Last active August 29, 2015 14:27
list un-terminated logs by callid
#!/usr/bin/env python2
import re
import sys
fn = sys.argv[1]
lines = [line.rstrip('\n') for line in open(fn)]
def get_callid(line):
@fenollp
fenollp / Dialyzer false positive?
Created September 2, 2015 18:33
I don't get this warning
scanning "applications/omnipresence/ebin/omnip_sup.beam"
warn_behaviour omnip_sup.erl:58: The return type {'ok',{_,[{_,{atom() | tuple(),atom(),'undefined' | [any()]},'permanent' | 'temporary' | 'transient','brutal_kill' | 'infinity' | non_neg_integer(),'supervisor' | 'worker','dynamic' | [atom() | tuple()]}]}} in the specification of init/1 is not a subtype of 'ignore' | {'ok',{{'one_for_all',non_neg_integer(),non_neg_integer()} | {'one_for_one',non_neg_integer(),non_neg_integer()} | {'rest_for_one',non_neg_integer(),non_neg_integer()} | {'simple_one_for_one',non_neg_integer(),non_neg_integer()},[{_,{atom() | tuple(),atom(),'undefined' | [any()]},'permanent' | 'temporary' | 'transient','brutal_kill' | 'infinity' | non_neg_integer(),'supervisor' | 'worker','dynamic' | [atom() | tuple()]}]}}, which is the expected return type for the callback of supervisor behaviour
1 Dialyzer warnings
Somewhat easier to read:
{ok,{'_',[{'_',{atom,'|',tuple,atom,undefined,'|',[any]},
permanent
@fenollp
fenollp / _.xml
Created November 25, 2015 16:09
wh_util:get_xml_value/2
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<soap:Body>
<SearchTelephoneNumbersResponse xmlns='http://www.bandwidth.com'>
<SearchTelephoneNumbersResult>
<a>
text out
<mytext ishere="text in"/>
</a>
<TelephoneNumber id="1">
/(where|and|or)\s*([^\s=]*?)\s*(=|<>|>=|=<|>|<)\s*(\\"|")([^\4]*?)\4/g
MATCH_NUM,GROUP,START,END,VALUE
1,1,1231,1236,"where"
1,2,1237,1245,"pres_uri"
1,3,1245,1246,"="
1,4,1246,1247,""""
1,5,1247,1281,"sip:user_7z7b6s@teste.sip.90e9.com"
2,1,1283,1286,"and"
2,2,1287,1293,"callid"
@fenollp
fenollp / 1.txt
Created February 25, 2016 08:55
compiling kazoo 2915ccc7f00f2f9a0e0e8d37d5eef136e52f7853
$ git clone git@github.com:2600hz/kazoo.git && cd kazoo && git checkout 2915ccc7f00f2f9a0e0e8d37d5eef136e52f7853 && make
wget 'https://raw.githubusercontent.com/ninenines/erlang.mk/'2.0.0-pre.2'/erlang.mk' -O ./erlang.mk
mkdir deps
make -f erlang.mk deps
make[1]: Entering directory '/home/pete/kazoo'
git clone https://github.com/ninenines/erlang.mk .erlang.mk.build
if [ -f build.config ]; then cp build.config .erlang.mk.build; fi
cd .erlang.mk.build && make
make[2]: Entering directory '/home/pete/kazoo/.erlang.mk.build'
diff --git a/common_test/ct.html b/common_test/ct.html
index 8e53182..4687893 100644
--- a/common_test/ct.html
+++ b/common_test/ct.html
@@ -51,10 +51,7 @@
<item><p>Whatever added by <code>init_per_suite/1</code> or
<code>init_per_testcase/2</code> in the test suite.</p></item>
</list></div>
-<div id="types" class="category"><h4><a href="#types">Types</a></h4><hr/>
- <div class="type"><h3 id="type-handle">handle() = handle() (see module ct_gen_conn) | term()</h3></div>
%% Copyright © 2016 Pierre Fenoll ‹pierrefenoll@gmail.com›
%% See LICENSE for licensing information.
%% -*- coding: utf-8 -*-
-module(cmp_fun_v_func).
%% cmp_fun_v_func: compare calling a function vs calling a function applying a fun.
%% 44> G = fun (Fun, Times) -> lists:sum([T || _ <- lists:seq(1,Times), {T,_Ret} <- [timer:tc(cmp_fun_v_func, Fun, [Times])]]) / Times end.
%% #Fun<erl_eval.12.50752066>
%% 45> G(fn, 1000000). G(fnc, 1000000).
#!/bin/bash
#
url='http://hands.wtf/build/bundle.js'
matches=$(curl $url -s | grep -Eo ',([a-z0-9]{3}):' | sed 's/,//;s/://' | sort -u)
to_exclude='102 110 114 116 add arc map max min oss pan poo end fap fps get red set six src sub tan tos uas url uv2 dot fog'
exclude=''
for word in $to_exclude; do
@fenollp
fenollp / compile.log
Created August 20, 2016 01:00
rebar3 error erldocs_other
0 erldocs_other.git master (19.0) ∀ DEBUG=1 rebar3 compile
===> Expanded command sequence to be run: [{default,app_discovery},
{default,install_deps},
{default,lock},
{default,compile}]
===> Verifying dependencies...
===> Fetching erldocs ({git,"git://github.com/rebar/rebar.git",
{ref,
"1387a83e24eba0a794e9890c3351871a0fb7262e"}})
===> sh info:
@fenollp
fenollp / pp_stack_inside_try_catch.erl
Created August 23, 2017 21:04
Test printing ST with -Wall & OTP20
%% Copyright © 2017 Pierre Fenoll ‹pierrefenoll@gmail.com›
%% See LICENSE for licensing information.
%% -*- coding: utf-8 -*-
%% @module Test printing ST with -Wall & OTP20
-module(pp_stack_inside_try_catch).
-export([m/1]).