Skip to content

Instantly share code, notes, and snippets.

View teabot's full-sized avatar

Elliot West teabot

View GitHub Profile
@teabot
teabot / xa-datasources-spring.xml
Last active September 15, 2017 05:48
Example distributed XA transaction configuration for: Bitronix BTM, Spring, Hibernate, IBatis, Last Resource Commit
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util
@teabot
teabot / LocalJtaTransactionFactory.java
Created January 17, 2013 13:21
A Hibernate org.hibernate.transaction.JTATransactionFactory implementation that avoids using JNDI for lookups.
package my.project.hibernate;
import javax.transaction.UserTransaction;
import org.hibernate.transaction.JTATransactionFactory;
/**
* A Hibernate {@link JTATransactionFactory} implementation that avoids using JNDI for lookups. You must set the
* {@link UserTransaction} on this bean with #setUserTransaction(UserTransaction)} before using it.
*/
@teabot
teabot / wikiDataflow2Diagram.sh
Created January 17, 2013 13:51
A simple script for extracting some DOT from a wiki page and rendering as a PNG.
#!/bin/sh
curl -s "http://mywiki.me/wiki/DataFlow" > dataflow_page.html
awk '/# BEGIN/,/# END/{if(!/pattern/)print}' dataflow_page.html | \
awk '{gsub("&gt;", ">", $0);print}' | \
awk '{gsub("&quot;", "\"", $0);print}' | \
awk '{gsub("&lt;", "<", $0);print}' > dataflow.dot
EPOCH=`date +"%s"`
dot -Tpng dataflow.dot -o dataflow-${EPOCH}.png
gimp dataflow-${EPOCH}.png
@teabot
teabot / .gitconfig
Last active December 11, 2015 15:19
Git config
[user]
name = Elliot West
email = [email protected]
[color]
ui = true
[alias]
glog = log --graph --pretty=oneline --abbrev-commit --decorate --stat
st = status
ci = commit
br = branch
@teabot
teabot / updot
Last active December 18, 2015 15:29
Periodically converts a dot file into a PNG so that I can create diagrams in a text editor and view them in a web browser and/or "OSX Preview".
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: `basename $0` {dot file}"
exit -1
fi
FILE=$1
NAME=${FILE%.dot}
@teabot
teabot / header2ddl
Last active December 18, 2015 15:39
Generated create table DDL from header rows of delimited files.
#!/bin/bash
delim=$1
for file in *.tsv
do
name=${file%.tsv}
columns=`head -n1 $file`
echo -n "CREATE TABLE $name ("
arr=$(echo $columns | tr $delim "\n")
first=1
package com.hotels.plunger;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
intentionally-blank
@teabot
teabot / avro-incompatible-steps.csv
Last active January 7, 2022 12:22
Avro incompatible steps
Step BW FW FU BWT FWT FUT
Step 1 - Add default to existing field ⬇️ ⬇️
Step 2 - Add new field
Step 3 - Remove existing field 🚫 🚫
Step 4 - Remove default from new field ⬇️ 🚫 🚫 🚫
Step 5 - Rename new field 🚫 🚫 🚫
@teabot
teabot / avro-incompatible-key.csv
Last active January 7, 2022 12:25
Avro incompatible key
Sybmol Meaning
⬇️ Step can be skipped
Compatible change
🚫 Incompatible change
BW / FW / FU BACKWARDS / FORWARDS / FULL compatibility modes
BWT / FWT / FUT BACKWARDS / FORWARDS / FULL TRANSITIVE compatibility modes