Skip to content

Instantly share code, notes, and snippets.

View moleike's full-sized avatar
🤘
dare to think for yourself

Alexandre Moreno moleike

🤘
dare to think for yourself
View GitHub Profile
@moleike
moleike / closest.hs
Last active March 22, 2017 08:51
Algorithms in Haskell
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
@moleike
moleike / README.md
Created March 8, 2017 06:06 — forked from joyrexus/README.md
Node.js streams demystified

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 / ocaml_lwt_sample.ml
Created April 20, 2017 05:43 — forked from mjambon/ocaml_lwt_sample.ml
OCaml/Lwt crash course. Adult supervision recommended.
(*
Interactive approach
--------------------
You can copy-paste code into `utop`, provided you load the lwt.unix
package:
#use "topfind";;
#require "lwt.unix";;
@moleike
moleike / promise-monad-proof.js
Created April 28, 2017 10:43 — forked from briancavalier/promise-monad-proof.js
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// 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 / arch-linux-install
Created July 11, 2017 08:02 — 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
# 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
const net = require('net');
const server = net.createServer((c) => {
// 'connection' listener
console.log('client connected');
c.on('end', () => {
console.log('client disconnected');
});
c.write('hello');
c.pipe(c);
@moleike
moleike / 00_input.conf
Created August 31, 2017 07:16 — forked from steveash/00_input.conf
ELK configuration for aggregating cassandra and spark logs
input {
lumberjack {
# The port to listen on
port => 5043
# The paths to your ssl cert and key
ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder/logstash-forwarder.crt"
ssl_key => "/etc/pki/tls/private/logstash-forwarder/logstash-forwarder.key"
# default type, but this will already be set by logstash-forwarder anyways
@moleike
moleike / memory_layout.md
Created January 14, 2018 16:59 — forked from CMCDragonkai/memory_layout.md
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@moleike
moleike / Makefile
Created March 2, 2018 00:45 — forked from llj098/Makefile
a sample tcp server runs in kernel
obj-m += tcp_svr_sample.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea