Skip to content

Instantly share code, notes, and snippets.

Originally from: http://erlang.org/pipermail/erlang-questions/2017-August/093170.html
For a safe and fast Erlang SSL server, there's a few
configuration values you might want by default:
[{ciphers, CipherList}, % see below
{honor_cipher_order, true}, % pick the server-defined order of ciphers
{secure_renegotiate, true}, % prevent renegotiation hijacks
{client_renegotiation, false}, % prevent clients DoSing w/ renegs
{versions, ['tlsv1.2', 'tlsv1.1']}, % add tlsv1 if you must
@djo
djo / run.sh
Last active January 27, 2020 04:35
Handling of UNIX-signals in Erlang/Elixir is not supported, this script provides start-stop management with handling TERM signal for Docker installation.
#!/usr/bin/env bash
set -x
term_handler() {
echo "Stopping the server process with PID $PID"
erl -noshell -name "term@127.0.0.1" -eval "rpc:call('app@127.0.0.1', init, stop, [])" -s init stop
echo "Stopped"
}
trap 'term_handler' TERM INT
@rubencaro
rubencaro / gist:9545060
Last active May 7, 2020 20:59
Reversible encryption for url json data
require 'openssl'
require 'digest/sha1'
require 'base64'
require 'json'
def go_demo!
key = Digest::SHA1.hexdigest("clave1")[0..15] # 16bytes => 128bits
iv = 'clave2 con chicha'[0..15] # 16bytes forced
data = { esto: 'es', un: 'hash', en: 'ruby' }