Skip to content

Instantly share code, notes, and snippets.

Matthew Adams matthewadams

Block or report user

Report or block matthewadams

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@matthewadams
matthewadams / jdk
Last active Dec 18, 2015
Easy JVM switcher script for Mac OS X
View jdk
#!/bin/bash
if [ ! $1 ]; then
echo "Please include desired jdk version: 1.7 or 7, 1.6 or 6, ..."
exit
fi
j7="/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home"
#j6="/Library/Java/JavaVirtualMachines/1.6.0_45-b06-451.jdk/Contents/Home"
j6="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
@matthewadams
matthewadams / slf4jScriptLogging.groovy
Created May 2, 2013
Convenient logback/slf4j logging closures for Groovy script authors.
View slf4jScriptLogging.groovy
@Grab(group='ch.qos.logback', module='logback-classic', version='[1.0.9,)')
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import ch.qos.logback.classic.Level
logger = LoggerFactory.getLogger("yourScript") // or whatever
logger.level = Level.INFO // or whatever
log = { level, msg, Object... args -> logger."${level.toLowerCase()}"((msg ?: "").toString(), args) }
@matthewadams
matthewadams / rmdirs.groovy
Created May 2, 2013
Closure to remove an entire directory tree.
View rmdirs.groovy
rmdirs = {
it = (it instanceof File) ? it : new File(it)
if (!it.exists()) return
it.eachDir(delDir)
it.eachFile { it.delete() }
it.delete()
}
You can’t perform that action at this time.