This file contains 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
% Send plaintext email using gen_smtp https://github.com/Vagabond/gen_smtp | |
% This function sends email directly to receiver's SMTP server and don't use MTA relays. | |
% | |
% Example plaintext email: | |
% Mail = mail_plain(<<"Bob <sender@example.com>">>, <<"Alice <receiver@example.com>">>, <<"The mail subject">>, <<"The mail body">>), | |
% send_email(Mail). | |
% | |
% Example email with image attachment: | |
% ImgName = "image.jpg", | |
% {ok, ImgBin} = file:read_file(ImgName), |
This file contains 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
#!/usr/bin/env tarantool | |
local pickle = require('pickle') | |
local yaml = require('yaml') | |
function trivec(str) | |
str = string.lower(str) | |
local vec = "" |
This file contains 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(systemd). | |
% This is what you need to adopt systemd in erlang | |
% | |
% Do whatever you want license. If you want, you can take this code under terms of MIT license. | |
-export([ready/0, reloading/0, stopping/0, watchdog/0]). | |
-export([start_link/0]). | |
-export([init/1, handle_info/2, terminate/2]). |
This file contains 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
%% посмотреть во что компилится макрос | |
iex(14)> defmodule T do | |
...(14)> def f(fun, arg), do: apply(String, :"#{fun}", [arg]) | |
...(14)> end |> elem(2) |> :beam_lib.chunks([:abstract_code]) |> elem(1) |> elem(1) |> get_in([:abstract_code]) |> elem(1) |> :erl_syntax.form_list |> :erl_prettypr.format |> IO.puts | |
warning: redefining module T (current version defined in memory) | |
iex:14 | |
-file("iex", 14). |
This file contains 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(tpecdsa). | |
-export([generate_priv/0,minify/1,calc_pub/2,sign/2,verify/3]). | |
-export([secp256k1_ecdsa_sign/4, | |
secp256k1_ecdsa_verify/3, | |
secp256k1_ec_pubkey_create/2, | |
secp256k1_ec_pubkey_create/1 | |
]). | |
-ifdef(TEST). | |
-include_lib("eunit/include/eunit.hrl"). |