Skip to content

Instantly share code, notes, and snippets.

View Nimfadora's full-sized avatar

Valeria Nimfadora

View GitHub Profile
@Nimfadora
Nimfadora / docker-ha-cluster
Created January 17, 2019 13:24
setup high-availability Hadoop cluster (ha) on docker
#perform all steps from this tutorial till "A note about vsyscall"
https://docs.docker.com/samples/library/centos/
#proceed with download and configuration steps from
https://www.edureka.co/blog/how-to-set-up-hadoop-cluster-with-hdfs-high-availability/
#commit your container
#stop and remove running container
#create separate network
@Nimfadora
Nimfadora / kafka-cheat-sheet.md
Created December 19, 2018 11:21 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@Nimfadora
Nimfadora / BenchmarkUaUtils.java
Last active March 21, 2018 12:29
Benchmark viewability support analysis
package com.jenkov;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Range;
import org.apache.commons.lang3.StringUtils;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import java.util.List;
import java.util.concurrent.TimeUnit;
private static final List<Pair<Pattern, String>> UA_PATTERN_TO_FRIENDLY_NAME = asList(
// IE
Pair.of(compile(""".*; MSIE ([.0-9]*);.*"""), "Internet Explorer"),
Pair.of(compile(""".*WOW64.*rv:([.0-9]*).*"""), "Internet Explorer"),
Pair.of(compile(""".*Trident.*rv:([.0-9]*).*"""), "Internet Explorer"),
Pair.of(compile(""".*IEMobile/([.0-9]*).*"""), "Internet Explorer Mobile"),
Pair.of(compile(""".*Windows Phone ([.0-9]*).*"""), "Internet Explorer Mobile"),
// Edge
Pair.of(compile(""".*EdgA/([.0-9]*).*"""), "Edge for Android"),
Pair.of(compile(""".*EdgiOS/([.0-9]*).*"""), "Edge for iOS"),
@Nimfadora
Nimfadora / gsoc_2017_final_report.md
Last active August 29, 2017 08:02
GSoC 2017 Final Report

Project ideaQuality of source code can be examined by many different tools, Checkstyle is one of them, but not the only one. Checkstyle team uses its own tool to check its sources. But there is no limit to perfection and we can make Checkstyle source code even better than it is now. The idea is to reuse and configure some other well-known static code analysers (PMD,  Sonar, Eclipse, IntelliJ IDEA Inspection, HuntBugs, SpotBugs, Pitest) to run all rules, checks, inspections, validations, mutations on Checkstyle main and test source

public class TestBiFunction {
public static void main(String ... args){
//don't want to resolve dates in constructor -> compile error
List<GroovyReportTask> reportTasks = ReportUtils.splitInterval(firstDay, today,
(dtStart, dtEnd) -> new GroovyReportTask(getScriptFile(), null, dtStart, dtEnd));
}
public static <T extends ReportTask> List<T> splitInterval(Date startDay, Date endDayExclusive, int interval, BiFunction<Date, Date, T> builderForDay) {
Date startOfEndDay = DateUtil.startOfGMTDay(endDayExclusive);