Uncategorized
RabittMQ RPC Request/Response example
RabittMQ RPC Request/Response example using hoplin.io library Following example creates RPC client and then setups Async response handler, which follows by the request to get processed. Hoplin client supports both Direct-Reply and Queue per Request/Response patterns. This is the binding that is used to create our client.
Extended GIT Information in bash PS1
Extended GIT Information in bash PS1 This will generate shell similar to this : Multiline version: ┌──┤ greg: ~/dev/discovery/discovery-agent │ master ≡ !1 +2 -2 ≡ 2 weeks ago └── λ Format `branch ≡ changes additions deletions ≡ last commit`Example `master ≡ !1 +2 -2 ≡ 2 weeks ago` Since we are interested in interactive …
Hamming distance calculation
This is a small snippet of how to calculate hamming distance in cpp with small bit of assembly for doing a population count. Code typedef unsigned long long hash_t; #include #include int popcount64(const hash_t& val) noexcept { int ret; __asm__ (“popcnt %1, %1” : “=r” (ret) : “0” (val)); return ret; } int hamming_distance(const hash_t& …
Histogram Comparison for Image Analysis
DRAFT This is the first article in the series on Image Comparison using Local Binary Patterns.Complete code is on github lbp-matcher We will start off by looking at different methods of comparing histograms. Histogram Intersection Log Likehood Chi Squared Kullback Leibler Divergence All our operations will be performed on 8bpp(bits per pixel) images anything that …
Image Comparison using Local Binary Patterns
This is a series of small articles on Image Comparison using Local Binary Patterns. Topics I like to cover will include Histogram Comparsion Local Binary Patterns Perceptual Hashing From there we will go into building a system that can recognize same words/images in a document.
Overloading by return value in C++
Here we have a method that allows us to determine return parameter type using templates and operator overloading in C++. This is something that I needed for a project that I am working on where a method call would give me the expected type based on the return type. Usage There is two way of …
Kryo (missing no-arg constructor): java.nio.HeapByteBuffer
While serializing ByteBuffer using Kryo we will run into the following issue. Class cannot be created (missing no-arg constructor): java.nio.HeapByteBuffer To fix this we can create a custom serializer that will take a ByteBuffer and serialize it to and from Kryo. Serializer is rather simple all we need is two pieces of data, length of …
Kryo (missing no-arg constructor): java.nio.HeapByteBuffer Read More »
Recursively GREP for specific content
nohup egrep -rnw ‘=\s112’ –include=*.java ./ 2>&1 | tee ~/112-audit-nick.txt
Exponential backoff
In a variety of computer networks, binary exponential backoff or truncated binary exponential backoff refers to an algorithm used to space out repeated retransmissions of the same block of data, often as part of network congestion avoidance. Wikipedia Exponential backoff Here is an implementation in Java /** * Calculate Exponential backoff * * @param attempt …
