Skip to content

Instantly share code, notes, and snippets.

View sunil-bagde's full-sized avatar

Sunil Bagde sunil-bagde

View GitHub Profile
@sunil-bagde
sunil-bagde / SSLCertificateValidation.java
Created September 8, 2021 21:46 — forked from mariuszprzydatek/SSLCertificateValidation.java
mariuszprzydatek.com blog example on how to disable SSL certificate validation in Java
package my.hydepark.ssl;
import javax.net.ssl.*;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
public class SSLCertificateValidation {
public static void disable() {
try {
@sunil-bagde
sunil-bagde / tiffMerged.js
Last active September 22, 2021 19:08
Tiff merge
// https://stackoverflow.com/questions/17062219/pass-multiple-parameters-to-processbuilder-with-a-space
// https://stackoverflow.com/questions/15384879/imagemagick-using-more-than-2gb-of-memory-to-convert-pdf-files
// https://www.imagemagick.org/script/command-line-options.php#limit
// Set '-limit memory 0 -limit map 0'. If that fails, you'll need a larger instance of a Amazon server to run ImageMagick.
// https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=23090
// https://github.com/imagemagick/imagemagick/issues/327
/* convert -background '#dfe1ff' -pointsize 40 -fill blue -gravity south \
https://github.com/simpletut/Testing-React-Redux-with-Jest-and-Enzyme/blob/master/Utils/index.js
https://www.robinwieruch.de/react-connected-component-test
https://hacks.mozilla.org/2018/04/testing-strategies-for-react-and-redux/
https://sabljakovich.medium.com/basic-authentication-with-axios-nodejs-browser-cfabe08ced39
https://mkyong.com/spring-boot/spring-rest-spring-security-example/
https://github.com/mkyong/spring-boot/tree/master/spring-rest-security

Primitive types

undefined string number boolean object symbol

null

@sunil-bagde
sunil-bagde / base-converter.js
Created October 30, 2021 13:43 — forked from kopiro/base-converter.js
Convert any number from base X to base X in Javascript
function base_converter(nbasefrom, basefrom, baseto) {
var SYMBOLS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (basefrom<=0 || basefrom>SYMBOLS.length || baseto<=0 || baseto>SYMBOLS.length) {
console.log("Base unallowed");
return null;
}
var i, nbaseten=0;
if (basefrom!=10) {
var sizenbasefrom = nbasefrom.length;
for (i=0; i<sizenbasefrom; i++) {

Simple typescript with react v4.3

const greeting: string = "Hello typescript";

const year: number = 2022;

const addTwoNumber = (a:number, b:number): number => a + b;

function addTwoNumber(a: number, b:number): number {
@sunil-bagde
sunil-bagde / reactjs-limits-chars-perlineand limits-line.js
Created February 20, 2022 17:38
reactjs-limits-chars-perlineand limits-line.js
import React from "react";
// https://stackoverflow.com/questions/63597602/javascript-regex-to-limit-number-of-characters-per-line
// Regex https://regex101.com/r/lOI5to/1 :- /^.{0,10}(?:\n.{0,10}){0,1}$/
/*
.App {
font-family: sans-serif;
text-align: center;
@sunil-bagde
sunil-bagde / gist:461853acd281897f2929d7de64f78124
Last active September 4, 2023 09:16
some-tailwind-config
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {
fontFamily: {
sans: ["Lato", "sans-serif"],
},
@sunil-bagde
sunil-bagde / min-heap.js
Created December 26, 2023 14:55
JS min hep
class MinHeap {
constructor(data = []) {
this.data = data;
this.comparator = (a, b) => a - b;
this.heapify();
}
heapify() {
if (this.size < 2) return;
for (let i = 1; i < this.size; i++) {