https://github.com/bryanjos/joken - A JSON Web Token (JWT) Library
token = %{user_id: 123}
|> Joken.token()
|> Joken.with_signer(Joken.hs256("my_secret_key"))
|> Joken.sign()
|> Joken.get_compact()
‽Erlang/OTP 19 [erts-8.3] [64-bit] [smp:8:8] [async-threads:10] | |
Interactive Elixir (1.4.4) - press Ctrl+C to exit (type h() ENTER for help) | |
iex(1)> c("tst_gen.ex") | |
[TstGen] | |
iex(2)> | |
nil | |
iex(3)> {:ok, pid} = TstGen.start_link | |
{:ok, #PID<0.88.0>} | |
iex(4)> |
iex(4)> | |
18:04:13.683 [error] GenServer #PID<0.355.0> terminating | |
** (stop) %DBConnection.ConnectionError{message: "tcp async recv: closed"} | |
Last message: {:tcp_closed, #Port<0.6368>} | |
State: %Postgrex.Notifications{listener_channels: %{"event" => %{#Reference<0.2125033689.3245080577.170420> => #PID<0.354.0>}}, listeners: %{#Reference<0.2125033689.3245080577.170420> => {"event", #PID<0.354.0>}}, parameters: nil, protocol: %Postgrex.Protocol{buffer: :active_once, connection_id: 30, connection_key: -507502396, null: nil, parameters: #Reference<0.2125033689.3245080577.170419>, peer: {{127, 0, 0, 1}, 5432}, postgres: :idle, queries: nil, sock: {:gen_tcp, #Port<0.6368>}, timeout: 15000, transactions: :naive, types: nil}} | |
18:04:13.683 [error] GenServer #PID<0.758.0> terminating | |
** (stop) %DBConnection.ConnectionError{message: "tcp recv: closed"} | |
Last message: nil | |
State: [types: Postgrex.DefaultTypes, database: "postgres", username: "postgres", password: "password", hostname: "127.0.0.1", port: 5432] |
https://github.com/bryanjos/joken - A JSON Web Token (JWT) Library
token = %{user_id: 123}
|> Joken.token()
|> Joken.with_signer(Joken.hs256("my_secret_key"))
|> Joken.sign()
|> Joken.get_compact()
Сделал модуль | |
defmodule Tm do | |
def test(x) do | |
x + 1 | |
end | |
end | |
запуск ноды iex --sname ui | |
второй ноды на том же хосте iex --sname ui2 |
$ cat test.ex | |
defmodule Test do | |
def test_case(foo) do | |
case foo do | |
:bar -> true | |
:buz -> false | |
end | |
end | |
def test_cond(foo) do |
The intention of this post is to provide a solution (with examples) to a somewhat uncommon issue in Erlang. I hate searching for answers to the same problems over and over, and I had a hard time finding answers to this particular problem, so I wrote it all down once I figured it out. If one day you decide to read and write data through fifo's (named pipes) and then decide you want to read or write the other end of the pipe from Erlang, this post is for you.
I wanted to read and write to a fifo from a C/C++ app and have an Erlang app communicate over the other end of that fifo. Put simply, Erlang doesn't really support what I was trying to do. You cannot just file:open/2
a fifo, or any special device for that matter, in Erlang and expect it to work. This is documented in Erlang's FAQ.
mnesia | |
https://stackoverflow.com/questions/421501/what-is-the-storage-capacity-of-a-mnesia-database?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa | |
http://igorrs.blogspot.ru/2010/05/mnesia-one-year-later.html | |
http://igorrs.blogspot.ru/2010/05/mnesia-one-year-later-part-2.html | |
http://igorrs.blogspot.ru/2010/05/mnesia-one-year-later-part-3.html | |
http://igorrs.blogspot.com/2009/11/consistent-hashing-for-mnesia-fragments.html | |
http://igorrs.blogspot.com/2009/11/consistent-hashing-for-mnesia-fragments_19.html | |
https://streamhacker.com/2008/12/10/how-to-eliminate-mnesia-overload-events/ | |
http://noss.github.io/2009/04/04/mnesia-sucks-not.html | |
http://erlang.org/doc/apps/mnesia/mnesia.pdf |
defmodule Benum do | |
defimpl Enumerable, for: BitString do | |
def count(collection) when is_binary(collection) do | |
{:ok, Enum.reduce(collection, 0, fn v, acc -> acc + 1 end)} | |
end | |
def count(collection) do | |
{:error, __MODULE__} | |
end | |
def member?(collection, value) when is_binary(collection) do | |
{:ok, Enum.any?(collection, fn v -> value == v end)} |
mkdir 'Осваиваем Zynq' | |
cd 'Осваиваем Zynq' | |
youtube-dl -f best -ciw -o "%(title)s.%(ext)s" -i PLWMg96mLREOekNVh8-3U5JZv2NTCLMbP5 | |
cd .. | |
mkdir 'Boards review' | |
cd 'Boards review' | |
youtube-dl -f best -ciw -o "%(title)s.%(ext)s" -i PLWMg96mLREOcCO5xT3gnr111e-6gKAc-E | |
cd .. |
https://gist.github.com/tkurtbond/b629cdff2d70e31b0e1527f1ead14462 | |
https://gforth.org/manual/Gforth-structs.html | |
\ sllist-less-comments.fs - Реализация односвязного списка в forth с использованием структур gforth, и немного комментариев. | |
struct | |
cell% field node-text \ address of counted string - адрес строки | |
cell% field node-next \ address of next node - адрес следующей ноды. | |
end-struct node% |