systemctl start sshd
passwd
ip addr
From this point on, SSH into the (dhcp-assigned) IP - it makes it easier to copy/paste
Phase 1: Prepare System
import akka.dispatch.{ExecutionContext, Future, Promise} | |
import collection.generic.CanBuildFrom | |
def linearise[T, U, C[T] <: Traversable[T]](s: C[T])(f: T => Future[U])(implicit cbf: CanBuildFrom[C[T], Future[U], C[Future[U]]], e: ExecutionContext): C[Future[U]] = { | |
val builder = cbf(s) | |
var prevPromise: Promise[_] = Promise[Unit] success () |
import java.util.concurrent.ConcurrentLinkedQueue | |
import java.util.concurrent.atomic.AtomicInteger | |
import scala.concurrent.ExecutionContext | |
import scala.util.control.NonFatal | |
import scala.annotation.tailrec | |
//inspired by https://gist.github.com/viktorklang/4552423 | |
object ThrottledExecutionContext { | |
def apply(maxConcurrents: Int)(implicit context: ExecutionContext): ExecutionContext = { |
import akka.agent.Agent | |
import shapeless.Lens | |
import concurrent.Future | |
import akka.util.Timeout | |
import concurrent.ExecutionContext | |
object FocusedAgent { | |
implicit class EnrichedAgent[A](val agent: Agent[A]) extends AnyVal { | |
def focusOn[B](lens: Lens[A,B]): FocusedAgent[A,B] = new FocusedAgent[A,B](agent, lens) | |
} |
import akka.agent.Agent | |
import akka.util.Timeout | |
import akka.actor.ActorSystem | |
import concurrent.{Future, Promise} | |
import concurrent.duration.FiniteDuration | |
import shapeless.Lens | |
object Signal { |
implicit class PagePatternHelper(val sc: StringContext) extends AnyVal { | |
def page(args: Any*): PagePattern = { | |
val template = sc.standardInterpolator(treatEscapes, args) | |
val templateUrl = rl.Uri(template) | |
val path = templateUrl.path | |
val routeMatcher = new SinatraRouteMatcher(path) | |
val queryMultiParams = rl.MapQueryString.parseString(templateUrl.query.rawValue) | |
val queryParams = queryMultiParams.mapValues(_.head) |
object ObjectToExpr { | |
def objectToExpr[O <: AnyRef](c1: Context, o: O): c1.Expr[O] = macro objectToExprMacro[O] | |
def objectToExprMacro[O <: AnyRef : c.WeakTypeTag](c: Context)(c1: c.Expr[Context], o: c.Expr[O]) = c.Expr[Nothing] { | |
import c.universe._ | |
// println("*** objectToExprMacro() started") | |
val mh = new MacroHelper[c.type](c) | |
def isConstant(t: Type) = t =:= typeOf[Boolean] || t =:= typeOf[String] || t =:= typeOf[Int] | |
def isNonAbstractCaseClass(t: Type) = { |
// intended for boilerplate.scala in shapeless... | |
val arity = 3 | |
val N = arity | |
val typeVars = (0 until arity) map (n => (n+'A').toChar) | |
// = Vector(A, B, C) | |
val `A..Z` = typeVars.mkString(", ") | |
// = "A, B, C" |
block""" | |
| implicit def fnFromProduct«N»[«A..Z»]: Aux[(«A::Z») => Res, («A..Z») => Res] = new FnFromProduct[(«A::Z») => Res] { | |
| type Out = («A..Z») => Res | |
| def apply(hf : («A::Z») => Res): Out = («a:A..z:Z») => hf(«a::z») | |
| } | |
""" |