Skip to content

Instantly share code, notes, and snippets.

@oliverdaff
oliverdaff / NexusArtifactCleanup.groovy
Created March 29, 2012 05:47
Clean up nexus artifacts with API
import groovyx.net.http.*;
import static groovyx.net.http.ContentType.*;
import static groovyx.net.http.Method.*;
class NexusArtifactCleanup {
/**
* Settings in which to run script.
*/
@oliverdaff
oliverdaff / nexus.rb
Created March 28, 2012 06:19
Nexus Homebrew
require 'formula'
class Nexus < Formula
homepage 'http://www.sonatype.org/nexus/'
url 'http://www.sonatype.org/downloads/nexus-2.0.2-bundle.tar.gz'
md5 '7403fbcb06eea8d20f85c5ed36661570'
skip_clean :all
def install
@oliverdaff
oliverdaff / nexus.rb
Created March 28, 2012 06:18
Nexus Homebrew
require 'formula'
class Nexus < Formula
homepage 'http://www.sonatype.org/nexus/'
url 'http://www.sonatype.org/downloads/nexus-2.0.2-bundle.tar.gz'
md5 '7403fbcb06eea8d20f85c5ed36661570'
skip_clean :all
def install
@oliverdaff
oliverdaff / config.log
Created February 2, 2012 10:08
brew gnutils upgrade error
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by GnuTLS configure 2.12.16, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-debug --disable-dependency-tracking --disable-guile --disable-static --prefix=/usr/local/Cellar/gnutls/2.12.16 --with-libgcrypt --without-p11-kit
## --------- ##
## Platform. ##
@oliverdaff
oliverdaff / TerracottaJMXMonitor.groovy
Created December 7, 2011 04:12
Terracotta JMX Monitor
import javax.management.remote.JMXServiceURL
import javax.management.remote.JMXConnectorFactory as JmxFactory
import java.lang.management.*
def beanName = "org.terracotta:type=Terracotta Server,name=DSO"
def serverUrl = new JMXServiceURL('service:jmx:jmxmp://localhost:9520')
def server = JmxFactory.connect(serverUrl, null).MBeanServerConnection
def liveObjectCount = new GroovyMBean(server, beanName).LiveObjectCount
@oliverdaff
oliverdaff / SimpleDate.html
Created December 5, 2011 10:37
Simple PlayFramework Date Picker tag
<div class="clearfix">
<label for="time">Time</label>
<div class="input">
<select class="small" name="hour" id="hour" size="1">
#{list items:0..23, as:'i'}<option value="${i}"
#{if new Date().format('HH') == Integer.toString(i) }selected="true"#{/if}>${i}:00</option>#{/list}
</select>
</div>
</div>
<div class="clearfix">
@oliverdaff
oliverdaff / GutenbergCrunch
Created October 31, 2011 22:50
Parse Gutenberg using scala pull parser
import java.io.{FileInputStream, BufferedInputStream}
import scala.io.Source
import scala.xml.pull.{XMLEventReader, EvElemStart, EvElemEnd, EvText}
object GutenbergCrunch
{
private def parseBook( parser : XMLEventReader ) : (String, String, String) =
@oliverdaff
oliverdaff / FileLoader.java
Created September 20, 2011 03:47
FileLoader to load from classpath or filepath like Spring
import java.io.File;
import java.io.FileNotFoundException;
import java.net.URISyntaxException;
public class FileLoader {
private static final String CLASSPATH_CONST = "classpath:";
private static final String FILEPATH_CONST = "filepath:";
public File loadFile(String file) throws FileNotFoundException{
@oliverdaff
oliverdaff / build.sbt
Created September 13, 2011 10:57
build.sbt with two repos
resolvers ++= Seq(
"Twitter repo" at "http://maven.twttr.com/",
"Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
)
@oliverdaff
oliverdaff / build.sbt
Created September 13, 2011 10:55
sbt default resolvers
resolvers +="Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"