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'
const pombify = (phrase) => { | |
return phrase | |
.split(' ') | |
.map((word) => { | |
const wordLetters = word.split('') | |
return wordLetters | |
.map((letter, index) => { | |
const charCode = letter.charCodeAt(0); | |
const binary = charCode | |
.toString(2) |
/** Async pool | |
* Originally seen at https://github.com/rxaviers/async-pool/blob/master/lib/es6.js | |
* Simplified thanks to u/GSLint in | |
* https://www.reddit.com/r/learnjavascript/comments/gebobv/cant_grok_asyncpool_es6_code/ | |
*/ | |
/** Run asyncFunction array, poolSize at a time. */ | |
async function asyncPool (array, poolSize) { | |
const result = [] | |
const pool = [] |
defmodule Map.Helpers do | |
@moduledoc """ | |
Functions to transform maps | |
""" | |
@doc """ | |
Convert map string camelCase keys to underscore_keys | |
""" | |
def underscore_keys(nil), do: nil |
# This demonstrates that, when using async/await, a crash in the task will crash the caller | |
defmodule Tasker do | |
def good(message) do | |
IO.puts message | |
end | |
def bad(message) do | |
IO.puts message | |
raise "I'm BAD!" | |
end |
$ ssh <mydomain.com>
$ dokku apps:create
I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.
As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin
and add the following group to the file /etc/cgconfig.conf
:
group browsers {
cpu {
# Set the relative share of CPU resources equal to 25%
cpu.shares = "256";
}
sudo apt-get install build-essential libncurses5-dev openssl libssl-dev | |
wget http://erlang.org/download/otp_src_R15B01.tar.gz | |
tar zxvf otp_src_R15B01.tar.gz | |
cd otp_src_R15B01 | |
./configure && make && sudo make install | |
http://docs.basho.com/riak/latest/tutorials/installation/Installing-Erlang/#Installing-on-GNU-Linux | |
https://sites.google.com/site/comptekkia/erlang/how-to-install-erlang-on-ubuntu-10-10 |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |