Skip to content

Instantly share code, notes, and snippets.

View ashutosh049's full-sized avatar

ashutosh ashutosh049

  • Pune
View GitHub Profile
@ashutosh049
ashutosh049 / gist:6feb6758e04e7f088404fe7f4c74c94e
Last active October 12, 2021 19:17
Problems making a many-to-many relationship work across 2 microservices using Spring Boot & Hibernate
Use case: assign an already existing task to an already existing user.
Yuo can assign multiple users at a time to 1 single task
post: /tasks/allocation/new
```json
{
"task-id": 12345,
"users": [
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.IntStream;
@ashutosh049
ashutosh049 / System Design.md
Created May 18, 2021 21:11 — forked from vasanthk/System Design.md
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?
@ashutosh049
ashutosh049 / Spring-Boot-custom-parent.md
Last active August 7, 2020 18:18
A comprehensive list of dependencies managed by latest Spring-Boot 2.3.2.RELEASE (as a custom parent)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.company</groupId>
  <artifactId>company-boot-starter</artifactId>
  <version>1.0-SNAPSHOT</version>

At some point in any software project, you will need to share your code with other developers. If you’re using Git for source control, there are three primary options: Github, Bitbucket, or Gitlab. Understanding the differences and tradeoffs between these three repository management platforms is vital to choosing the best option for your team.

Managing branches

Create and push a new branch

  • Before creating a new branch, pull the changes from upstream. Your master needs to be up to date.

    $ git pull

  • Create the branch on your local machine and switch onto this new branch

@ashutosh049
ashutosh049 / Install RabbitMq on Amamzon EC2 (Amazon Linux 2).md
Last active April 12, 2020 05:29
Install RabbitMq on Amamzon EC2 (Amazon Linux 2)

#1.Updates all packages the the latest version available.

sudo yum -y update

#2.Package Dependencies before installing RabbitMq

  • erlang
  • socat
  • logrotate

#3.Enable the EPEL repository

@ashutosh049
ashutosh049 / DockerSpringBootLoggingUsingSyslogAndLogstash.md
Created March 1, 2020 14:42 — forked from jamescookie/DockerSpringBootLoggingUsingSyslogAndLogstash.md
Centralised logging for Docker containers running Spring Boot applications

Centralised logging for Docker containers running Spring Boot applications

Log flow through the system

Log flow

About

We have a bunch of Spring Boot apps running in various Docker containers and wanted a centralised place to view the logs

@ashutosh049
ashutosh049 / gist:d714f921c7b4e2e4a741051b737abf33
Created October 29, 2019 05:57
Spring Boot Encryption with JASYPT
visit: https://stackoverflow.com/a/58601972/5324721
generated encrypted string from command does not give desired result as it can not encrypt special chards like "!".and gives error "event not found"
> KAD@ashutosh MINGW64 ~/Desktop
> $ java -cp
> ~/.m2/repository/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar
> org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI
> input="Test!email30#password" password="some_salt"
@ashutosh049
ashutosh049 / openAndClosePrices.java
Created September 25, 2019 07:20 — forked from andersonmo/openAndClosePrices.java
Q4 - Stock Open Close Price on Particular Weekdays (www.hackerrank.com)
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.net.*;
import com.google.gson.*;
//------ My code -----------
import java.io.InputStreamReader;
NOTE: Source/Credit https://algs4.cs.princeton.edu/cheatsheet/
We summarize the performance characteristics of classic algorithms and data structures for sorting, priority queues, symbol tables, and graph processing.
We also summarize some of the mathematics useful in the analysis of algorithms, including commonly encountered functions, useful formulas and appoximations, properties of logarithms, order-of-growth notation, and solutions to divide-and-conquer recurrences.
Sorting. The table below summarizes the number of compares for a variety of sorting algorithms, as implemented in this textbook. It includes leading constants but ignores lower-order terms.
ALGORITHM CODE IN PLACE STABLE BEST AVERAGE WORST REMARKS