Skip to content

Instantly share code, notes, and snippets.


Kohinoor Gupta kogupta

Block or report user

Report or block kogupta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kogupta / AliceInAggregatorLand.scala
Created Mar 8, 2017 — forked from johnynek/AliceInAggregatorLand.scala
A REPL Example of using Aggregators in scala
View AliceInAggregatorLand.scala
* To get started:
* git clone
* cd algebird
* ./sbt algebird-core/console
* Let's get some data. Here is Alice in Wonderland, line by line

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
kogupta /
Created Jun 1, 2018
Created this as a template for "async" decompressing - check for more details
import com.ning.compress.DataHandler;
import com.ning.compress.UncompressorOutputStream;
import com.ning.compress.gzip.GZIPUncompressor;
import com.ning.compress.lzf.LZFUncompressor;
import io.netty.handler.codec.http.HttpHeaders;
import org.asynchttpclient.AsyncHandler;
import org.asynchttpclient.HttpResponseBodyPart;
import org.asynchttpclient.HttpResponseStatus;
kogupta / Apache Kafka on Ubuntu.txt
Last active Jun 12, 2018 — forked from SemenMartynov/Apache Kafka on Ubuntu.txt
kafka installation on ubuntu 16.04
View Apache Kafka on Ubuntu.txt
Install and configure Apache Kafka on Ubuntu 16.04
1. Install Java (JDK8)::
Add the repository
$ sudo add-apt-repository -y ppa:webupd8team/java
Update the metadata of the new repository and install JDK
kogupta /
Created Jun 13, 2018
A delegating that enables Socket configuration
import java.util.function.Consumer;
* A {@link SocketFactory} that delegates calls. Sockets can be configured after creation by
* overriding {@link #configureSocket(}.
kogupta /
Created Jun 14, 2018
bean introspection using lambda metafactory
import java.lang.invoke.LambdaMetafactory;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
kogupta /
Created Jul 8, 2018
function throwing checked exception
public interface ThrowingFunction<I, O, T extends Throwable> {
O apply(I i) throws T;
kogupta /
Last active Jul 19, 2018
Exploration in binary json formats
import com.codahale.metrics.Histogram;
import com.codahale.metrics.SlidingTimeWindowArrayReservoir;
import com.codahale.metrics.Snapshot;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.deser.std.FromStringDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
kogupta /
Last active Sep 13, 2018
Range search in LmdbJava
import org.lmdbjava.*;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneOffset;
import java.util.Comparator;
kogupta /
Created Sep 19, 2018
Iterating over a jdk ByteBuffer
public final class ByteBufIterator {
public static void main(String[] args) {
ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES * 10);
for (int i = 0; i < 10; i++) buffer.putInt(i);
buffer.flip(); // dont forget to flip!!!
// read in groups of 3
// so 4 BBs, 3 of size 3 and 1 of 1
final int end = buffer.limit(), stride = 3 * Integer.BYTES;
You can’t perform that action at this time.