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 / ProtobufPlugin.java
Created June 17, 2018 21:17
Messing around with XJC plugins to get it to generate Protobuf Marshaller classes for Infinispan
package com.example;
import com.sun.codemodel.*;
import com.sun.tools.xjc.Options;
import com.sun.tools.xjc.Plugin;
import com.sun.tools.xjc.model.Model;
import com.sun.tools.xjc.outline.ClassOutline;
import com.sun.tools.xjc.outline.EnumConstantOutline;
import com.sun.tools.xjc.outline.EnumOutline;
import com.sun.tools.xjc.outline.Outline;
@monodot
monodot / settings.xml
Last active January 31, 2018 13:11
Settings file to configure Maven to pull artifacts from Red Hat repositories - for JBoss Fuse and Fuse Integration Services (FIS). See https://developers.redhat.com/products/fuse/hello-world/
<?xml version="1.0"?>
<!-- See also: https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/single/developing_and_deploying_applications/index#Develop -->
<settings>
<profiles>
<profile>
<id>extra-repos</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
@monodot
monodot / gist:56ab3bcf77f50768583476b8f13d801b
Created November 27, 2017 18:16
red-hat-customer-portal-download.sh
curl --cookie "JSESSIONID=<your_session_id_here>;" -OL https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=<id_here>
@monodot
monodot / download-live-site.sh
Created November 18, 2017 13:38
Script to download MySQL database & files from live to development server
#!/bin/bash
#===============================================================================
# This is a template for a script I use on a lot of sites to copy the database
# (MySQL) and any uploaded files to the development site, and modify the
# database as required.
#
# The script should be on the development server. The live site can either be on
# the same server, or a remote server connected via SSH.
#
@monodot
monodot / so.multipletags.sql
Created October 29, 2017 11:42
Stack Overflow: find questions matching multiple tags
SELECT TOP 100
Questions.Id
AS [Post Link],
Questions.Title,
Questions.AnswerCount,
Questions.ViewCount,
Questions.FavoriteCount,
Questions.Score,
Questions.LastActivityDate,
Questions.CreationDate
@monodot
monodot / ssl-testing.md
Last active April 21, 2022 13:00
Using openssl to test an SSL connection with a CA file, pulled out from a Java keystore

Java, do you trust me? 🤔

Using openssl to test an SSL connection to google.com, using a CA file that's been pulled out from a Java keystore. For those days when you want to verify that you've got the right certificate in the store:

  1. Download the Equifax root certificate (which is the root CA for Google)
  2. Import the certificate into a new Java keystore
  3. Export the certificate back out again
  4. Convert the certificate to PEM
  5. Use openssl to test an SSL connection to Google with that cert
#!/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
@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
@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 / 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"/>