Skip to content

Instantly share code, notes, and snippets.

View SamratV's full-sized avatar

Vaibhaw Samrat SamratV

View GitHub Profile
@SamratV
SamratV / Adaptive.sublime-theme
Last active August 8, 2022 19:19
In order to fix the font size and indentation of sidebar in Sublime Text, create a "<theme-name>.sublime-theme" file in "~/.config/sublime-text/Packages/User" folder. For instance, if you are using the "Adaptive" theme then create "Adaptive.sublime-theme" file with the following content.
[
{
"class": "sidebar_label",
"color": [255, 255, 255],
"font.bold": false,
"font.size": 15
},
{
"class": "sidebar_container",
"content_margin": [-12, -10, -12, 0]
@SamratV
SamratV / how_to_run.txt
Last active July 10, 2022 17:40
How to run p4-pubsub?
1) Open 3 terminal windows (say T1, T2 and T3).
2) In terminal window T1 run the following commands:
(a) cd ~/project
(b) git checkout <branch-name> (<branch-name> could be "fullcs", "nocs", "rpca1" or "ca2")
(c) git branch (to check the current branch [optional])
(d) cd pubsub
(e) make (wait for mininet terminal to appear)
3) In terminal window T2 run the following commands:
@SamratV
SamratV / CustomerRestController.java
Created April 27, 2020 19:27 — forked from darbyluv2code/CustomerRestController.java
CustomerRestController.java (full CRUD)
To fully test the different options, you'll need code in CustomerRestController that supports POST, PUT and DELETE. Here's the code:
package com.luv2code.springdemo.rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@SamratV
SamratV / DemoSecurityConfig.java
Created April 27, 2020 19:26 — forked from darbyluv2code/DemoSecurityConfig.java
DemoSecurityConfig.java (roles)
package com.luv2code.springdemo.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
@SamratV
SamratV / SecurityWebApplicationInitializer.java
Created April 27, 2020 19:09 — forked from darbyluv2code/SecurityWebApplicationInitializer.java
Spring CRM REST - SecurityWebApplicationInitializer
package com.luv2code.springdemo.config;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
public class SecurityWebApplicationInitializer
extends AbstractSecurityWebApplicationInitializer {
}
@SamratV
SamratV / DemoSecurityConfig.java
Created April 27, 2020 19:09 — forked from darbyluv2code/DemoSecurityConfig.java
Spring CRM REST - DemoSecurityConfig (basic)
package com.luv2code.springdemo.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.User;
@SamratV
SamratV / CourseCode.java
Created February 28, 2020 09:23 — forked from darbyluv2code/CourseCode.java
Spring MVC Validation - FAQ: Is it possible to integrate multiple validation string in one annotation?
package com.luv2code.springdemo.mvc.validation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@SamratV
SamratV / Student.java
Created February 25, 2020 09:53 — forked from darbyluv2code/Student.java
FAQ: How to populate radiobuttons with items from Java class like we did with selectlist?
package com.luv2code.springdemo.mvc;
import java.util.LinkedHashMap;
public class Student {
private String firstName;
private String lastName;
private String favoriteLanguage;
@SamratV
SamratV / MyLoggerConfig.java
Created February 18, 2020 06:44 — forked from darbyluv2code/MyLoggerConfig.java
Spring Logging for Spring 5.1 - All Java Configuration
package com.luv2code.springdemo;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;