Skip to content

Instantly share code, notes, and snippets.

-module(fmt_csv).
%% API
-export([row/1]).
row(Row) when is_tuple(Row) ->
row(tuple_to_list(Row));
row(Row) ->
[string:join([case Field of
null -> "";
@leonardb
leonardb / shq_atomics.erl
Created December 31, 2021 13:52
shq_atomics
-module(shq_atomics).
-export([init/1,
in/2,
in_r/2,
out/1,
out_r/1,
size/1,
test_in_out/1]).
@leonardb
leonardb / shq_ets_counters.erl
Created December 31, 2021 13:52
shq_ets_counters
-module(shq_ets_counters).
-export([init/1,
in/2,
in_r/2,
out/1,
out_r/1,
size/1,
test_in_out/1]).
%% Extract basic information from PEM
-module(pem_info).
-export([details/1]).
-include_lib("public_key/include/public_key.hrl").
details(Pem) ->
[{'Certificate',Cert,_}|_] = public_key:pem_decode(Pem),
@leonardb
leonardb / locus-corrupt-download-test
Created January 9, 2020 22:37
locus corrupt download test
Diff with io:format debugging
diff --git a/src/locus_http_download.erl b/src/locus_http_download.erl
index 222d6c5..39ac326 100644
--- a/src/locus_http_download.erl
+++ b/src/locus_http_download.erl
@@ -259,6 +259,7 @@ send_request(State)
Insecure = proplists:get_value(insecure, Opts, false),
@leonardb
leonardb / gist:7647fb11158b1d53a95dbffc079909ba
Created August 17, 2018 15:06
minimal_example_erlang_client
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team"
},