Skip to content

Instantly share code, notes, and snippets.

View 221V's full-sized avatar
🤔

Taras 221V

🤔
View GitHub Profile
@221V
221V / email.erl
Created May 9, 2021 17:45 — forked from seriyps/email.erl
Send emails using Erlang gen_smtp shortcut.
% 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),
@221V
221V / full_text_search_tarantool.lua
Created January 25, 2021 12:28 — forked from knazarov/full_text_search_tarantool.lua
Full text search example for Tarantool
#!/usr/bin/env tarantool
local pickle = require('pickle')
local yaml = require('yaml')
function trivec(str)
str = string.lower(str)
local vec = ""
@221V
221V / systemd.erl
Created October 4, 2019 22:00 — forked from maxlapshin/systemd.erl
Systemd support
-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]).
%% посмотреть во что компилится макрос
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).
-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").