Skip to content

Instantly share code, notes, and snippets.

@djparks
djparks / PojoTester.java
Created October 7, 2025 21:03
A simple POJO tester class
package com.example.sb_3_tests.util;
import org.junit.jupiter.api.Assertions;
import java.lang.reflect.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.*;
import java.util.*;
@djparks
djparks / storageClear.min.js
Created July 21, 2025 21:20
Clear Storage
javascript:Object.keys(localStorage).forEach(function(t){t.startsWith("https://start")&&localStorage.removeItem(t)}),Object.keys(sessionStorage).forEach(function(t){t.startsWith("https://start")&&sessionStorage.removeItem(t)}),document.cookie.split(";").forEach(function(t){let s=t.trim().split("=")[0];s.startsWith("https://start")&&(document.cookie=s+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/")}),alert('Local storage, session storage, and cookies starting with "https://start" have been cleared.');

Keytool CheatSheet 🔐

Some history

This cheat sheet came into life when I started working on a tutorial of setting up one way tls and two way tls, which can be found here: GitHub - Mutual TLS SSL

Creation and importing

Generate a Java keystore and key pair

keytool -genkeypair -keyalg RSA -keysize 2048 -keystore keystore.jks -alias server -validity 3650
@djparks
djparks / pom.xml
Last active April 29, 2025 21:21
Make Maven Output completion timestamp and play a sound when done.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>build-completion-notification</id>
<phase>install</phase>
<goals>
<goal>run</goal>
@djparks
djparks / MainMethodFinder.java
Created September 8, 2023 22:28 — forked from thomasdarimont/MainMethodFinder.java
Small tool to find classes with executable main methods in a given JDK.
import jdk.internal.org.objectweb.asm.*;
import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Consumer;
/**
@djparks
djparks / stress.sh
Created June 26, 2023 15:21 — forked from mikepfeiffer/stress.sh
Install Stress Utility on Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
public class SocketUtils {
public static int findFreePort(int minPort, int maxPort) {
for (int i = minPort; i < maxPort; i++) {
if (isPortAvailable(i)) {
return i;
@djparks
djparks / vscmacros_launc_bash.js
Created July 3, 2022 23:08 — forked from exceedsystem/vscmacros_launc_bash.js
An example of 'Bash launcher' macro for VSCodeMacros extension
// [VSCode Macros] extension
// https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
const vscode = require('vscode');
/**
* Macro configuration
*/
module.exports.macroCommands = {
LaunchBash: {
no: 1,
@djparks
djparks / vscmacros_remove_duplicate_lines.js
Created July 3, 2022 23:07 — forked from exceedsystem/vscmacros_remove_duplicate_lines.js
An example of 'Remove Duplicate Lines' macro for VSCodeMacros extension
// [VSCode Macros] extension
// https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
const vscode = require('vscode');
/**
* Macro configuration
*/
module.exports.macroCommands = {
RemoveDuplicateLines: {
no: 1,
@djparks
djparks / insert_random_id_using_node.js
Created July 3, 2022 23:07 — forked from exceedsystem/insert_random_id_using_node.js
An example of 'Insert Random ID using Node.js' macro for VSCodeMacros extension
// [VSCode Macros] extension
// https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
// License:MIT
const vscode = require('vscode');
const crptrndstr = require('crypto-random-string');
module.exports.macroCommands = {
InsertRandomID: {
no: 1,
func: insertRandomId,