Skip to content

Instantly share code, notes, and snippets.

View asdf913's full-sized avatar

asdf913

  • Hong Kong
  • Hong Kong
View GitHub Profile
@asdf913
asdf913 / PutyConfigurationRegistryReport.java
Created November 8, 2026 05:03
Putty Configuration Registry Report
import java.nio.file.FileSystems;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.function.BiFunction;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@asdf913
asdf913 / KeyStoreCertificateUpdater.java
Created October 27, 2026 04:19
Java Console Program to add a SSL Certificate of a specified URL to the specified keystore if the keystore does not have the latest SSL Certificate of a specified URL
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Proxy;
import java.net.URL;
@asdf913
asdf913 / HongKongHoliday1823.java
Last active October 25, 2026 14:36
Hong Kong Public Holiday (Source 1823)
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@asdf913
asdf913 / Hkpl.java
Last active October 24, 2026 02:09
Hong Kong Public Library List - Area, District, Name, Address, Opening Hours and URL
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
@asdf913
asdf913 / PolymarketGeographicRestrictionsApiGui.java
Created October 6, 2026 03:05
Java Program to call Polymarket Geographic Restrictions API
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.function.Predicate;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.function.FailableFunction;
@asdf913
asdf913 / LuckySimComparison.java
Last active October 5, 2026 14:18
Compare the Lucky Sim Hong Kong Local Data Price
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.Objects;
import java.util.regex.MatchResult;
@asdf913
asdf913 / GuiDetection.java
Created October 3, 2026 10:54
Detect the current java process is started by double click or by command (Double click invocation = GUI, triggered by command=CLI)
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Proxy;
import java.nio.file.FileSystems;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
@asdf913
asdf913 / VerboseClassLog.java
Created October 1, 2026 02:15
Get the list of class in the verbose class log (log generated by java -verbose:class)
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Proxy;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashMap;
@asdf913
asdf913 / SftpUploadBatch.java
Created September 24, 2026 05:21
Java program to upload file via SFTP
package org.apache.sshd.client;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Proxy;
@asdf913
asdf913 / KeyStoreSslReport.java
Created September 12, 2026 04:51
Java program to find out the SSL certificate of specified URL and its latest expiry date
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Proxy;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;