I hereby claim:
- I am ympons on github.
- I am ympons (https://keybase.io/ympons) on keybase.
- I have a public key whose fingerprint is E701 1B92 3502 AB0B 36E8 F35F AB70 C3D3 9F67 6D2B
To claim this, I am signing this object:
/* Basic example of save cookie using axios in node.js and recreate session if it expired. | |
* Get/save cookie manually cause WithCredential axios param use XHR and not work in node.js | |
* Supports parallel request and send only one create session request. | |
* */ | |
const BASE_URL = "https://google.com"; | |
// Init instance of axios which works with BASE_URL | |
const axiosInstance = axios.create({ baseURL: BASE_URL }); |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
I hereby claim:
To claim this, I am signing this object:
package main | |
import ( | |
"fmt" | |
"sort" | |
) | |
func quickSort(a sort.Interface, left, right int) { | |
if left >= right { | |
return |
package main | |
import ( | |
"fmt" | |
"sort" | |
) | |
func quicksort(a sort.Interface, i, j int) { | |
if j > i { | |
left, right := i, j |
defmodule QuickSort do | |
def sort([]), do: [] | |
def sort([head|tail]) do | |
{l, r} = Enum.partition(tail, &(&1 > head)) | |
sort(l) ++ [head] ++ sort(r) | |
end | |
end | |
a = QuickSort.sort([3, 1, 2, 5]) | |
IO.inspect a |
#!/bin/bash | |
# Install Erlang & Elixir on Ubuntu box (production ready) | |
# Install erlang and elixir | |
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb | |
sudo apt-get update -y | |
sudo apt-get install -y esl-erlang elixir erlang | |
# Install git and nginx | |
sudo apt-get install -y git nginx |
#!/bin/bash | |
# Install Erlang 19.1 & Elixir 1.3.4 on Ubuntu box (tested on 14.04) | |
# | |
# sudo apt-get update | |
# sudo apt-get -y install build-essential libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev | |
set -e | |
export ERLANG_VERSION="19.1" | |
export ELIXIR_VERSION="v1.3.4" |
This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.
We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.
It should be generic enough to work on any elixir app using mix.
If you have a elixir_buildpack.config
, then enable that section in the build script to keep versions in sync!
2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.