Skip to content

Instantly share code, notes, and snippets.

@klausbrunner
klausbrunner / two-main-jars-pom.xml
Last active February 2, 2020 15:17
Creating two different executable JARs with dependencies from the same Maven project - same contents but different Main class in the manifest
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly1</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
@dkolb
dkolb / parseXsdDateTime.groovy
Created September 14, 2013 03:17
Making xsd:dateTime values for SoapUI tasks (e.g. getting today and 30 days ago).
import java.util.Calendar
import javax.xml.bind.DatatypeConverter
now = Calendar.getInstance()
endDate = DatatypeConverter.printDateTime(now)
now.add(Calendar.DAY_OF_MONTH, -30)
startDate = DatatypeConverter.printDateTime(now)
@RedBeard0531
RedBeard0531 / functions.js
Created February 22, 2012 20:13
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});
@ryanflorence
ryanflorence / static_server.js
Last active April 26, 2024 16:18
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);