Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
sandipchitale / UUIDGen.java
Created April 24, 2021 19:14
UUIDGen #UUID
package com.example.zuuldemo;
import java.util.UUID;
import java.util.stream.IntStream;
public class UUIDGen {
public static void main(String[] args) {
IntStream.range(1, 100)
.forEach((i) -> {
System.out.println(UUID.nameUUIDFromBytes(String.valueOf(System.currentTimeMillis()).getBytes()).toString().replace("-", "") + " millis: " + System.currentTimeMillis());
@sandipchitale
sandipchitale / docs.html
Created April 24, 2021 18:54
Zuul Docs #zuul
<a href="https://cloud.spring.io/spring-cloud-netflix/multi/multi__router_and_filter_zuul.html">Zuul Docs</a>
@sandipchitale
sandipchitale / index.js
Created January 14, 2021 01:20
axe+puppeteer
const util = require('util');
const puppeteer = require('puppeteer');
const axe = require('axe-core');
const urls = [
];
const results = [];
@sandipchitale
sandipchitale / URIComponentsFromCurrentRequest.java
Created December 31, 2020 07:57
Build URI compoents from current request considering4 x-forwarded-* headers #springboot
UriComponents uriComponents = UriComponentsBuilder.fromHttpRequest(
new ServletServerHttpRequest(((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest())).build();
@sandipchitale
sandipchitale / tabId.js
Created December 21, 2020 01:31
Assign next tabId to every new tab and save in session storage
(function() {
// Does this tab have a tabId
let tabId = sessionStorage.getItem("tabId");
if (tabId === null) {
// no tabId for this tab
// Is lastTabId stored in local storage
let lastTabId = localStorage.getItem("lastTabId");
if (lastTabId === null) {
// no lastTabId saved in local storage
lastTabId = -1;
@sandipchitale
sandipchitale / doskey.mac
Last active December 18, 2020 04:17
Save and show and put history in clipboard with REM prefix
-="C:\Program Files\Microsoft VS Code\Code.exe" "%USERPROFILE%\cmd.history"
_=doskey /history | wsl grep -e '^^[-_+.]' -v | wsl grep -e '^^break' -v | wsl grep -e '^^)' -v | findstr "^" >> "%USERPROFILE%\cmd.history"
+=type "%USERPROFILE%\cmd.history"
.=type "%USERPROFILE%\cmd.history" | wsl awk 'BEGIN { print "break||(" ;} { print $1 } END { print ")" }' | clip
_u=(type "%USERPROFILE%\cmd.history" | wsl awk '!a[$0]++' | findstr "^" > "%USERPROFILE%\cmd.history.bkp") && (type "%USERPROFILE%\cmd.history.bkp" > "%USERPROFILE%\cmd.history") && (del "%USERPROFILE%\cmd.history.bkp")
@sandipchitale
sandipchitale / recipe.gradle
Last active November 18, 2020 22:41
Simple recipe based execution of tasks
// Apply using the following at the end of build.gradle
//
// if (hasProperty('RECIPE')) {
// apply from: 'recipe.gradle'
// }
//
// Usage:
//
// > .\gradlew.bat -PRECIPE=First
//
@sandipchitale
sandipchitale / apply-gradle-taskinfo.gradle
Created November 15, 2020 00:48
Apply gradle-taskinfo plugin to rootProject
initscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.org.barfuin.gradle.taskinfo:gradle-taskinfo:1.0.3"
}
}
@sandipchitale
sandipchitale / build-only-tasks.gradle
Last active October 31, 2020 19:53
Specify which order tasks should run in specified or natural
// Apply this from main build script using:
// if (rootProject.hasProperty('only-tasks')) {
// apply from: 'build-only-tasks.gradle'
// }
//
// Usage:
//
// gradlew -Ponly-tasks
// gradlew -Ponly-tasks -Pprompt-for-tasks
// gradlew -Ponly-tasks -Pprompt-for-tasks -Pspecified-order
@sandipchitale
sandipchitale / pom.xml
Last active November 6, 2020 03:09
Generic mechanism to install self to local repository in m2 folder
<!--
To use this goal invoke it like this:
> mvnw install:install-file@m2
This will install the artifact in local folder m2/repository
-->
<build>
<plugins>
<plugin>