Skip to content

Instantly share code, notes, and snippets.

import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import akka.cluster.singleton.{
ClusterSingletonManager,
ClusterSingletonManagerSettings,
ClusterSingletonProxy,
ClusterSingletonProxySettings
}
import com.typesafe.config.{ConfigFactory, ConfigValueFactory}
import com.typesafe.scalalogging.LazyLogging
@fhuertas
fhuertas / parse_yaml.sh
Created January 19, 2018 10:43 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@fhuertas
fhuertas / dummy-web-server.py
Last active January 2, 2018 15:46 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost

Build the following and make it run as fast as you possibly can using Python 3 (vanilla). The faster it runs, the more you will impress us!

Your code should:

All of that in the most efficient way you can come up with.

@fhuertas
fhuertas / echo.py
Created June 30, 2016 12:45 — forked from benburry/echo.py
Python 2 - mock & unittest example for Popen
from subprocess import Popen, PIPE
def shell_out(command):
return Popen(command.split(' '), stdout=PIPE,stderr=PIPE).communicate()[0].strip('\n').split('\n')
def main():
return shell_out('echo one\ntwo\nthree\n')