Skip to content

Instantly share code, notes, and snippets.

@andybryant
andybryant / DateToString.java
Last active September 10, 2018 06:24
KSQL UDF for reading and writing Kafka Connect formatted Dates (no time component)
package io.confluent.ksql.function.udf.datetime;
import io.confluent.common.utils.CopyOnWriteMap;
import io.confluent.ksql.function.udf.Udf;
import io.confluent.ksql.function.udf.UdfDescription;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Map;
@andybryant
andybryant / BatchingPostgreSqlDatabaseDialect.java
Created August 3, 2018 11:19
Batching Kafka Connect JDBC Postgres Dialect
package your.company.here;
import io.confluent.connect.jdbc.dialect.DatabaseDialect;
import io.confluent.connect.jdbc.dialect.DatabaseDialectProvider;
import io.confluent.connect.jdbc.dialect.PostgreSqlDatabaseDialect;
import org.apache.kafka.common.config.AbstractConfig;
import java.sql.Connection;
import java.sql.SQLException;
StreamsBuilder builder = new StreamsBuilder();
// ...build your topology here
Topology topology = builder.build();
logger.info("Topology description {}", topology.describe());
builder
.stream("orders")
.flatMap(Ops::splitOrders)
.through("order-items")
.filter(Ops::excludeArchivedValues)
.to("active-order-items");
StreamsBuilder builder = new StreamsBuilder();
builder
.stream("orders")
.flatMap(Ops::splitOrders)
.to("order-items");
Topology topology = builder.build();
Properties config = new Properties();
config.put(StreamsConfig.APPLICATION_ID_CONFIG, "mySampleApp");
config.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "broker:9092");

Keybase proof

I hereby claim:

  • I am andybryant on github.
  • I am andybryant (https://keybase.io/andybryant) on keybase.
  • I have a public key whose fingerprint is 8A31 F43C B643 4841 C472 3738 2A25 7516 D76E AB57

To claim this, I am signing this object:

@andybryant
andybryant / README.md
Last active September 22, 2016 12:46
Reingold–Tilford Tree

The tree layout implements the Reingold-Tilford algorithm for efficient, tidy arrangement of layered nodes. The depth of nodes is computed by distance from the root, leading to a ragged appearance. Radial orientations are also supported. Implementation based on work by Jeff Heer and Jason Davies using Buchheim et al.'s linear-time variant of the Reingold-Tilford algorithm. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

Compare to this radial layout.

@andybryant
andybryant / README.md
Last active September 22, 2016 12:42
Radial Reingold–Tilford Tree

The tree layout implements the Reingold-Tilford algorithm for efficient, tidy arrangement of layered nodes. The depth of nodes is computed by distance from the root, leading to a ragged appearance. Cartesian orientations are also supported. Implementation based on work by Jeff Heer and Jason Davies using Buchheim et al.'s linear-time variant of the Reingold-Tilford algorithm. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

Compare to this Cartesian layout.

@andybryant
andybryant / .gistup
Last active September 21, 2016 10:27
Network topology
gistup
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!