Skip to content

Instantly share code, notes, and snippets.

View welshstew's full-sized avatar
😎
henlo world

Stuart Winchester welshstew

😎
henlo world
View GitHub Profile
@welshstew
welshstew / activemq-jmssender.groovy
Created September 12, 2014 04:09
send jms messages to activemq with a neat groovy script
@Grab(group='org.apache.activemq',module = 'activemq-all', version='5.8.0')
import org.apache.activemq.ActiveMQConnectionFactory
import javax.jms.*
def brokerUrl = 'tcp://localhost:61616'
def queue = 'the.soapoverjms.service'
def soapAction = 'urn:sixtree:soapoverjms:dosomething'
def reader = new BufferedReader(new InputStreamReader(System.in))
@welshstew
welshstew / camel-activemq-responder.groovy
Last active August 29, 2015 14:06
sends requests via stdin and files to a jms queue using camel. Log the response.
@Grab(group = 'org.apache.activemq', module = 'activemq-all', version='5.8.0')
@Grab(group = 'org.apache.camel', module = 'camel-core', version = '2.12.3')
@Grab(group = 'org.apache.camel', module = 'camel-jms', version = '2.12.3')
import org.apache.activemq.ActiveMQConnectionFactory
import org.apache.camel.ExchangePattern
import org.apache.camel.builder.RouteBuilder
import org.apache.camel.component.jms.JmsComponent
import org.apache.camel.impl.DefaultCamelContext
import org.apache.camel.impl.SimpleRegistry
@welshstew
welshstew / .bash_profile
Created September 15, 2014 07:09
some shortcuts for your bash profile
export ACTIVEMQ_HOME=/usr/local/Cellar/activemq/5.10.0/libexec
export ACTIVEMQ=$ACTIVEMQ_HOME/bin
alias startactivmq='$ACTIVEMQ/activemq start'
alias starthawtio='java -jar /Users/swinchester/hawtio/hawtio-app-1.4.16.jar --port 8090'
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="httpRoute1">
<from uri="direct:httpRoute1"/>
<to uri="mock:mockHttpRoute1"/>
</route>
</routes>
@welshstew
welshstew / ssh into docker container
Created January 4, 2015 05:34
ssh into docker container
docker exec -i -t 665b4a1e17b6 bash
sudo find . -mmin 20 -name '*.log' -exec ls -ltr {} \;
@welshstew
welshstew / recents.groovy
Created March 5, 2015 02:38
Groovy script to print files recursively (most recent file first)
import groovy.io.FileType
def list = []
def dir = new File(".")
dir.eachFileRecurse (FileType.FILES) { file ->
list << file
}
def ascendingOrder = list.sort { it.lastModified() }
def descending = ascendingOrder.reverse()
print descending
@welshstew
welshstew / groovy-zip.groovy
Created March 5, 2015 04:41
groovy script to zip and unzip text/String content
// Simple groovy script to compress / decompress Strings
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
def zip(String s){
def targetStream = new ByteArrayOutputStream()
def zipStream = new GZIPOutputStream(targetStream)
zipStream.write(s.getBytes('UTF-8'))
zipStream.close()
def zippedBytes = targetStream.toByteArray()
@welshstew
welshstew / snippet.txt
Created March 12, 2015 22:11
remove all exited docker containers
sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm
@welshstew
welshstew / snippet.txt
Created March 16, 2015 23:06
file size usage tree linux
du -h /path | sort -h