Skip to content

Instantly share code, notes, and snippets.

View raksja's full-sized avatar

raksja raksja

  • CA
View GitHub Profile
@davideicardi
davideicardi / README.md
Last active May 4, 2025 21:48
Write and read Avro records from bytes array

Avro serialization

There are 4 possible serialization format when using avro:

@atamborrino
atamborrino / ExecutionContextMonitor.scala
Last active April 14, 2022 09:10
Monitor Scala's ExecutionContext / Akka Dispatcher lag (number of tasks in waiting queues)
import java.util.concurrent._
import akka.dispatch.{Dispatcher, ExecutorServiceDelegate}
import config.Config
import helpers.ScalaLogger
class ExecutionContextMonitor()(implicit metricsService: MetricsClient, config: Config) {
private val log = ScalaLogger.get(this.getClass)
private val scheduler = Executors.newSingleThreadScheduledExecutor()
@atamborrino
atamborrino / sparkEc.scala
Last active December 10, 2020 16:01
Serializable Scala ExecutionContext for Spark. Allows to automatically re-create a thread-pool per Spark worker.
class ECProvider()(implicit conf: Config) extends Serializable {
@transient implicit lazy val ec: ExecutionContext = {
ExecutionContext.fromExecutorService(
Executors.newWorkStealingPool(conf.getForkJoinPoolMaxParallelism())
)
}
}
@yssharma
yssharma / BfsDfs.java
Created October 31, 2012 11:13
BFS + DFS (Breadth First Search + Depth First Search) (Confused Coders)
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
class Node {
String data;
boolean visited;
List<Node> neighbours = new ArrayList<Node>();
@caniszczyk
caniszczyk / git-pre-receive-hook.sh
Created October 31, 2011 13:17
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.