Skip to content

Instantly share code, notes, and snippets.

View vanjis's full-sized avatar

Vanjinathan Sivaprakasam vanjis

View GitHub Profile
@vanjis
vanjis / switch-java-versions.txt
Last active February 1, 2021 15:31
Switch java version on windows
Create a new "java8.bat" file.
Add the following in the file and save.
```
@echo off
set JAVA_HOME=C:\OpenJDK_1_8_RedHat\java-1.8.0-openjdk-1.8.0.232-3.b09.redhat
set Path=%JAVA_HOME%\bin;%Path%
echo Java 8 activated.
```
Create a new "java11.bat" file.
Add the following in the file and save.
@vanjis
vanjis / thirukural.json
Created October 30, 2019 20:09
Thirukural
{
"chapter":{
"name":"chapterName",
"number":1
},
"section":{
"name":"sectionName",
"number":1
},
"kural":[
@vanjis
vanjis / string_date_notes.txt
Last active August 20, 2019 13:13
String to Date
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy");
String dateString = "01-May-2017";
Date date = formatter.parse(dateString);
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
dateString = localDateTime.format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
localDateTime = LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern("dd-MMM-yyyy"));
Timestamp timestamp = Timestamp.valueOf(localDateTime);
localDateTime = timestamp.toLocalDateTime();
@vanjis
vanjis / TomacatConfiguration_1.java
Last active March 1, 2019 18:42
Forcing HTTPS in spring boot 1
@Bean
public EmbeddedServletContainerFactory getEmbeddedServletContainerFactory() {
TomcatEmbeddedServletContainerFactory containerFactory = new TomcatEmbeddedServletContainerFactory();
containerFactory.addContextCustomizers(new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
SecurityConstraint constraint = new SecurityConstraint();
constraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
@vanjis
vanjis / TomacatConfiguration_2.java
Last active March 1, 2019 18:43
Forcing HTTPS in spring boot 2
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
Note for me to remember how to set Android Home on Mac
Open Terminal and type in..
nano ~/.bash_profile
Add the below paths
The path should be where your android installation is located
export ANDROID_HOME=/Users/username/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Save file and type in terminal...
source ~/.bash_profile