Skip to content

Instantly share code, notes, and snippets.

View bijay-shrestha's full-sized avatar
👨‍🎓
MSCS Compro

Bijay Shrestha bijay-shrestha

👨‍🎓
MSCS Compro
  • Bank of America
  • SF, CA
View GitHub Profile

What is Consul?

Consul is a distributed service mesh to connect, secure, and configure services across any runtime platform and public or private cloud

Consul Installation and usage

  1. Download and install Consul on Ubuntu 18.04 from here
@bijay-shrestha
bijay-shrestha / Spring Boot.md
Last active June 30, 2019 07:05
The gist is a complete guide to`why's` of Spring Boot

What is the spring-boot-configuration-processor ?

Doing so, scans the libraries in the build and sees what properties they use so as to inform the IDE

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-configuration-processor</artifactId>
	<optional>true</optional>
</dependency>
@bijay-shrestha
bijay-shrestha / DatabasesConfig.java
Created July 1, 2019 06:49 — forked from mismatch/DatabasesConfig.java
Spring Boot. Multiple datasources configuration example
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
appName.dbOne.datasource.driverClassName=org.postgresql.Driver
appName.dbOne.datasource.url=jdbc:postgresql://localhost/dbOne
appName.dbOne.datasource.username=test
appName.dbOne.datasource.password=test
appName.dbTwo.datasource.driverClassName=org.postgresql.Driver
appName.dbTwo.datasource.url=jdbc:postgresql://localhost/dbTwo
appName.dbTwo.datasource.username=test
appName.dbTwo.datasource.password=test
@bijay-shrestha
bijay-shrestha / Visual Studio.md
Last active July 4, 2019 05:26
No space error due to watchers

EPNOC error

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Install ngrok

  1. Download ngrok for your favorite OS.
  2. Unzip and, if you want, add it to your path (Move it to /usr/local/binor use your favorite command)

$ unzip /path/to/ngrok.zip

Key

YZVR7WDLV8-eyJsaWNlbnNlSWQiOiJZWlZSN1dETFY4IiwibGljZW5zZWVOYW1lIjoiamV0YnJhaW5zIGpzIiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTktMTEtMjYifSx7ImNvZGUiOiJBQyIsInBhaWRVcFRvIjoiMjAxOS0xMS0yNiJ9LHsiY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAxOS0xMS0yNiJ9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDE5LTExLTI2In0seyJjb2RlIjoiR08iLCJwYWlkVXBUbyI6IjIwMTktMTEtMjYifSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAxOS0xMS0yNiJ9LHsiY29kZSI6IkNMIiwicGFpZFVwVG8iOiIyMDE5LTExLTI2In0seyJjb2RlIjoiUlMwIiwicGFpZFVwVG8iOiIyMDE5LTExLTI2In0seyJjb2RlIjoiUkMiLCJwYWlkVXBUbyI6IjIwMTktMTEtMjYifSx7ImNvZGUiOiJSRCIsInBhaWRVcFRvIjoiMjAxOS0xMS0yNiJ9LHsiY29kZSI6IlBDIiwicGFpZFVwVG8iOiIyMDE5LTExLTI2In0seyJjb2RlIjoiUk0iLCJwYWlkVXBUbyI6IjIwMTktMTEtMjYifSx7ImNvZGUiOiJXUyIsInBhaWRVcFRvIjoiMjAxOS0xMS0yNiJ9LHsiY29kZSI6IkRCIiwicGFpZFVwVG8iOiIyMDE5LTExLTI2In0seyJjb2RlIjoiREMiLCJwYWlkVXBUbyI6IjIwMTktMTEtMjYifS

Copy and Paste the following snippet into your spring boot application project and change the parametersas you find fit.

spring.datasource.url=jdbc:mysql://localhost:3306/jpa?createDatabaseIfNotExist=true
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=create-drop
@bijay-shrestha
bijay-shrestha / axios-catch-error.js
Created August 26, 2019 06:56 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨