Skip to content

Instantly share code, notes, and snippets.

View ashutosh049's full-sized avatar

ashutosh ashutosh049

  • Pune
View GitHub Profile
public class RomanNumeralsGenerator {
enum Numeral {
I(1), IV(4), V(5), IX(9), X(10), XL(40), L(50), XC(90), C(100), CD(400), D(500), CM(900), M(1000);
int weight;
Numeral(int weight) {
this.weight = weight;
}
};
@ashutosh049
ashutosh049 / KongJwt.md
Created April 29, 2019 11:55 — forked from martinheld/KongJwt.md
Short example to use JWT with Kong

JWT Kong Example

  • Get and Start Kong and Co
git clone git@github.com:Mashape/docker-kong.git
cd docker-kong/compose
docker-compose up
  • Create Kong API Route
@ashutosh049
ashutosh049 / ConnectorConfig.java
Created September 3, 2019 09:43 — forked from ThomasVitale/ConnectorConfig.java
How to enable HTTPS in a Spring Boot Application
@Configuration
public class ConnectorConfig {
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
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
@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;
@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 / 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 / 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

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 / 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>