Skip to content

Instantly share code, notes, and snippets.

View CrowdHailer's full-sized avatar

Peter Saxton CrowdHailer

View GitHub Profile
@CrowdHailer
CrowdHailer / lib.rs
Created December 17, 2018 20:53
actors.rs
mod actor {
extern crate typemap;
#[derive(Debug)]
pub struct Envelop<For: Actor> {
// TODO make fields private
pub address: For::Id,
pub message: For::Message
}
@CrowdHailer
CrowdHailer / sign.js
Last active May 29, 2023 06:19
Web crypto to erlang/Elixir
// NEEDS TO RUN IN SECURE (HTTPS) CONTEXT.
async function run() {
// New key pair
var keyPair = await window.crypto.subtle.generateKey(
{
name: "ECDSA",
namedCurve: "P-521"
},
true,
["sign", "verify"]
pub type Worker(m) {
Pid
}
pub type WorkerMessage(m) {
Down
Message(m)
}
pub type Worker(m) {
./_build/default/rel/hello_world/bin/hello_world console
Exec: /usr/local/lib/erlang/erts-10.7.1/bin/erlexec -boot /opt/app/_build/default/rel/hello_world/releases/0.1.0/hello_world -mode embedded -boot_var ERTS_LIB_DIR /usr/local/lib/erlang/lib -config /opt/app/_build/default/rel/hello_world/releases/0.1.0/sys.config -args_file /opt/app/_build/default/rel/hello_world/releases/0.1.0/vm.args -- console
Root: /opt/app/_build/default/rel/hello_world
/opt/app/_build/default/rel/hello_world
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:30] [hipe]
=CRASH REPORT==== 3-May-2020::13:00:58.045666 ===
crasher:
initial call: application_master:init/4
pid: <0.327.0>
@CrowdHailer
CrowdHailer / experiments.rs
Created May 6, 2020 14:02
Trying to make a type safe parser
import gleam/should
pub type Parser(r) {
Pop(Parser(fn(String) -> r))
End(r)
}
fn apply(parser: Parser(fn(String) -> r), value: String) -> Parser(r) {
// fn apply(parser) {
case parser {