Skip to content

Instantly share code, notes, and snippets.

import React from 'react';
import { render, Box, Text } from 'ink';
import { useInput, useApp } from 'ink';
import { Tabs, Tab, TabProps } from 'ink-tab';
import { useState, useEffect } from 'react';
import Table from 'ink-table'
import TextInput from 'ink-text-input';
import sys
watermark = 0
with open('blocknumbers') as f:
current = int(f.readline())
if(current % 1000 == 0):
print(current)
if not (watermark + 1 == int(current)):
print("inconsistency at " + str(watermark) + ", " + str(current));
sys.exit(-1)
watermark = current
package com.github.simplesteph.udemy.kafka.streams
import java.lang
import java.util.Properties
import org.apache.kafka.clients.consumer.ConsumerConfig
import org.apache.kafka.common.serialization.Serdes
import org.apache.kafka.streams.kstream.{KStream, KStreamBuilder, KTable}
import org.apache.kafka.streams.{KafkaStreams, KeyValue, StreamsConfig}
@jpzk
jpzk / gist:0c74cb3686bbd050641ac873b32621aa
Created July 11, 2019 06:22
transactional producer kafka
package au.com.simplesteph.kafka.kafka0_11.demo
import java.util.Properties
import org.apache.kafka.clients.producer.{KafkaProducer, Producer, ProducerConfig, ProducerRecord}
import org.apache.kafka.common.KafkaException
import org.apache.kafka.common.errors.AuthorizationException
import org.apache.kafka.common.errors.OutOfOrderSequenceException
import org.apache.kafka.common.errors.ProducerFencedException
import slick.jdbc.PostgresProfile
import slick.jdbc.PostgresProfile.api._
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
class ExtractorConfig(tag: Tag) extends Table[(String, Long, String)](tag, "configs") {
def name = column[String]("name", O.PrimaryKey)

Keybase proof

I hereby claim:

  • I am jpzk on github.
  • I am madewithtea (https://keybase.io/madewithtea) on keybase.
  • I have a public key ASDfJ35UsJlF18WijZ5j8R4MOeeTFtXze8wHt8CEU-LjSAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jpzk on github.
  • I am madewithtea (https://keybase.io/madewithtea) on keybase.
  • I have a public key ASDfJ35UsJlF18WijZ5j8R4MOeeTFtXze8wHt8CEU-LjSAo

To claim this, I am signing this object:

@jpzk
jpzk / easy-schema-registry.txt
Created November 30, 2018 11:25
Easy way to delete schemas in the schema registry
apt install peco
apt install curl
curl http://localhost:8081/subjects | jq .[] | tr -d "\"" | peco | xargs -I '{}' curl -v -X DELETE http://localhost:8081/subjects/'{}'
@jpzk
jpzk / gist:8ad2692dc8b89bc4f8783150c152527d
Created November 11, 2016 16:41
Twitter util time control + MockTimer scheduling
import com.twitter.util._
import com.twitter.conversions.time._
val timer = new MockTimer()
def schedule(timer: Timer) = {
timer.schedule(1.second) {
println("statement")
}
}
Verifying that +jendrik is my blockchain ID. https://onename.com/jendrik