Skip to content

Instantly share code, notes, and snippets.

@magnuspalmer
magnuspalmer / mqttclient.groovy
Last active July 30, 2019 03:34
Groovy mqtt client bluemix IoT services
@Grab(group='org.eclipse.paho', module='mqtt-client', version='0.4.0')
import org.eclipse.paho.client.mqttv3.*
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence
String tmpDir = System.getProperty("java.io.tmpdir")
MqttDefaultFilePersistence dataStore = new MqttDefaultFilePersistence("${tmpDir}/mqtt")
//org
String org = 'myOrg'
@magnuspalmer
magnuspalmer / tailLogFile.groovy
Created March 7, 2015 08:40
Groovy tail -f using Apache Commons IO
@Grapes([
@Grab(group='commons-io', module='commons-io', version='2.4'),
@Grab('log4j:log4j:1.2.17')
])
import org.apache.commons.io.input.*
import org.apache.log4j.*
import groovy.util.logging.*
@magnuspalmer
magnuspalmer / elasticsearch.sh
Created February 11, 2015 09:17
RedHat initscript for Elasticsearch
### BEGIN INIT INFO
# Provides: elasticsearch
# Required-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 6
# Short-Description: ElasticSearch
# Description: ElasticSearch
# NoSQL database used by Graylog2
### END INIT INFO
@magnuspalmer
magnuspalmer / BindySimpleFixedLengthWithLinkTest
Created April 19, 2013 05:18
Very simple Camel Bindy JUnit test with for fixed length record with a link in the middle. I started with the BindySimpleFixedLengthHeaderFooterTest but made this a lot simplier. Note that the test only does unmarshalling
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*