Skip to content

Instantly share code, notes, and snippets.

View stephen-masters's full-sized avatar

Stephen Masters stephen-masters

View GitHub Profile
Search through the file system and list files in size reverse order.
du -akd /a/root/dir | sort -nr | less
VirtualBox Config
Set up NAT port forwarding from host port 8000 to guest port 80.
VBoxManage modifyvm "MyGuest" --natpf1 "www,tcp,,8080,,80"
@stephen-masters
stephen-masters / get_latest_snapshot.rb
Created February 17, 2012 09:22
Get latest snapshot artifact from Sonatype Nexus
#---------------------------------------------------------------------
#
# Parse the response from Sonatype Nexus in order to determine the
# correct URI for the most recent snapshot of an artifact.
#
# Usage:
# ruby get_latest_snapshot.rb \
# -n http://localhost:8080/nexus \
# -g uk.co.scattercode \
# -a my-artifact \
@stephen-masters
stephen-masters / maven-jar-plugin-example.xml
Created September 3, 2012 13:12
Maven Jar plugin example
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>factmodel</id>
<!--
Use the Jar plugin to produce a reduced JAR containing only those model classes
to be used as facts in Drools/Guvnor.
@stephen-masters
stephen-masters / BigDecimalAccumulator.java
Created November 16, 2012 16:39
Drools BigDecimal accumulator
package uk.co.scattercode.drools.accumulators;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.math.BigDecimal;
import org.drools.runtime.rule.TypedAccumulateFunction;
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="webspheremq:ANY.OPERATION.REQUEST" />
<choice>
<when>
<xpath>/REQUEST/HEADER[@OperationName='Old.Request']</xpath>
<to uri="activemq:OLD.REQUEST" />
</when>
<when>
<xpath>/REQUEST/HEADER[@OperationName='New.Request']</xpath>
from("C:/router/export/csv/")
.unmarshal().csv()
.split().method("org.gratiartis.router.Splitter", "split")
.to("jms:DOCUMENT.METADATA.QUEUE");
from("jms:DOCUMENT.METADATA.QUEUE")
.processRef("org.gratiartis.router.Processor")
.to("C:/router/out/xml/");
@stephen-masters
stephen-masters / deploy-guvnor-was.sh
Last active December 15, 2015 04:59
Setting up Drools Guvnor on WebSphere Application Server Liberty Profile 8.5
# Run from a location where you want to download the application.
mkdir ~/downloads ; cd ~/downloads
curl -O -L http://download.jboss.org/drools/release/5.3.0.Final/guvnor-distribution-5.3.0.Final.zip
unzip guvnor-distribution-5.3.0.Final.zip
# Explode the Guvnor .war and copy to the WAS "apps" directory
unzip guvnor-distribution-5.3.0.Final/binaries/guvnor-5.3.0.Final-tomcat-6.0.war -d guvnor
cp guvnor /usr/share/was/wlp/usr/servers/guvnor/apps/
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
entityManagerFactoryRef = "barEntityManagerFactory",
transactionManagerRef = "barTransactionManager",
basePackages = { "com.sctrcd.multidsdemo.integration.repositories.bar" })
public class BarConfig {
@Autowired
JpaVendorAdapter jpaVendorAdapter;
package com.sctrcd.multidsdemo;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
package com.sctrcd.multidsdemo;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;