Skip to content

Instantly share code, notes, and snippets.

View wadejensen's full-sized avatar

Wade Jensen wadejensen

  • Brisbane / Sydney, Australia
View GitHub Profile
@wadejensen
wadejensen / parse-options.sh
Created November 1, 2017 04:18 — forked from cosimo/parse-options.sh
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@wadejensen
wadejensen / gist:ae5732567ea7f93cdee58f769a2b97da
Created October 25, 2017 13:20 — forked from rgorsuch/gist:b404c658551a6a8aeb35
scala: print all URLs on classpath
def urlses(cl: ClassLoader): Array[java.net.URL] = cl match {
case null => Array()
case u: java.net.URLClassLoader => u.getURLs() ++ urlses(cl.getParent)
case _ => urlses(cl.getParent)
}
val urls = urlses(getClass.getClassLoader)
println(urls.filterNot(_.toString.contains("ivy")).mkString("\n"))