Skip to content

Instantly share code, notes, and snippets.

View jelinski's full-sized avatar

Krzysztof Jeliński jelinski

View GitHub Profile
@joewalnes
joewalnes / jar-launcher.md
Last active December 10, 2023 11:58
Make a single file Java jar launcher

This is a little trick to turn an executable Java jar.

It works on all unixy like systems including Linux, MacOS, Cygwin, and Windows Linux subsystem.

Step 1 Start with an all-in-one jar (with entry point and all deps within)

$ ls 
hello.jar
@milessabin
milessabin / gist:6451859
Created September 5, 2013 15:37
Using pattern matching to destructure shapeless records.
scala> import shapeless._, syntax.singleton._, record._
import shapeless._
import syntax.singleton._
import record._
scala> object ->> {
| def unapply[K, V](f: FieldType[K, V])(implicit k: Witness.Aux[K]) = Option((k.value, f: V))
| }
defined module $minus$greater$greater