First I created 3 droplets on digital ocean with 4-cores and 8GB of RAM. Login as root to each and run:
sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
# for an example of a suggested `locals_without_parens`, see z_locals_without_parens.exs | |
# parsing and expanding a formatter.exs file would be a good route too | |
opts = [sourceror_opts: [locals_without_parens: [...], line_length: 122]] | |
for transformation <- [&PipeChainStart.run/1, &SinglePipe.run/1] do | |
ProjTraversal.transform("../my_codebase/", transformation, opts) | |
end |
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 |
# ATTENTION: This is now supported in plug_cowboy as of 2.1.0: | |
# https://hexdocs.pm/plug_cowboy/Plug.Cowboy.Drainer.html | |
defmodule DrainStop do | |
@moduledoc """ | |
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown | |
occurs. It first shuts down the acceptor, ensuring that no new requests can be | |
made. It then waits for all pending requests to complete. If the timeout | |
expires before this happens, it stops waiting, allowing the supervision tree | |
to continue its shutdown order. |
If someone forks a gist and you'd like to merge their changes. Do this:
clone your repo, I use the name of the gist
git clone git://gist.github.com/1163142.git gist-1163142
add a remote for the forked gist, I'm using the name of my fellow developer
git remote add aaron git://gist.github.com/1164196.git
// FizzBuzz solution with one comparison: | |
// Bitwise operations, using predefined 0-15 numbers mask | |
// live demo: http://jsfiddle.net/TbAuQ/ | |
// source: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient | |
var words = [undefined, "Fizz", "Buzz", "FizzBuzz"], | |
mask = 810092048, //11 00 00 01 00 10 01 00 00 01 10 00 01 00 00 | |
c = 0; |
Install makeself
:
apt-get install makeself
or
brew install makeself
@spec as_ast(%{ | |
body: binary, | |
declaration: bitstring, | |
documentation: bitstring, | |
elixir_module: %{documentation: bitstring, slug: bitstring}, | |
elixir_typespec: %{inputs: bitstring, return: bitstring}, | |
guards: binary, | |
inputs: bitstring, | |
name: bitstring, | |
slug: integer, |
defmodule C do | |
def decompile(module, lang \\ :erlang) | |
def decompile(module, lang) when is_atom(module) do | |
decompile(:code.which(module), lang) | |
end | |
def decompile('', _) do | |
# When we get this, it's because a module name was passed |