Skip to content

Instantly share code, notes, and snippets.

View MikeThomsen's full-sized avatar

Mike MikeThomsen

View GitHub Profile
@MikeThomsen
MikeThomsen / ExecuteGraphQueryTest.xml
Created November 17, 2020 20:16
Cypher test for ExecuteGraphQueryRecord
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.3">
<description></description>
<groupId>b36f9057-0175-1000-7ec1-63187bd2c0b0</groupId>
<name>ExecuteGraphQueryRecord Cypher</name>
<snippet>
<processGroups>
<id>db861c5f-cbf3-35c8-0000-000000000000</id>
<parentGroupId>70bbc5bf-8996-3d7b-0000-000000000000</parentGroupId>
<position>
@MikeThomsen
MikeThomsen / App.java
Created September 29, 2020 13:58
Generate a PDF from HTML
import com.openhtmltopdf.pdfboxout.PdfRendererBuilder;
import org.apache.pdfbox.io.IOUtils;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class App {
public static void main(String[] args) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
@MikeThomsen
MikeThomsen / Simple_Graph_Example.xml
Created October 29, 2019 21:19
Simple NiFi flow for testing 1.10.0 ExecuteGraphQuery processor w/ Gremlin driver
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.3">
<description></description>
<groupId>195b481b-016e-1000-0780-6e08b40dd410</groupId>
<name>Simple Graph Example</name>
<snippet>
<connections>
<id>0cf7a453-ea69-31d6-0000-000000000000</id>
<parentGroupId>47d9e3df-22e3-377e-0000-000000000000</parentGroupId>
<backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
@MikeThomsen
MikeThomsen / CustomFilter.java
Last active September 13, 2019 10:04
Custom filter that fails
import com.google.protobuf.InvalidProtocolBufferException;
import filters.generated.FilterProtos;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilder;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
@MikeThomsen
MikeThomsen / gist:4062e14611387e17bf18d57244703d6a
Created April 20, 2019 14:22
Change to ElasticSearchClientImpl
private SSLContext buildSslContext(SSLContextService sslService) throws IOException, CertificateException,
NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException, KeyManagementException {
KeyManagerFactory kmf = null;
if (sslService.isKeyStoreConfigured()) {
KeyStore keyStore = KeyStore.getInstance(sslService.getKeyStoreType());
try (final InputStream is = new FileInputStream(sslService.getKeyStoreFile())) {
keyStore.load(is, sslService.getKeyStorePassword().toCharArray());
}
kmf = KeyManagerFactory.getInstance(KeyManagerFactory
.getDefaultAlgorithm());
@MikeThomsen
MikeThomsen / tika_lang.groovy
Last active January 17, 2019 21:48
Test for LanguageIdentifier
@Grab(group='org.apache.tika', module='tika-core', version='1.19.1')
import org.apache.tika.language.LanguageIdentifier
[
ar: "1 فِي الْبَدْءِ كَانَ الْكَلِمَةُ، وَالْكَلِمَةُ كَانَ عِنْدَ اللهِ. وَكَانَ الْكَلِمَةُ اللهُ. 2 هَذَا كَانَ فِي الْبَدْءِ عِنْدَ اللهِ. 3 بِهِ تَكَوَّنَ كُلُّ شَيْءٍ، وَبِغَيْرِهِ لَمْ يَتَكَوَّنْ أَيُّ شَيْءٍ مِمَّا تَكَوَّنَ. 4 فِيهِ كَانَتِ الْحَيَاةُ. وَالْحَيَاةُ كَانَتِ نُورَ النَّاسِ. 5 وَالنُّورُ يُضِيءُ فِي الظَّلاَمِ، وَالظَّلاَمُ لَمْ يُدْرِكْ النُّورَ. 6 ظَهَرَ إِنْسَانٌ أَرْسَلَهُ اللهُ، اسْمُهُ يُوحَنَّا، 7 جَاءَ يَشْهَدُ لِلنُّورِ، لِكَيْ يُؤْمِنَ الْجَمِيعُ بِوَاسِطَتِهِ. 8 لَمْ يَكُنْ هُوَ النُّورَ، بَلْ كَانَ شَاهِداً لِلنُّورِ، 9 فَالنُّورُ الْحَقُّ الَّذِي يُنِيرُ كُلَّ إِنْسَانٍ كَانَ آتِياً إِلَى الْعَالَمِ. 10 كَانَ فِي الْعَالَمِ، وَبِهِ تَكَوَّنَ الْعَالَمُ، وَلَمْ يَعْرِفْهُ الْعَالَمُ. 11 وَقَدْ جَاءَ إِلَى خَاصَّتِهِ، وَلَكِنَّ هَؤُلاَءِ لَمْ يَقْبَلُوهُ. 12 أَمَّا الَّذِينَ قَبِلُوهُ، أَيِ الَّذِينَ آمَنُوا بِاسْمِهِ، فَقَدْ مَنَحَهُمُ الْحَقَّ فِي أَن
@MikeThomsen
MikeThomsen / CSV_Example.xml
Created October 30, 2018 14:29
CSV to JSON example with NiFi record API
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.2">
<description></description>
<groupId>c4790b93-0166-1000-a0a9-52f4138fb388</groupId>
<name>CSV Example</name>
<snippet>
<processGroups>
<id>26f1e79b-ec9b-390a-0000-000000000000</id>
<parentGroupId>581487d4-181b-3b23-0000-000000000000</parentGroupId>
<position>