Skip to content

Instantly share code, notes, and snippets.

@hkneptune
hkneptune / soap_request_mtom.cs
Created March 27, 2026 04:08
SOAP Request Samples
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
/// <summary>Holds file attachment metadata for a SOAP request.</summary>
public class AttachmentData
@hkneptune
hkneptune / wildfly-control.sh
Created October 14, 2025 03:36
WildFly Startup Script
#!/bin/bash
# WildFly Startup Script
# Configuration variables
WILDFLY_HOME="/opt/wildfly-12.0.0.Final"
STANDALONE_DIR="standalone"
BIND_ADDRESS="0.0.0.0"
WILDFLY_BIN="${WILDFLY_HOME}/bin"
STANDALONE_FULL_PATH="${WILDFLY_HOME}/${STANDALONE_DIR}"
@hkneptune
hkneptune / oracle-db-19c-centos-8-in-virtualbox.md
Last active October 3, 2025 10:01
Install Oracle Database 19c on CentOS 8 in VirtualBox

Install Oracle Database 19c on CentOS 8 in VirtualBox

** Please use the root user to edit the files and execute the commands unless further notice. **

Prerequisite

  1. Install the latest VirtualBox Platform Package and the VirtualBox Extension Pack (Oracle_VM_VirtualBox_Extension_Pack-VERSION.vbox-extpack).
  2. Download the latest VirtualBox Guest Additions (VBoxGuestAdditions_VERSION.iso).
  3. Download the latest CentOS Stream 8.
  4. Create a new virtual machine and install the CentOS to the virtual machine. During the CentOS installation, select Workstation as Base Environment, select Container Management, Development Tools and Graphical Administration Tools as Additional software for Selected Environment. Use http://mirror.centos.org/centos/8/BaseOS/x86_64/os/ as the installation source.
@hkneptune
hkneptune / centos8.md
Created February 17, 2022 02:00
Upgrade CentOS Linux 8 to CentOS Stream 8

Fix the AppStream Issue

[root@centos8 ~]# yum update
CentOS-8 - AppStream 71 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

As CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. It means that CentOS 8 will no longer receive development resources from the official CentOS project. To keep your CentOS updated, you may update the mirrors or upgrade to CentOS Stream.

@hkneptune
hkneptune / mysql-8-centos-8-in-virtualbox.md
Last active November 9, 2023 04:01
Install MySQL 8 on CentOS 8 in VirtualBox

Install MySQL 8 on CentOS 8 in VirtualBox

** Please use the root user to edit the files and execute the commands unless further notice. **

Prerequisite

  1. Install the latest VirtualBox Platform Package and the VirtualBox Extension Pack (Oracle_VM_VirtualBox_Extension_Pack-VERSION.vbox-extpack).
  2. Download the latest VirtualBox Guest Additions (VBoxGuestAdditions_VERSION.iso).
  3. Download the latest CentOS Linux release 8.
  4. Create a new virtual machine and install the CentOS to the virtual machine. During the CentOS installation, select Workstation as Base Environment, select Container Management, Development Tools and Graphical Administration Tools as Additional software for Selected Environment. Use http://mirror.centos.org/centos/8/BaseOS/x86_64/os/ as the installation source.
@hkneptune
hkneptune / sha256sum.java
Created October 9, 2023 03:58
SHA256Sum
public static String sha256(File input) throws IOException {
Digest sha256 = new Digest();
sha256.update(Files.readAllBytes(input.toPath()));
StringBuilder buff = new StringBuilder();
for (byte b : sha256.digest()) {
buff.append(String.format("%02x", b & 0xFF));
}
@hkneptune
hkneptune / xml_signing.java
Created October 9, 2023 03:51
Signing XML File Content with p12 File
public static String signXmlContent(String inputFile, String keyStoreFilePath,
String keyStorePassword, String keyStoreAlias) throws Exception {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new FileInputStream(keyStoreFilePath), keyStorePassword.toCharArray());
DocumentBuilderFactory buildFactory = DocumentBuilderFactory.newInstance();
buildFactory.setNamespaceAware(true);
Document document = buildFactory.newDocumentBuilder().parse(inputFile);
XMLSignatureFactory xmLSignatureFactory = XMLSignatureFactory.getInstance("DOM",
(Provider) Class.forName("org.jcp.xml.dsig.internal.dom.XMLDSigRI").newInstance());
/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
var $jscomp = $jscomp || {};
$jscomp.scope = {};
$jscomp.arrayIteratorImpl = function(array) {
var index = 0;
return function() {
@hkneptune
hkneptune / Normalize.java
Last active January 31, 2022 20:21
The utility class to solve the Path Manipulation issue found by the Fortify Static Code Analyzer.
/**
* Path Manipulation (Input Validation and Representation, Data Flow)
*
* **Abstract:**
*
* Attackers are able to control the file system path argument, which allows them to access or
* modify otherwise protected files.
*
* **Explanation:**
*
@hkneptune
hkneptune / Discuz4.0.0Crack.md
Created January 1, 2022 05:49
Discuz 4.0.0 (20051001) Crack

Discuz! 4.0.0 (20051001) Crack

  1. Replace the include/validate.class.php file
  2. Create a discuz_license.php file in the root directory