Skip to content

Instantly share code, notes, and snippets.

@mururu
mururu / extract_public_key.erl
Created June 25, 2015 04:45
extract_public_key.erl
-include_lib("public_key/include/public_key.hrl").
extract_public_key(CertPath)
{ok, CertBinary} = file:read_file(CertPath),
CertPemEntries = public_key:pem_decode(CertBinary),
{'Certificate', Cert, _} = lists:keyfind('Certificate', 1, CertPemEntries),
#'OTPCertificate'{
tbsCertificate = #'OTPTBSCertificate'{
subjectPublicKeyInfo = #'OTPSubjectPublicKeyInfo'{
subjectPublicKey = PublicKey
diff --git ebin/rebar.app ebin/rebar.app
index 710f8b2..b683ffb 100644
--- ebin/rebar.app
+++ ebin/rebar.app
@@ -46,7 +46,8 @@
rebar_metacmds,
rebar_getopt,
rebar_mustache,
- rmemo ]},
+ rmemo,

Checked plugins

built-in

  • in_debug_agent

  • in_dummy

  • in_exec

@mururu
mururu / RESULTS.md
Created November 10, 2015 04:45
Micro benchmark of EVP for AES-CTR in Erlang/OTP

no-EVP

1> c(bench3).
{ok,bench3}
2> bench3:run().
encrypt: 65230 times/sec
decrypt: 67715 times/sec
ok
-module(fifocache).
-export([new/1, push/3, lookup/2]).
%%-----------------------------------------
%% FIFO cache
%%
%% - Representation
%%
%% {Map, Array, Size, Bottom, Top, NewFlag}
@mururu
mururu / ca_cowboy_middleware.erl
Last active March 28, 2018 08:05 — forked from sebmaynard/ca_cowboy_middleware.erl
[For Cowboy 2.0] A Cowboy middleware to set some CORS headers for every request, and to handle OPTIONS requests without needing to implement them in every handler.
-module(ca_cowboy_middleware).
-behaviour(cowboy_middleware).
-export([execute/2]).
execute(Req, Env) ->
{ok, ReqWithCorsHeaders} = set_cors_headers(Req),
Method = cowboy_req:method(ReqWithCorsHeaders),
@mururu
mururu / 無題.md
Last active August 3, 2018 03:16
無題

ちょっと前の話ですが、トレジャーデータという会社を辞めました。えぐいほどいい会社だし、全世界のIoTデータをさばくやつを作るのは技術者として死ぬほど楽しいんだろうなと思ったけど、僕はあるスタートアップに行くことにしました。

カンムという会社です。よろしくお願いします。

for p in $(ps -aux | grep -v grep | awk {'print $2'}); do
x=$(ls -l "/proc/${p}/exe")
if [ $?=0 ]; then
y=$(echo $x | awk {'print $11'})
echo $y
ldd $y
fi
done