Skip to content

Instantly share code, notes, and snippets.

View gAmUssA's full-sized avatar
so hard

Viktor Gamov gAmUssA

so hard
View GitHub Profile
@gAmUssA
gAmUssA / CurrencyProcessing.kt
Last active October 13, 2019 00:56
CurrencyProcessing.kt
import org.apache.kafka.streams.kstream.KGroupedStream
import org.apache.kafka.streams.kstream.KStream
import org.springframework.stereotype.Component
import org.springframework.cloud.stream.annotation.StreamListener
@Component
class CurrencyProcessing {
@StreamListener
fun processCurrency(input: KStream<String, Double>) {
@gAmUssA
gAmUssA / benchmark-commands.txt
Created June 15, 2018 13:19 — forked from zodvik/benchmark-commands.txt
Kafka (1.0.0) Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-two --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-one --num-records 6000000 --throughput 100000 --record-size 100 --producer-props bootstrap.servers=kafka_host:9092 buffer.memory=67108864 batch.size=8196
Single-thread, async 3x replication
@gAmUssA
gAmUssA / ConsoleTable.java
Created June 11, 2018 19:10 — forked from Wneh/ConsoleTable.java
Java class that prints a matrix/table to the console
/* The MIT License (MIT)
* Copyright (c) 2012 Carl Eriksson
*
* Permission is hereby granted, free of charge, to any person obtaininga
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction,including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
@gAmUssA
gAmUssA / kafka_wireshark.md
Created June 6, 2018 20:21 — forked from doubleirish/kafka_wireshark.md
Using Wireshark to sniff kafka message packets on ubuntu

#Using wireshark to sniff kafka messages

Install the latest WireShark application

 sudo add-apt-repository ppa:wireshark-dev/stable
 sudo apt-get update
 sudo apt-get install wireshark
@gAmUssA
gAmUssA / ksql-ccloud.properties
Last active March 10, 2018 00:01
Do you want to use #KSQL with #ConfluentCloud https://confluent.cloud? Here's how 👇👇👇
# a comma separated list of the the ccloud broker endpoints. e.g.
bootstrap.servers=r0.great-app.confluent.aws.prod.cloud:9092,r1.great-app.confluent.aws.prod.cloud:9093,r2.great-app.confluent.aws.prod.cloud:9094
ksql.sink.replicas=3
replication.factor=3
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=\
org.apache.kafka.common.security.plain.PlainLoginModule required \
username="<confluent cloud access key>" \
password="<confluent cloud secret>";
package com.nyjavasig.how.hazelcast.demo;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
public class WordUtil {
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.8.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</hazelcast>
@gAmUssA
gAmUssA / ZookeeperTest.java
Created April 13, 2017 16:14
simple ZK discover / query client
package com.hazelcast.zookeeper;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.x.discovery.ServiceDiscovery;
import org.apache.curator.x.discovery.ServiceDiscoveryBuilder;
import org.apache.curator.x.discovery.ServiceInstance;
@gAmUssA
gAmUssA / puzzler8.run
Created November 8, 2016 18:27
Set puzzler
Set<Integer> set = new HashSet<>(Arrays.asList(1,2,3,4,5))
System.out.println(set);
/exit
Asciidoctor EPUB3 1.5.0.dev using Asciidoctor 1.5.3 [http://asciidoctor.org]
Runtime Environment (ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin13.3.0]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)
/usr/local/Cellar/rbenv/0.4.0/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/asciidoctor-epub3-1.5.0.dev/lib/asciidoctor-epub3/converter.rb:336:in `listing': undefined method `gsub' for nil:NilClass (NoMethodError)
from /usr/local/Cellar/rbenv/0.4.0/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/asciidoctor-epub3-1.5.0.dev/lib/asciidoctor-epub3/converter.rb:89:in `convert'
from /usr/local/opt/rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/asciidoctor-1.5.3/lib/asciidoctor/abstract_block.rb:71:in `convert'
from /usr/local/opt/rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/asciidoctor-1.5.3/lib/asciidoctor/abstract_block.rb:80:in `block in content'
from /usr/local/opt/rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/asciidoctor-1.5.3/lib/asciidoctor/abstract_block.rb:80:in `map'
from /usr/local/opt/rbenv/