Skip to content

Instantly share code, notes, and snippets.

View teabot's full-sized avatar

Elliot West teabot

View GitHub Profile
@teabot
teabot / Avro-questions.csv
Last active January 10, 2022 11:53
Avro evolution questions
Action BACKWARD TRANSITIVE FORWARD TRANSITIVE FULL TRANSITIVE
Can I add a new field with a default value? Yes Yes Yes
Can I add a new field without a default value? No Yes No
Can I remove an existing field with a default value? Yes Yes Yes
Can I remove an existing field without a default value? Yes No No
Can I rename an existing field with an alias? Yes Yes Yes
Can I rename an existing field without an alias? No No No
Can I add a default value to an existing field? Maybe Maybe Maybe
Can I remove a default from an existing field? Maybe Maybe Maybe
Can I make an existing field nullable? Yes No No
@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
@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 🚫 🚫 🚫
intentionally-blank
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;
@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
@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 / .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 / 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(">", ">", $0);print}' | \
awk '{gsub(""", "\"", $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 / 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.
*/