Skip to content

Instantly share code, notes, and snippets.

@zhelezoglo
zhelezoglo / start_sandbox.sh
Created March 10, 2017 08:34
start hdp sandbox
#!/bin/bash
echo "Waiting for docker daemon to start up:"
until /usr/bin/docker ps 2>&1| grep STATUS>/dev/null; do sleep 1; done; >/dev/null
/usr/bin/docker ps -a | grep sandbox
if [ $? -eq 0 ]; then
/usr/bin/docker start sandbox
else
docker run -v hadoop:/hadoop --name sandbox --hostname "sandbox.hortonworks.com" --privileged -d \
-p 6080:6080 \
-p 9090:9090 \

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@zhelezoglo
zhelezoglo / gist:c6078587d733ea24527cfa7cc6196203
Created August 9, 2016 08:50 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@zhelezoglo
zhelezoglo / latency.txt
Created August 7, 2016 11:59 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
@zhelezoglo
zhelezoglo / gist:887bd5cb2a43040f4011
Created February 27, 2016 08:05 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
val n = 5
val ss: Seq[String] = 0 to math.pow(2, n).toInt - 1 map((x: Int) => x.toBinaryString)
ss.map(String.format(s"%${n}s", _).replace(' ', '0')).foreach(println)
import java.security.MessageDigest;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.swing.JOptionPane;
import javax.xml.bind.DatatypeConverter;
import javax.crypto.IllegalBlockSizeException;

##Reactive System Design Links

#Articles and Papers

public class AdministrationEmployee extends Employee {
public AdministrationEmployee(String name) {
super(name, Employee.TEMPORARY, 0, "Administration");
}
public double getSalary() {
return 18000;
}
find . -name target -type d -exec rm -rf {} \;