SSH Cheatsheet

SSH Config

  • Sometimes you have a set of servers that use a shared identity file. By using an ssh config file you can simplify how you access those boxs.
Read More

Scala Cheatsheet

Flat Map - convert a Seq[Seq[String]] into a Seq[String]

val arr1 = Seq("Michael","Freddy","Chucky")
val arr2 = Seq("Lizzie","Suzie","Carmen")
val sample = Seq(arr1,arr2)
val out = sample.flatten
arr1: Seq[String] = List(Michael, Freddy, Chucky)
arr2: Seq[String] = List(Lizzie, Suzie, Carmen)
sample: Seq[Seq[String]] = List(List(Michael, Freddy, Chucky), List(Lizzie, Suzie, Carmen))
out: Seq[String] = List(Michael, Freddy, Chucky, Lizzie, Suzie, Carmen)

Flat Map - convert a Seq[Seq[Person]] into a Seq[String]

case class Person(name:String)
val arr1 = Seq(Person("Michael"),Person("Freddy"),Person("Chucky"))
val arr2 = Seq(Person("Lizzie"),Person("Suzie"),Person("Carmen"))
val sample = Seq(arr1,arr2)
val out = sample.flatMap(_.map(_.name))
Read More

Git Cheatsheet

Setup local branches for all remote branches

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
Read More