This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(kvl). | |
-export([from_list/1]). | |
from_list(KVs) -> | |
from_list(KVs, #{}). | |
from_list([K, V | KVs], Acc) -> | |
from_list(KVs, Acc#{K => V}); | |
from_list([], Acc) -> | |
Acc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRESENTATION := cat-feeder-architecture | |
all: $(PRESENTATION).html | |
SVGS = $(patsubst %.d2,%.svg,$(wildcard *.d2)) | |
SVGS += $(patsubst %.mmd,%.svg,$(wildcard *.mmd)) | |
# brew install marp-cli | |
MARP := marp | |
%.html: %.md $(SVGS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(x509). | |
-export([ | |
create_private_key/0, | |
private_key_to_pem/1, | |
create_request/2, | |
request_to_pem/1 | |
]). | |
-include_lib("public_key/include/public_key.hrl"). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_dot(pid, path) do | |
# Starting with the given process, find all of the processes that it's linked to/from, and that it's monitoring/monitored; put them in the dot file. | |
f = File.open!(path, [:write]) | |
IO.write(f, "digraph G {\n") | |
IO.write(f, "concentrate=true") | |
seen = MapSet.new() | |
to_dot(pid, f, seen) | |
IO.write(f, "}\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
re = ~r/^.*([0-9][0-9]) .*$/U | |
files = Path.wildcard("**/*.mp3") |> Enum.filter(&Regex.match?(re, &1)) | |
groups = files |> | |
Enum.group_by(fn f -> | |
d = Path.dirname(f) | |
f = Path.basename(f) | |
[_, n] = Regex.run(re, f) | |
{d, n} | |
end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(assert_timers). | |
-export([start_trace/0, stop_trace/0]). | |
-export([no_timers/1, has_timer/1]). | |
%% @doc use a dbg handler to track active timers; see http://stackoverflow.com/a/4059587/8446 | |
start_trace() -> | |
ets:new(timer_trace, [public, named_table, bag]), | |
Fun = fun({'trace', Pid, 'call', {erlang, send_after, [Time, Dest, Msg]}} = _Msg, State) -> | |
lager:debug("~p erlang:send_after(~p, ~p, ~p)", [Pid, Time, Dest, Msg]), | |
State; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CoenraadS.bracket-pair-colorizer | |
vscode-icons-team.vscode-icons | |
ms-vscode.cpptools | |
pgourlain.erlang | |
JakeBecker.elixir-ls | |
rust-lang.rust | |
serayuzgur.crates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'find' | |
VERBOSE = false | |
mp3_files = [] | |
Find.find('.') do |f| | |
if File.extname(f) == '.flac' | |
flac = f | |
mp3 = "../Music/#{File.dirname(flac)}/#{File.basename(flac, '.flac')}.mp3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## On the server | |
# AWS EC2 | |
SERVER_IP=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) | |
# Digital Ocean | |
SERVER_IP=$(curl http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address) | |
# Generate a self-signed server certificate | |
openssl genrsa -out server.key 4096 |
NewerOlder