Skip to content

Instantly share code, notes, and snippets.

View SecretX33's full-sized avatar

SecretX SecretX33

View GitHub Profile
@SecretX33
SecretX33 / hd-cloning-guide.md
Last active April 26, 2025 16:32
HD cloning guide (using DD)

Disk Cloning and File Transfer Using DD and Netcat

1. Clone an Entire Disk via Network Using DD

Example scenario:

You want to copy your entire 1TB NMVE SSD into a new, 2TB NMVE SSD you bought, you have two computers, but both of them only have one NMVE slot each, so a direct copy from one SSD into the other using only one computer isn't needed.

Steps:

  1. Install the source disk 1TB SSD in the source computer and the 2TB SSD in the target computer.
  2. Boot both computers into a Linux Live environment (e.g., Ubuntu, Debian, or any distro with SSH and dd).
@SecretX33
SecretX33 / guide-how-to-migrate-kh-saves.md
Last active February 23, 2025 15:20
A step-by-step guide to migrate KH saves from one KH version to the other (or from one savefile to the other)

How to Migrate Save Files Between Kingdom Hearts Versions (EGS to Steam, etc.)

This guide is primarily intended for PC players; however, it can be adapted for other platforms with the necessary adjustments.

During my attempt to transfer my Kingdom Hearts (KH) save file from the Epic Games Store (EGS) version to the Steam version, I encountered numerous challenges. After extensive research and trial and error, I successfully migrated my save data. This guide documents my findings and the exact steps I followed. While my process focused on migrating from EGS to Steam, the method should also work in reverse.

Additionally, with this knowledge, you will be able to extract specific save slots from one save file and insert them into another. To do this, you can skip any modifications to the "sys" entry, as it is unnecessary when transferring individual slots.

I've also used this guide with great success to migrate my PS2 (.psu) KH2 save to play on PC.

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@SecretX33
SecretX33 / CoroutineScheduledExecutorService.kt
Last active January 3, 2025 14:30
CoroutineScheduledExecutorService - Bridge between Kotlin Coroutines and Java ScheduledExecutorService
import arrow.core.nonFatalOrThrow
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.util.concurrent.AbstractExecutorService
@SecretX33
SecretX33 / MyLogFilter.java
Last active February 16, 2025 13:07
How to create and register a Logger filter into Spigot/Paper server
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.filter.AbstractFilter;
import org.apache.logging.log4j.message.Message;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@SecretX33
SecretX33 / closeable.kt
Created April 30, 2022 17:35
Proper Kotlin Closeable close function
inline fun <T> Closeable.use(block: () -> T): T {
var exception: Throwable? = null
try {
return block()
} catch (e: Throwable) {
exception = e
throw e
} finally {
when (exception) {
null -> close()
@SecretX33
SecretX33 / benchmark.kt
Created April 30, 2021 20:36
Kotlin bench used to calculate how many times does a function take to run, on average
inline fun bench(run: () -> Unit) = (0..1_000_000).map {
measureTime(run).inMicroseconds
}.average()
bench {
// first code
}.toString() + "us"
bench {
// second code
@SecretX33
SecretX33 / ObservableSyncList.kt
Last active February 27, 2021 20:13
Observable Synchronized List
class ObservableSyncList<T>(list: MutableList<T> = ArrayList()) : SyncList<T>(list), ListListener {
override val observers: MutableMap<UUID, SilentObserver> = ConcurrentHashMap()
override fun add(element: T) = super.add(element).also { notifyObservers() }
override fun addAll(elements: Collection<T>) = super.addAll(elements).also { notifyObservers() }
override fun set(index: Int, element: T): T = super.set(index, element).also { notifyObservers() }
@SecretX33
SecretX33 / listenerObserver.kt
Last active March 23, 2021 13:14
Listener (without synchronization)
open class Listener<T>(element: T) {
var value: T = element
protected set(value) {
field = value
notifyObservers(field)
}
private val observers: MutableMap<UUID, Observer<T>> = ConcurrentHashMap()
private fun notifyObservers(newValue: T) {
observers.forEach { it.value.onChange(newValue) }