Skip to content

Instantly share code, notes, and snippets.

Avatar

Una unascribed

View GitHub Profile
View openpgp.md
@unascribed
unascribed / mcpbot archive.md
Last active Mar 25, 2022
Fixing "Etag download for http://export.mcpbot.bspk.rs/versions.json failed with code 522" in old ForgeGradle
View mcpbot archive.md

MCPBot is finally dead, and so goes with it every old version of ForgeGradle. Hope you're not maintaining any 1.7-1.12 mods anymore (or, god forbid, 1.6)! Because if you do, nobody will help you, and if you ask you will be banned from all official Forge channels. Fun fun fun. Game over.

...Or not. Someone asked ArchiveBot to rescue the MCPBot exports, and a WARC file containing a seemingly complete archive is available for download. And, these old ForgeGradle versions download mappings over plain HTTP, not HTTPS!

Some context

I maintain Ears, a mod available for too many versions of Minecraft, and it uses old versions of ForgeGradle to build the 1.6, 1.7, 1.8, 1.9-1.11, and 1.12 ports. Because reengineering these old versions of ForgeGradle is a huge goddamn wa

@unascribed
unascribed / randomUUID.js
Last active Nov 12, 2021
A simple and readable way to generate valid v4 UUIDs in JavaScript. CC0 https://creativecommons.org/publicdomain/zero/1.0/
View randomUUID.js
function randomUUID() {
return randhex(8) + "-" + randhex(4) + "-4" + randhex(3) + "-" + choice(["8", "9", "a", "b"]) + randhex(3) + "-" + randhex(12);
}
let scratchTarr = new Uint32Array(1);
function choice(arr) {
crypto.getRandomValues(scratchTarr);
return arr[Math.floor(scratchTarr[0]%arr.length)]
}
function randhex(count) {
crypto.getRandomValues(scratchTarr);
View copycat.sh
#!/bin/bash
if [[ "$1" == "-h" || "$1" == "-?" || "$1" == "--help" ]]; then
(
echo 'copycat: copy stdin or files specified on command line to Wayland and/or X clipboard'
echo 'performs automatic mimetype detection like wl-copy via file under X'
echo 'usage:'
echo ' copycat: copy stdin to clipboard'
echo ' copycat <-h|--help|-?>: display usage help'
echo ' copycat <files...>: concatenate each file, then copy to clipboard'
echo
View STBTexteditJ.java
package com.unascribed.chipper.client;
import static org.lwjgl.glfw.GLFW.*;
import java.util.Arrays;
import java.util.PrimitiveIterator;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.ints.IntListIterator;
View OpenGLDebug.java
package com.unascribed.chipper;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL43.*;
import static org.lwjgl.system.MemoryUtil.*;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
View RandomXoshiro256StarStar.java
/*
* To the extent possible under law, the author has dedicated all copyright
* and related and neighboring rights to this software to the public domain
* worldwide. This software is distributed without any warranty.
*
* See <http://creativecommons.org/publicdomain/zero/1.0/>
*/
package com.unascribed.random;
View Stipple.java
import java.nio.ByteBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
public class Stipple {
private static final ByteBuffer buf = BufferUtils.createByteBuffer(128);
private static void stipple(long[] arr) {
View MaterialColor.java
package com.unascribed.materialpicker;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public enum MaterialColor {
RED("Red",
0xFF_F44336,
View ClockDrawable.java
/*
* The MIT License
* Copyright 2018 Una Thompson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: