Skip to content

Instantly share code, notes, and snippets.

View rdkafka_test.rb
require 'rdkafka'
config = {
:"bootstrap.servers" => "localhost:9092"
}
rdkafka = Rdkafka::Config.new(config)
producer = rdkafka.producer
topic = "test.test_foobar"
payload = '{"foo":"bar"}'
@gom
gom / 00_build.gradle
Last active Feb 5, 2019
Compare HLL Benchmark: airlift.stats and stream-lib
View 00_build.gradle
plugins {
id 'java'
id 'application'
id "com.github.johnrengelman.shadow" version "4.0.4"
}
group 'com.gomlog'
version '1.0-SNAPSHOT'
mainClassName = 'com.gomlog.hll.benchmark.Comparison'
View ruby_kafka_add_cluster_benchmark.rb
require 'benchmark'
require 'set'
# Create random topics
cl = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten
topics = ->(m) { (0..rand(m)).map{ (0..1).map { cl[rand(cl.length)] }.join }}
MAX_TOPICS = [5, 10, 20, 50, 100]
TRIALS = 1000000
@gom
gom / jmx_exporter_flink_1.4.yml
Created Apr 6, 2018
Prometheus JMX exporter config for Flink 1.4.x
View jmx_exporter_flink_1.4.yml
@gom
gom / 00_error.log
Last active Apr 12, 2018
Flink PrometheusReporter ingenerates "Invalid metric name" errors.
View 00_error.log
2018-04-04 15:30:58,215 WARN org.apache.flink.runtime.metrics.MetricRegistryImpl - Error while registering metric.
java.lang.IllegalArgumentException: Invalid metric name: flink_jobmanager.Status.JVM.CPU_Time
at org.apache.flink.shaded.io.prometheus.client.Collector.checkMetricName(Collector.java:171)
at org.apache.flink.shaded.io.prometheus.client.SimpleCollector.<init>(SimpleCollector.java:163)
at org.apache.flink.shaded.io.prometheus.client.Gauge.<init>(Gauge.java:68)
at org.apache.flink.shaded.io.prometheus.client.Gauge$Builder.create(Gauge.java:74)
at org.apache.flink.metrics.prometheus.PrometheusReporter.createCollector(PrometheusReporter.java:170)
at org.apache.flink.metrics.prometheus.PrometheusReporter.notifyOfAddedMetric(PrometheusReporter.java:146)
at org.apache.flink.runtime.metrics.MetricRegistryImpl.register(MetricRegistryImpl.java:319)
at org.apache.flink.runtime.metrics.groups.AbstractMetricGroup.addMetric(AbstractMetri
View powertop.service
sudo apt-get install bcmwl-kernel-source
sudo apt-get install \
vim \
scratch \
leafpad \
julia \
scratch \
git \
bpython3 \
@gom
gom / sunday_list.py
Created Apr 14, 2017
Python3.x: Print every Sunday
View sunday_list.py
from datetime import datetime
from dateutil.relativedelta import relativedelta, SU
from dateutil.rrule import rrule, WEEKLY
import argparse
def main(args):
start = datetime.strptime(args.start_date, "%Y%m%d")
today = datetime.today()
rule = rrule(WEEKLY, byweekday=SU, dtstart=start, until=today)
View NotNonNull.java
package sandbox;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import javax.validation.constraints.NotNull;
View count_seven.py
import math
def count_seven(n):
c = 0
for i in range(n+1):
c += str(i).count("7")
return c
def count_seven_digit_num(num):
digit_num = len(str(num)) - 1
View main.go
package main
type Spannable interface {
Len() int
}
type MyString struct {
v string
}
type MyStringPointer struct {
You can’t perform that action at this time.