Skip to content

Instantly share code, notes, and snippets.

View zygm0nt's full-sized avatar
🥑
AFK

Marcin Cylke zygm0nt

🥑
AFK
View GitHub Profile
@zygm0nt
zygm0nt / linkedhashmap.java
Created November 28, 2016 15:46
linkedHashMap collector
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.function.Function;
import java.util.stream.Collector;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toMap;
public class LinkedHashMapCollector {
@zygm0nt
zygm0nt / service-checklist.md
Created September 26, 2016 21:57 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="registry"></div>
<script src="js/compiled/clojure_manager.js" type="text/javascript"></script>
</body>
@zygm0nt
zygm0nt / author stats
Created August 28, 2015 12:39
author contribution count
for i in `cat /tmp/authors`
do
echo $i ; git log --author="$i" --pretty=tformat: --numstat \
| gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' -
done
@zygm0nt
zygm0nt / Monoid.scala
Last active August 29, 2015 14:23
Cookie Monoid
case class CookieBox(count: Int)
trait Monoid[T] {
def zero: T
def append(t1: T, t2: T): T
}
object CookieBox {
implicit val CookieBoxMonoid = new Monoid[CookieBox] {
val zero = CookieBox(0)
@zygm0nt
zygm0nt / word similarity.scala
Created June 10, 2015 06:44
word similarity - editable distance (Reco)
import com.allegrogroup.reco.model.{MetaItemType, Item}
import com.allegrogroup.reco.recommender.decorator.EditDistance
import java.nio.file.{Paths, Files}
import java.nio.charset.StandardCharsets
val distance: (Iterable[Char], Iterable[Char]) => Int = EditDistance[Char]
//val items = sc.objectFile[Item]("/projects/reco_prod/data/items/service_account_id=ALG/v_date=2015-06-01/part-00087")
val items = sc.objectFile[Item]("/projects/reco_prod/data/items/service_account_id=ALG/v_date=2015-06-01/")
@zygm0nt
zygm0nt / gist:4d31de2f2c933109917d
Created February 18, 2015 10:07
check kafka consumers backlog
./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker -zkconnect zookeeper.host:2181/external/kasia/kafka --group SparkStreamingJob-com.company.PurchaseEventSparkStreaming
@zygm0nt
zygm0nt / s.scala
Last active August 29, 2015 14:14
case class Task(a: Int, b: Int)
case class TaskResult(result: Int)
class Collector(worker: ActorRef) extends Actor {
def receive = {
case task: Task => worker ! task
case TaskResult(r) => println(s"Got result: $r")
}
}
@zygm0nt
zygm0nt / README.md
Created July 31, 2014 06:33
spark 1.0.1 with akka 2.3.0
@zygm0nt
zygm0nt / gist:0ec12209d02b2c284efb
Created May 26, 2014 12:46
sonar-scoverage-plugin.error
SonarQube Runner 2.4
Java 1.7.0_55 Oracle Corporation (64-bit)
Linux 3.8.0-38-generic amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: /home/user/Downloads/sonar-runner-2.4/conf/sonar-runner.properties
INFO: Project configuration file: /tmp/sonar-scoverage-plugin/samples/sbt/multi-module/sonar-project.properties
INFO: Default locale: "en_GB", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Work directory: /tmp/sonar-scoverage-plugin/samples/sbt/multi-module/./.sonar
INFO: SonarQube Server 4.3
14:39:07.867 INFO - Load batch settings