Skip to content

Instantly share code, notes, and snippets.

View zlataovce's full-sized avatar

Matouš Kučera zlataovce

View GitHub Profile
@zlataovce
zlataovce / index.js
Created September 9, 2026 12:22
A slicer script for prompting about concealed data in a class file.
import { read, write, FLAG_SKIP_ATTR_PARSE } from "https://cdn.jsdelivr.net/npm/@katana-project/asm@0.25.4/+esm";
export default {
name: "Extra bytes?",
description: "Prompts about extra bytes following a ClassFile structure.",
version: "1.0.0",
load(context) {
context.addEventListener("transform", async (e) => {
if (e.name.endsWith(".class")) {
// we need to use the untransformed data, since the event's data is already normalized (no extra bytes)
@zlataovce
zlataovce / index.js
Last active July 2, 2026 13:29
A slicer script for formatting JSON.
const indentSizeOption = {
type: "radio",
id: "json-formatter/indent-size",
label: "Indent size",
items: [
{
id: "2",
label: "2 spaces",
},
{
@zlataovce
zlataovce / index.js
Created July 2, 2026 13:01
A slicer script for formatting JS and JSON.
import "https://cdn.jsdelivr.net/npm/js-beautify@2.0.3/js/lib/beautify.js";
const indentSizeOption = {
type: "radio",
id: "js-formatter/indent-size",
label: "Indent size",
items: [
{
id: "2",
label: "2 spaces",
@zlataovce
zlataovce / doom.js
Last active April 3, 2026 19:51
A slicer script for playing DOOM, a demonstration of the tab registration API.
export default {
name: "DOOM",
description: "Runs DOOM via JS-DOS",
version: "1.0.0",
load(context) {
context.editor.register({
id: "tab/doom",
label: "DOOM",
icon: {
@zlataovce
zlataovce / main.js
Created November 7, 2025 16:36
A slicer script for importing Minecraft JARs easily.
const MANIFEST_URL = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json";
const categorizeVersion = (version) => {
const v = version.id;
if (v.startsWith("c") || v.startsWith("rd-")) return "classic";
if (v.startsWith("inf-") || v.startsWith("in-")) return "infdev_indev";
if (v.startsWith("a")) return "alpha";
if (v.startsWith("b")) return "beta";
if (/^\d{2}w\d{2}[a-z]/.test(v) || /^\d{4}/.test(v)) return "snapshots";
@zlataovce
zlataovce / buffer_stream.ts
Last active October 29, 2024 16:11
A streaming DataView abstraction.
// A streaming DataView abstraction. (c) 2024 zlataovce (github.com/zlataovce)
// License: Public domain (or MIT if needed). Attribution appreciated.
// https://gist.github.com/zlataovce/7db8bc7cfe8b7897816495bf2ec3858d
const DEFAULT_LITTLE_ENDIAN = true;
const MIN_READ = 1024; // 1 KiB
const INITIAL_BUF_SIZE = MIN_READ * 1.5; // 1.5 KiB
type Awaitable<T> = T | PromiseLike<T>;
export const EOF = new Error("End of stream");
@zlataovce
zlataovce / buffer.ts
Created September 30, 2024 20:50
An offset-tracking DataView abstraction.
// An offset-tracking DataView abstraction. (c) 2024 zlataovce (github.com/zlataovce)
// License: Public domain (or MIT if needed). Attribution appreciated.
// https://gist.github.com/zlataovce/42b87282e33bef4295981e177754dc13
const DEFAULT_BUFFER_SIZE = 1024;
const DEFAULT_RESIZE = 32;
const DEFAULT_LITTLE_ENDIAN = true;
export interface Buffer {
view: DataView;
arrayView: Uint8Array;
@zlataovce
zlataovce / ClassNode.java
Created June 18, 2024 16:18
A Java class file header reader.
package dev.cephx.cfr.reader;
import java.util.Objects;
public final class ClassNode {
private int major;
private int minor;
private int access;
private String name;
@zlataovce
zlataovce / mappings.py
Last active August 25, 2023 05:30
A mapping joiner for creating Mojang -> Spigot ProGuard mappings, useful for deobfuscation of heapdumps.
from argparse import ArgumentParser
from re import compile
CLASS_PATTERN = compile(r" -> ([^:]+):$")
# you can get these mapping files at Spigot's developer hub and Mojang's version metadata
# and you can get the links to them from https://mappings.cephx.dev/1.20.1/licenses.html
if __name__ == "__main__":
parser = ArgumentParser(description="Joins Mojang ProGuard and Spigot CSRG class mappings.")
parser.add_argument("--mojang", "-m", help="the Mojang mapping path", default="./server.txt")