Skip to content

Instantly share code, notes, and snippets.

View ympons's full-sized avatar
🚀
-> 🆓| 🇨🇺| 👨‍💻

Yaismel Miranda ympons

🚀
-> 🆓| 🇨🇺| 👨‍💻
View GitHub Profile
@ympons
ympons / axiosInterceptor.js
Created February 7, 2020 19:00 — forked from nzvtrk/axiosInterceptor.js
Axios create/recreate cookie session in node.js enviroment
/* 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 });
@ympons
ympons / latency.txt
Created October 30, 2019 04:37 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
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
@ympons
ympons / keybase.md
Last active September 14, 2017 02:40

Keybase proof

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:

@ympons
ympons / quicksort2.go
Created March 2, 2017 01:27
Another QuickSort implementation in Golang
package main
import (
"fmt"
"sort"
)
func quickSort(a sort.Interface, left, right int) {
if left >= right {
return
@ympons
ympons / quicksort1.go
Created March 2, 2017 01:20
Simple QuickSort implementation in Golang #1
package main
import (
"fmt"
"sort"
)
func quicksort(a sort.Interface, i, j int) {
if j > i {
left, right := i, j
@ympons
ympons / quicksort.ex
Created January 30, 2017 07:04
Simple QuickSort implementation in Elixir
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
@ympons
ympons / install-elixir-prod-ready.sh
Last active February 7, 2017 18:27
Install Elixir on Ubuntu box (Ubuntu 12.04/14.04/16.04)
#!/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
@ympons
ympons / aws_initial.png
Last active November 8, 2016 21:46
Starting with AWS
aws_initial.png
@ympons
ympons / install-erlang-and-elixir.sh
Last active November 20, 2018 16:15
Install Erlang 19.1 & Elixir 1.3.4 on Ubuntu box (tested on 14.04)
#!/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"
@ympons
ympons / README.md
Created October 28, 2016 03:31 — forked from joakimk/README.md
CircleCI elixir build example

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.