Skip to content

Instantly share code, notes, and snippets.

View mohanmca's full-sized avatar

Mohan Narayanaswamy mohanmca

View GitHub Profile
@clintongormley
clintongormley / unique_words.js
Created April 3, 2017 16:26
Only return docs where all of the words in the docs are in the query
PUT t
{
"settings": {
"analysis": {
"analyzer": {
"unique_terms": {
"tokenizer": "standard",
"filter": [
"lowercase",
"unique"
@jdegoes
jdegoes / FreeMonad.scala
Created August 21, 2016 16:24
A pedagogical free(er) monad in 23 lines of Scala
sealed trait Free[F[_], A] { self =>
final def map[B](ab: A => B): Free[F, B] = Free.flatMap(self, ab andThen (Free.point[F, B](_)))
final def flatMap[B](afb: A => Free[F, B]): Free[F, B] = Free.flatMap(self, afb)
final def interpret[G[_]: Monad](fg: F ~> G): G[A] = self match {
case Free.Point(a0) => a0().point[G]
case Free.Effect(fa) => fg(fa)
case fm : Free.FlatMap[F, A] =>
val ga0 = fm.fa.interpret[G](fg)
ga0.flatMap(a0 => fm.afb(a0).interpret[G](fg))
}
@leonardofed
leonardofed / README.md
Last active July 19, 2024 17:51
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@vasanthk
vasanthk / System Design.md
Last active July 27, 2024 18:36
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
package osgi;
import java.io.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.*;
import org.osgi.util.promise.*;
import org.reactivestreams.*;
package hu.akarnokd.reactiveflowbridge;
import java.util.Objects;
import java.util.concurrent.Flow;
import java.util.function.Function;
/**
* Bridge between Reactive-Streams API and the Java 9 Flow API.
*/
public final class ReactiveFlowBridge {