Skip to content

Instantly share code, notes, and snippets.

View dineshbhagat's full-sized avatar
🌏 dev-engers assemble

DB dineshbhagat

🌏 dev-engers assemble
View GitHub Profile
@dineshbhagat
dineshbhagat / apache-camel-url.md
Last active July 10, 2019 16:18
apache-camel-url pattern for version higher and lesser than 2.22.0

apache-camel-kafka version >= 2.22

# consumer URL, should be in one line, for readability added new lines
kafka.url=kafka://
${kafka.topic}
?
brokers=${kafka.broker}&
&groupId=${kafka.groupId}
serializerClass=org.apache.kafka.common.serialization.StringSerializer&
keySerializerClass=org.apache.kafka.common.serialization.StringSerializer&
// in testing module
package com.example.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.test.EmbeddedKafkaBroker;
import org.springframework.kafka.test.context.EmbeddedKafka;
/**
   ABC
 x  AA
 ------
 AACC
/*
for (int i = 1; i <= 9; i++) {

openjdk-shenandoah-jdk11

Get builds from here: https://builds.shipilev.net/

if it is not found for your platform, you can build it from source:

For macosx:

Download source code from here

follow steps

@dineshbhagat
dineshbhagat / configure-iterm2.sh
Last active June 21, 2023 17:50
Shell script to configure iterm2 with oh-my-z, nerd font, powerlevel10k
brew install zsh;
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)";
cd $ZSH/custom/plugins;
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git && git clone https://github.com/zsh-users/zsh-autosuggestions && git clone https://github.com/zsh-users/zsh-completions;
# from now on your default shell is zsh, customize by editing ~/.zshrc file
brew tap homebrew/cask-fonts;
brew install --cask font-hack-nerd-font;
brew install coreutils
cd ~/Desktop;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.reflect.TypeToken;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
@dineshbhagat
dineshbhagat / zigzag-encoding.README
Created November 9, 2019 06:55 — forked from mfuerstenau/zigzag-encoding.README
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation
public class PascalTriangle {
// Ref: https://leetcode.com/submissions/detail/293484403/
// if you do not see "hello" as output in console, it means 2311 is prime number:
// Ref: https://www.youtube.com/watch?v=D7AHbyAlgIA&list=PL5KkMZvBpo5CdoOxa3dqll2n6KsXqerYO&index=11
// https://en.wikipedia.org/wiki/AKS_primality_test
public static void main(String[] args) throws Exception {
List<BigInteger> generate = generate(2311);
System.out.println(generate);
for (int i = 0; i < generate.size(); i++) {
@dineshbhagat
dineshbhagat / resilience4j Spring boot properties.md
Created September 10, 2020 13:04
Spring boot 2 properties for resilience4j
resilience4j.circuitbreaker.metrics.enabled=true
resilience4j.circuitbreaker.metrics.legacy.enabled=true

# following properties can be added for individual circuit breakers (CB-name is one of the circuit breaker, replace it)

resilience4j.circuitbreaker.instances.<CB-name>.sliding-window-type=TIME_BASED
resilience4j.circuitbreaker.instances.<CB-name>.sliding-window-size=100
resilience4j.circuitbreaker.instances.<CB-name>.minimum-number-of-calls=100
resilience4j.circuitbreaker.instances.<CB-name>.failure-rate-threshold=10