Skip to content

Instantly share code, notes, and snippets.

@myDisconnect
myDisconnect / ClassUtils.scala
Last active April 10, 2022 17:21 — forked from carymrobbins/pretty-print.scala
Pretty print Scala case classes and other data structures.
/*
* Original author's work: @see https://gist.github.com/carymrobbins/7b8ed52cd6ea186dbdf8
* - 2019-07-18 Added support for Option and Map types
* - 2019-11-25 Fixed Option types spacing
*/
object ClassUtils {
/**
* Pretty prints a Scala value similar to its source represention.
* Particularly useful for case classes.
@polvi
polvi / README.md
Created May 3, 2017 23:53
HDFS of Kubernetes

Easiest HDFS cluster in the world with kubernetes.

Inspiration from kimoonkim/kubernetes-HDFS

kubectl create -f namenode.yaml
kubectl create -f datanode.yaml

Setup a port-forward to so you can see it is alive:

@magnetikonline
magnetikonline / README.md
Last active June 22, 2024 06:03
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script which will:

  • Iterate all commits made within a Git repository.
@jorgeortiz85
jorgeortiz85 / PrivateMethodCaller.scala
Created April 7, 2011 15:41
Calling private methods in Scala
// Usage:
// p(instance)('privateMethod)(arg1, arg2, arg3)
class PrivateMethodCaller(x: AnyRef, methodName: String) {
def apply(_args: Any*): Any = {
val args = _args.map(_.asInstanceOf[AnyRef])
def _parents: Stream[Class[_]] = Stream(x.getClass) #::: _parents.map(_.getSuperclass)
val parents = _parents.takeWhile(_ != null).toList
val methods = parents.flatMap(_.getDeclaredMethods)
val method = methods.find(_.getName == methodName).getOrElse(throw new IllegalArgumentException("Method " + methodName + " not found"))