pacman -S openssh
systemctl start sshd
systemctl enable sshd.socket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit class IosInt(i: Int) extends AnyVal { | |
def s: Int = i + 1 | |
} | |
val test: String = "I have an iPhone " + 4.s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
| } | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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») | |
| } | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |