Skip to content

Instantly share code, notes, and snippets.

View Col-E's full-sized avatar

Matt Col-E

View GitHub Profile
@Col-E
Col-E / ReadSpeedTest output.txt
Created September 5, 2025 01:03
1brc snippets
java.vm.vendor: Eclipse Adoptium
java.vm.name: OpenJDK 64-Bit Server VM
java.vendor.version: Temurin-22+36
java.vendor.url.bug: https://github.com/adoptium/adoptium-support/issues
os.name: Windows 10
os.arch: amd64
=================================
Samsung SSD 990 Pro 2TB (7.4 GB/s)
Input: 1,000,000,000 rows (13.4 GB)
=================================
@Col-E
Col-E / decompile.java
Last active August 23, 2025 13:21
Recaf 4X decompile script for command line use
/*
An example script showcasing how batch decompilation can be enriched with
multiple Recaf features such as:
- Inserting comments into classes & members
- Pre-processing classes to clean up some obfuscation
Usage: Add arguments for this task after the ';' character - see below for how this is handled and arg options
java -jar recaf.jar -i <jar-to-decompile> -s decompile.java -h -q ; <args-for-this-script>
java -jar recaf.jar -i <jar-to-decompile> -s decompile.java -h -q
*/
@Col-E
Col-E / Refactor_to_use_PixelBuffer.patch
Created June 2, 2025 17:39
GLCanvas PixelBuffer patch
Subject: [PATCH] Refactor to use PixelBuffer
---
Index: src/main/java/software/coley/glcanvasfx/GLCanvas.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/software/coley/glcanvasfx/GLCanvas.java b/src/main/java/software/coley/glcanvasfx/GLCanvas.java
--- a/src/main/java/software/coley/glcanvasfx/GLCanvas.java (revision 0b9c86da003f4529142f481ecc8ec37e2268605c)
+++ b/src/main/java/software/coley/glcanvasfx/GLCanvas.java (date 1748885813652)
@Col-E
Col-E / StackPrinting.java
Last active October 31, 2024 08:03
Stack printing System.exit(int) values
// Authors: xdark, Col-E
AccessPatcher.patch();
MethodHandles.Lookup lookup = LookupUtil.lookup();
Runnable hook = () -> {
try {
Class<?> stackFrameClass = Class.forName("java.lang.LiveStackFrame");
MethodHandle getLocals = lookup.findVirtual(stackFrameClass, "getLocals", MethodType.methodType(Object[].class))
.asType(MethodType.methodType(Object[].class, Object.class));
@Col-E
Col-E / Test.java
Created April 19, 2022 12:51
SSVM/emulation of JDK fails with since NoSuchMethodException should be NoSuchFieldException
package me.coley.recaf.ssvm;
import dev.xdark.ssvm.VirtualMachine;
import dev.xdark.ssvm.api.VMInterface;
import dev.xdark.ssvm.execution.ExecutionContext;
import dev.xdark.ssvm.execution.Result;
import dev.xdark.ssvm.execution.VMException;
import dev.xdark.ssvm.fs.FileDescriptorManager;
import dev.xdark.ssvm.fs.HostFileDescriptorManager;
import dev.xdark.ssvm.mirror.InstanceJavaClass;
@Col-E
Col-E / android-adb-pull-apk.md
Created December 2, 2020 06:00 — forked from ctrl-freak/android-adb-pull-apk.md
Retrieve APK from Non-Rooted Android Device through ADB

https://stackoverflow.com/a/18003462/348146

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

package me.coley.recaf.parse.bytecode;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Col-E
Col-E / Context.java
Created January 23, 2020 08:23
Simulation Draft
package sim;
import java.util.Stack;
/**
* Method invoke context.
*/
public class Context {
private final VirtualValue<?>[] locals;
private final Stack<VirtualValue<?>> stack = new Stack<>();
@Col-E
Col-E / Bayes.java
Last active December 12, 2019 21:36
Minimal Naive-Bayes classifier
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* A minimal Naive-Bayes classifier.
*
* @param <C>
* Category type.
* @param <A>
@Col-E
Col-E / CSSPlayground.java
Created November 28, 2019 12:31
Live CSS tampering
package me.coley.recaf.ui.controls.theme;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.SplitPane;
import javafx.scene.image.Image;
import javafx.scene.input.KeyCode;
import javafx.stage.Stage;