(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # see https://github.com/postrank-labs/goliath/wiki/HAProxy | |
| global | |
| pidfile /var/run/haproxy.pid | |
| log 127.0.0.1 local0 info | |
| maxconn 64000 | |
| defaults | |
| clitimeout 60000 # maximum inactivity time on the client side | |
| srvtimeout 60000 # maximum inactivity time on the server side |
| ... | |
| # Fake a fuse install | |
| RUN apt-get install libfuse2 | |
| RUN cd /tmp ; apt-get download fuse | |
| RUN cd /tmp ; dpkg-deb -x fuse_* . | |
| RUN cd /tmp ; dpkg-deb -e fuse_* | |
| RUN cd /tmp ; rm fuse_*.deb | |
| RUN cd /tmp ; echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst | |
| RUN cd /tmp ; dpkg-deb -b . /fuse.deb |
| # commands to ignore | |
| cmdignore=(htop tmux top vim) | |
| # end and compare timer, notify-send if needed | |
| function notifyosd-precmd() { | |
| retval=$? | |
| if [[ ${cmdignore[(r)$cmd_basename]} == $cmd_basename ]]; then | |
| return | |
| else | |
| if [ ! -z "$cmd" ]; then |
| #!/usr/bin/env bash | |
| # Formatting constants | |
| export BOLD=`tput bold` | |
| export UNDERLINE_ON=`tput smul` | |
| export UNDERLINE_OFF=`tput rmul` | |
| export TEXT_BLACK=`tput setaf 0` | |
| export TEXT_RED=`tput setaf 1` | |
| export TEXT_GREEN=`tput setaf 2` | |
| export TEXT_YELLOW=`tput setaf 3` |
| /** | |
| * "Select" off the first future to be satisfied. Return this as a | |
| * result, with the remainder of the Futures as a sequence. | |
| * | |
| * @param fs a scala.collection.Seq | |
| */ | |
| def select[A](fs: Seq[Future[A]])(implicit ec: ExecutionContext): Future[(Try[A], Seq[Future[A]])] = { | |
| @tailrec | |
| def stripe(p: Promise[(Try[A], Seq[Future[A]])], | |
| heads: Seq[Future[A]], |
| trait PostStart { actor: Actor => | |
| def postStart: Unit | |
| override def preStart { | |
| actor.become { | |
| case "PostStart" => try { postStart } finally { actor.unbecome } | |
| } | |
| actor.self ! "PostStart" | |
| } | |
| } |