Skip to content

Instantly share code, notes, and snippets.

View nsphung's full-sized avatar

Nicolas PHUNG nsphung

View GitHub Profile
@nsphung
nsphung / KryoScalaSeqMap.scala
Created April 12, 2018 14:27
Kryo Scala Map Seq Serialization with Twitter Chill
import org.objenesis.strategy.StdInstantiatorStrategy
import org.scalatest.{FlatSpecLike, Matchers}
class MyTest extends FlatSpecLike with Matchers {
"the test" should "hasKnownProfiles" in {
import com.twitter.chill.{KryoInstantiator, KryoPool}
val POOL_SIZE = 10
val instantiator: KryoInstantiator = new KryoInstantiator()
.setInstantiatorStrategy(new StdInstantiatorStrategy)
@nsphung
nsphung / PlayJsonMap.scala
Last active June 28, 2017 09:21
Decode a Json Map with Play-Json + Joda DateTime pattern fix
import net.messages.RightPrivilege
import org.joda.time.DateTime
import play.api.libs.json._
// Works with play-json 2.4.8
implicit val rightPrivilegeFormat = Json.format[RightPrivilege]
// Read/Writes for Joda DateTime avoid (error.expected.jodadate.format due to default pattern)
implicit val tsreads: Reads[DateTime] = Reads.of[String] map (new DateTime(_))
implicit val tswrites: Writes[DateTime] = Writes { (dt: DateTime) => JsString(dt.toString)}
$ gcloud dataproc clusters diagnose fca-cluster-202 [12:47:56]
Waiting on operation [projects/fcms-sandbox-gce/regions/global/operations/cddd33c1-1a4a-4e23-8309-54e0fcfb4063].
Waiting for cluster diagnose operation...done.
Output from diagnostic:
-----------------------------------------------
Running Google Cloud Dataproc diagnostic
Collecting daemon and system state information
17/02/09 11:48:14 INFO client.RMProxy: Connecting to ResourceManager at fca-cluster-202-m/10.132.0.30:8032
17/02/09 11:48:16 INFO gcs.GoogleHadoopFileSystemBase: GHFS version: 1.5.5-hadoop2
@nsphung
nsphung / clouderaDirectorReconcile
Created December 2, 2016 09:14
Reconcile Cloudera director
https://community.cloudera.com/t5/Cloudera-Director-Cloud-based/Director-pipeline-SUSPENDED-UPDATE-FAILED/td-p/28598/page/3