Skip to content

Instantly share code, notes, and snippets.

View quat1024's full-sized avatar
🐾
what's with this dog motif?

quaternary quat1024

🐾
what's with this dog motif?
View GitHub Profile
@quat1024
quat1024 / Opts.java
Last active June 2, 2024 17:55
Good-enough command line argument parsing in about a page of Java
// This is kind of shaped like lexopt: https://github.com/blyxxyz/lexopt
sealed interface Opt permits ShortOpt, LongOpt, MiscOpt {
default boolean isShort(char c) { return this instanceof ShortOpt o && o.opt == c; }
default boolean isLong(String l) { return this instanceof LongOpt o && o.opt.equals(l); }
}
record ShortOpt(char opt) implements Opt {} //the "a", "b", or "c" in "-abc"
record LongOpt(String opt) implements Opt {} //the "option" in "--option"
record MiscOpt(String etc) implements Opt {} //something without a hyphen prefix
@quat1024
quat1024 / ParserExploration2.java
Last active September 10, 2023 05:47
pratt parsing in java, but succinct
package agency.highlysuspect.parsefunny;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.stream.Collectors;
//This is sort of a synthesis of the parsers described in these two articles:
@quat1024
quat1024 / readme.txt
Created July 23, 2023 07:50
backtracking maze algorithm (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@quat1024
quat1024 / faq.md
Last active June 8, 2023 09:46
fractureiser public FAQ

What is this?

fractureiser is a multi-stage Java virus (and potential worm) that infects Java .jar files, and is a targeted attack on the Minecraft-playing community.

The virus was initially distributed by infecting legitimate Minecraft mods with the virus and reposting them to CurseForge under a different name, using a brand-new account. Eventually, someone who was logged into CurseForge downloaded and ran one of these infected mods, the stage3 payload swiped their browser cookies; and the attacker used these cookies to log in as them and upload a couple more infected mods under their account.

(CurseForge itself was not hacked - it was simply a stolen cookie.)

You can find more information in our research repository here.

@quat1024
quat1024 / Reg.xml
Created July 1, 2021 07:03
All my custom intellij live templates as of right now
<template name="Reg" value="Registry" description="Registry" toReformat="false" toShortenFQNames="false">
<context>
<option name="JAVA_DECLARATION" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_STATEMENT" value="true" />
</context>
</template>
@quat1024
quat1024 / readme.txt
Last active March 20, 2021 07:30
Good title for my puzzle game (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@quat1024
quat1024 / zach_conv.sh
Created January 21, 2021 00:47
convert gifs from Zachtronics games to mp4 files and squirrel them away in a subfolder (place this on your desktop)
mkdir -p zach/conv
mkdir -p zach/orig
for file in *.gif; do
echo "Converting $file"
ffmpeg -y -hide_banner -loglevel error -stats -i "$file" -crf 15 -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "./zach/conv/${file%.*}.mp4"
mv "$file" "./zach/orig/$file"
done
@quat1024
quat1024 / mod mod things.md
Last active January 21, 2023 04:10
Minecraft Modding Resources
@quat1024
quat1024 / fix it.md
Last active February 23, 2021 07:23
Fix stuff being broke in IntelliJ.

What

When compiling mods in recent versions of IntelliJ, weird things start happening:

  • With ForgeGradle 2 (1.12-), none of the assets show up in-game (language keys, models, textures etc)
  • Broken hotswapping.
  • Potentially other Bad, Terrible Things that are yet to be discovered.

How

@quat1024
quat1024 / index.html
Last active May 24, 2020 18:19
new incarnation of the start page...
<html>
<head>
<title>Start</title>
<link rel="stylesheet" type="text/css" href="./style.css" />
</head>
<body>
<div class="grid">
<div class="square new">
<div>New Tab.</div>
</div>