Skip to content

Instantly share code, notes, and snippets.

View monodot's full-sized avatar
💭
I am working very hard

Tom Donohue monodot

💭
I am working very hard
View GitHub Profile
@monodot
monodot / camel-topic-to-file.xml
Created January 8, 2016 17:01
Camel: subscribe to an ActiveMQ Advisory topic and route messages to a file so they can be easily read
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
@monodot
monodot / cBeanRegister-SSLContextParameters.java
Created January 11, 2016 12:49
Register an SSLContextParameters bean in a Talend ESB Route
KeyStoreParameters kspKeys = new KeyStoreParameters();
kspKeys.setResource(context.keyStorePath);
kspKeys.setPassword(context.keyStorePassword);
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyStore(kspKeys);
kmp.setKeyPassword(context.keyPassword);
KeyStoreParameters kspTrust = new KeyStoreParameters();
kspTrust.setResource(context.trustStorePath);
@monodot
monodot / .htaccess
Created March 4, 2016 08:42
Redirect from HTTP to HTTPS using rewrite rules
RewriteEngine On
# Redirect from HTTP to HTTPS, by inspecting the HTTP port
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@monodot
monodot / CustomRoutingSlipBean.java
Last active March 19, 2016 14:58
Example Camel-annotated RoutingSlip bean for use in Talend ESB
package beans;
import java.util.ArrayList;
import org.apache.camel.RoutingSlip;
public class CustomRoutingSlipBean {
@RoutingSlip
public ArrayList<String> slip(String body) {
ArrayList<String> recipients = new ArrayList<String>();
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"annotations": {
"iconClass": "icon-tomcat",
"description": "Application template for JWS applications built using S2I with an external Oracle database.",
"tags": "tomcat,tomcat8,mysql,java,database,jboss,xpaas",
"version": "1.2.0"
},
@monodot
monodot / openshift-nexus-proxy.yaml
Last active November 7, 2016 15:46
Creates an endpoint and service inside OpenShift to proxy an external Nexus instance running on (e.g.) 10.1.2.1
# Pass this file to openshift using `oc process -f openshift-nexus-proxy.yaml | oc create -f -`
#
apiVersion: v1
kind: Template
metadata:
creationTimestamp: null
name: nexus-service
objects:
- apiVersion: v1
kind: Endpoints
@monodot
monodot / authorizationPlugin-fragment.xml
Last active January 26, 2017 11:00
How to define per-destination authorisation rules in ActiveMQ
<plugins>
<jaasAuthenticationPlugin configuration="activemq"/>
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry queue=">" read="admins" write="admins" admin="admins"/>
<authorizationEntry queue="USERS.>" read="users" write="users" admin="users"/>
<authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users"/>
@monodot
monodot / amq-ssl-encrypt.sh
Created January 29, 2017 18:58
Enforce SSL on an A-MQ standalone broker, with Jasypt-encrypted keystore/truststore passwords
# FIRST!
# Make sure Jasypt is installed first in the Karaf container before continuing
# features:install jasypt-encryption
# Update these vars as per the environment
MASTER_PASS=masterpass
KEYSTORE_PASS=password
TRUSTSTORE_PASS=password
# ------
@monodot
monodot / openshift-set-maven-mirror.sh
Last active March 2, 2017 12:28
Using jq, set the MAVEN_MIRROR_URL env variable in a BuildConfig in an OpenShift list of objects
# Useful if you are running a local Maven mirror (e.g. Nexus) for dependencies
# Speeds up builds in OpenShift
# Of particular interest if you're developing with JBoss Middleware images
#
# Uses `ipconfig` to get the IP address of your host machine
# Updates a BuildConfig element to set the env var MAVEN_MIRROR_URL
#
# Requires:
# - jq
#!/usr/bin/env sh
set -e # fail on unhandled error
set -u # fail on undefined variable
#set -x # debug
alias command_exists="type >/dev/null 2>&1"
if command_exists curl; then