Skip to content

Instantly share code, notes, and snippets.

🌊

Alexandre Moreno moleike

🌊
Block or report user

Report or block moleike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@moleike
moleike / arch-linux-install
Created Jul 11, 2017 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
View arch-linux-install
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@moleike
moleike / promise-monad-proof.js
Created Apr 28, 2017 — forked from briancavalier/promise-monad-proof.js
A proof that Promises/A is a Monad
View promise-monad-proof.js
//-------------------------------------------------------------
//
// Hypothesis:
//
// Promises/A is a Monad
//
// To be a Monad, it must provide at least:
// - A unit (aka return or mreturn) operation that creates a corresponding
// monadic value from a non-monadic value.
// - A bind operation that applies a function to a monadic value
@moleike
moleike / ocaml_lwt_sample.ml
Created Apr 20, 2017 — forked from mjambon/ocaml_lwt_sample.ml
OCaml/Lwt crash course. Adult supervision recommended.
View ocaml_lwt_sample.ml
(*
Interactive approach
--------------------
You can copy-paste code into `utop`, provided you load the lwt.unix
package:
#use "topfind";;
#require "lwt.unix";;
@moleike
moleike / README.md
Created Mar 8, 2017 — forked from joyrexus/README.md
Node.js streams demystified
View README.md

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

@moleike
moleike / closest.hs
Last active Mar 22, 2017
Algorithms in Haskell
View closest.hs
import Data.List
type Point a = (a,a)
distance :: Floating a => Point a -> Point a -> a
distance (a,b) (c,d) = sqrt ((a-c)^ 2 + (b-d)^ 2)
min_distance_naive :: (Ord a, Floating a) => [Point a] -> a
min_distance_naive = foldr1 min . loop
where
View quicksort.hs
-- randomized quick sort with 3-way partition
module QuickSort (quicksort) where
import Data.Array.ST
import Control.Monad
import Control.Monad.ST
import System.Random
type QA s = STUArray s Int Int
swap :: Int -> Int -> QA s -> ST s ()
@moleike
moleike / latency.markdown
Created Oct 9, 2016 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
@moleike
moleike / pearcy.py
Created Sep 24, 2016 — forked from anonymous/pearcy.py
Compute and plot Pearcey integral
View pearcy.py
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as integrate
# Dimension of image in pixels
N = 256
# Number of samples to use for integration
M = 32
View parseAttributes.js
const parseAttributes = payload => payload
.split(',')
.map(pair => pair.split('='))
.filter(pair => pair.length === 2)
.map(([key,val]) => ({ [key]: val }))
// > parseAttributes('pmin=5,pmax=40')
// [ { pmin: '5' }, { pmax: '40' } ]
You can’t perform that action at this time.