Skip to content

Instantly share code, notes, and snippets.

View deinspanjer's full-sized avatar

Daniel Einspanjer deinspanjer

View GitHub Profile
<?xml version="1.0" ?>
<template encoding-version="1.0">
<description>A simple GenerateFlowFile -&gt; PublishKafka_0_10 works fine, but this doesn't.
I really thought I had figured out that the problem was just trying to store the Avro records so I put in the conversion to JSON, but it is still failing. The error message is:
2016-10-29 23:52:49,629 WARN [Timer-Driven Process Thread-1] o.a.n.p.kafka.pubsub.PublishKafka_0_10 PublishKafka_0_10[id=12b0a84d-0158-1000-ce29-967712bf5ab6] Timed out while waiting for acks from Kafka</description>
<groupId>12988df2-0158-1000-88e0-450d4f9737a0</groupId>
<name>ProblemWithPublishKafka10</name>
<snippet>
#!/usr/bin/env bash
usage() {
echo "Usage: $0 <type> [<schema>.]<name> [r=<requirement>[,<requirement>]...] [<param_name>=<param_value>[,<param_value>]...] [<param1_name>:<param2_name>=<param1_value>:<param2_value>[,<param1_value>:<param2_value>]...]"
echo " arguments must be SQL safe strings (A-z 0-9 _ .)"
echo " schema defaults to public if not specified"
echo " specify 'schema' as <type> and the name of the schema as <name> to add a schema"
}
if [ "$BASH_VERSINFO" -lt 4 ]; then
-- Deploy [% project %]:[% change %] to [% engine %]
[% FOREACH item IN requires -%]
-- requires: [% item %]
[% END -%]
[% FOREACH item IN conflicts -%]
-- conflicts: [% item %]
[% END -%]
BEGIN;
CREATE OR REPLACE FUNCTION validate_user(
email TEXT
, token UUID
)
RETURNS BOOL
LANGUAGE plpgsql
AS $$
DECLARE
BEGIN
IF exists(SELECT
@deinspanjer
deinspanjer / verify_google_jwt.sql
Created October 6, 2016 00:34
A PostgreSQL function using the plv8 language that can validate a JWT token from Google Sign-In
CREATE EXTENSION plv8;
CREATE OR REPLACE FUNCTION verify_google_jwt(jwt_token TEXT)
RETURNS JSONB
LANGUAGE plv8 IMMUTABLE STRICT
AS $$
function logerror(msg) {
plv8.elog(ERROR, msg);
}
@deinspanjer
deinspanjer / application_function__benchmark.sql
Created September 24, 2016 17:33
Some Postgres audit logging customizations for use in PostgREST
-- Deploy myproject:application_function__benchmark to pg
-- requires: application__schema
BEGIN;
SET search_path TO application;
CREATE TYPE _bench_result AS (
function_name TEXT,
runtime REAL,
@deinspanjer
deinspanjer / pg_deploy_create_function.tmpl
Last active October 9, 2016 13:41
Sqitch create function templates for pg engine
-- Deploy [% project %]:[% change %] to [% engine %]
[% FOREACH item IN requires -%]
-- requires: [% item %]
[% END -%]
[% FOREACH item IN conflicts -%]
-- conflicts: [% item %]
[% END -%]
BEGIN;
@deinspanjer
deinspanjer / pg_deploy_create_schema.tmpl
Last active October 9, 2016 13:43
Sqitch create schema templates for pg engine
-- Deploy [% project %]:[% change %] to [% engine %]
[% FOREACH item IN requires -%]
-- requires: [% item %]
[% END -%]
[% FOREACH item IN conflicts -%]
-- conflicts: [% item %]
[% END -%]
BEGIN;
@deinspanjer
deinspanjer / pg_deploy_create_enum.tmpl
Last active October 9, 2016 13:44
Sqitch create enum templates for pg engine
-- Deploy [% project %]:[% change %] to [% engine %]
[% FOREACH item IN requires -%]
-- requires: [% item %]
[% END -%]
[% FOREACH item IN conflicts -%]
-- conflicts: [% item %]
[% END -%]
BEGIN;
@deinspanjer
deinspanjer / pg_deploy_create_type.tmpl
Last active October 9, 2016 13:50
Sqitch create type templates for pg engine
-- Deploy [% project %]:[% change %] to [% engine %]
[% FOREACH item IN requires -%]
-- requires: [% item %]
[% END -%]
[% FOREACH item IN conflicts -%]
-- conflicts: [% item %]
[% END -%]
BEGIN;