$ ssh <mydomain.com>
$ dokku apps:create
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
-- 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%' |
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
/** 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 = [] |
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
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) |
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";
}
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
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 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
# 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 |
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
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 |