Skip to content

Instantly share code, notes, and snippets.

View ravibharathii's full-sized avatar

Ravi Ramamoorthy ravibharathii

View GitHub Profile
@ravibharathii
ravibharathii / NoopHostnameVerifier.java
Created April 21, 2020 16:21
Suppress Domain Name mismatch SSL error
final SSLConnectionSocketFactory sslsf;
try {
sslsf = new SSLConnectionSocketFactory(SSLContext.getDefault(),
NoopHostnameVerifier.INSTANCE);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
final Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", new PlainConnectionSocketFactory())

Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL)

Windows just released the windows subsystem for linux feature to the public with its latest windows fall creator update, if you are not familiar with this feature it allows you to run linux binaries natively on windows - F.A.Q.

Enabling WSL

The feature is not enabled by default and you need to activate it, you can do it via powershell (with admin rights):

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
@ravibharathii
ravibharathii / WSL Install Guide.md
Created March 25, 2020 02:28 — forked from kevbost/WSL Install Guide.md
WSL Install Guide Windows

Ubuntu

Windows Subsystem for Linux [Very Easy Installation]

  1. https://msdn.microsoft.com/commandline/wsl/install_guide
    • [Follow instructions carefully and remember your password]
    • [it will prompt for password]
    • [password will not appear while you type, just push enter when finished]
  2. Open "Bash on Ubuntu on Windows"
  3. Run the commands formatted as code separately
  • (they will take a while to complete)
LocalTime midnight = LocalTime.MIDNIGHT;
System.out.println(midnight);
LocalDate today = LocalDate.now(ZoneId.of("UTC"));
System.out.println(today);
LocalDateTime todayMidnight = LocalDateTime.of(today, midnight);
System.out.println(todayMidnight);
ZonedDateTime todyzdt = todayMidnight.atZone(ZoneId.of("UTC"));
System.out.println(todyzdt);
long todaymillis = todyzdt.toInstant().toEpochMilli();
System.out.println(todaymillis);
@ravibharathii
ravibharathii / CommonHelper.java
Last active April 26, 2018 12:31
Common Helper
package com.webtrixs.healthcheck.helper;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@ravibharathii
ravibharathii / Java version check Mac
Created April 26, 2018 08:05
Java version check Mac
To get list java version install in mac
/usr/libexec/java_home -V
To get specific java version installed in mac
/usr/libexec/java_home -v 1.7
{
"name": "javascript-development-environment",
"version": "1.0.0",
"description": "JavaScript development environment Starter Kit",
"scripts": {
},
"author": "Cognizant Team",
"license": "MIT",
"dependencies": {
"whatwg-fetch": "1.0.0"
@ravibharathii
ravibharathii / Javascript
Created April 22, 2015 16:19
Jquery Document Load
$( document ).ready(function() {
console.log( "ready!" );
});
@ravibharathii
ravibharathii / Strong Password RegEx
Created October 29, 2012 18:03
A Regular Expression for a Strong Password
Description of this regular expression is as below:
Passwords will contain at least 1 upper case letter
Passwords will contain at least 1 lower case letter
Passwords will contain at least 1 number or special character
Passwords will contain at least 8 characters in length
Password maximum length should not be arbitrarily limited
(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$
@ravibharathii
ravibharathii / gist:3834906
Created October 4, 2012 16:52 — forked from seanwcom/detect_ie.js
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}