Skip to content

Instantly share code, notes, and snippets.

View acrylic-style's full-sized avatar
💛

Acrylic Style acrylic-style

💛
View GitHub Profile
@acrylic-style
acrylic-style / root-password-MariaDB-docker-compose.md
Last active September 28, 2022 14:37 — forked from rordi/root-password-MariaDB-docker-compose.md
Change root password in MariaDB Docker container running with docker-compose

Change root password in MariaDB Docker container running with docker-compose

Override the entrypoint in docker-compose.yml for the MariaDB Docker container by adding:

entrypoint: mysqld_safe --skip-grant-tables --user=mysql

The start up the Docker Compose stack:

@acrylic-style
acrylic-style / HelloWorld.java
Last active August 3, 2022 10:39
Draw a text using LWJGL (OpenGL 3.2 Core Profile)
package com.example.lwjgltest;
import org.joml.Matrix4d;
import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.glfw.GLFWVidMode;
import org.lwjgl.opengl.GL;
import org.lwjgl.stb.STBEasyFont;
import org.lwjgl.system.MemoryStack;
import java.nio.ByteBuffer;
@acrylic-style
acrylic-style / gist:244e09f73d3347825bb04bb8410bceac
Created May 25, 2022 15:05
List of packets in 1.19 Pre-release 3
HANDSHAKING SERVERBOUND 0x00 ClientIntentionPacket
PLAY SERVERBOUND 0x00 ServerboundAcceptTeleportationPacket
PLAY SERVERBOUND 0x01 ServerboundBlockEntityTagQuery
PLAY SERVERBOUND 0x02 ServerboundChangeDifficultyPacket
PLAY SERVERBOUND 0x03 ServerboundChatCommandPacket
PLAY SERVERBOUND 0x04 ServerboundChatPacket
PLAY SERVERBOUND 0x05 ServerboundChatPreviewPacket
PLAY SERVERBOUND 0x06 ServerboundClientCommandPacket
PLAY SERVERBOUND 0x07 ServerboundClientInformationPacket
PLAY SERVERBOUND 0x08 ServerboundCommandSuggestionPacket
@acrylic-style
acrylic-style / DumpProtocol.java
Created May 25, 2022 12:26
List of packets in 1.19 Pre-release 2
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.network.ConnectionProtocol;
import net.minecraft.network.protocol.PacketFlow;
import java.util.Comparator;
import java.util.Locale;
import java.util.function.Function;
public class DumpProtocol {
public static void main(String[] args) {
@acrylic-style
acrylic-style / merge.js
Last active November 27, 2021 04:01
Merge data1.json and data2.json, and you get result.json
const fs = require('fs/promises')
const util = require('util')
const process = (k1, v1, k2, v2) => {
if (util.isDeepStrictEqual(v1, v2)) return v1
if (typeof v1 === 'undefined' || v1 === null) return v2
if (typeof v2 === 'undefined' || v2 === null) return v1
let data = null
if (Array.isArray(v1) !== Array.isArray(v2)) {
if (Array.isArray(v1)) {
@acrylic-style
acrylic-style / gist:9a0f61129eca6277ce9483c57e08f79c
Last active September 4, 2021 17:38
transformable classes (BungeeCord)
net/md_5/bungee/module/cmd/server/PluginServer
net/md_5/bungee/module/cmd/server/CommandServer
net/md_5/bungee/module/cmd/alert/PluginAlert
net/md_5/bungee/module/cmd/alert/CommandAlert
net/md_5/bungee/module/cmd/alert/CommandAlertRaw
net/md_5/bungee/module/cmd/send/PluginSend
net/md_5/bungee/module/cmd/send/CommandSend
net/md_5/bungee/module/cmd/list/PluginList
net/md_5/bungee/module/cmd/list/CommandList
net/md_5/bungee/api/connection/Connection$Unsafe
package xyz.acrylicstyle.mcutil.lang;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import util.ICollectionList;
import xyz.acrylicstyle.mcutil.lang.test.IgnoreTest;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
@acrylic-style
acrylic-style / no-choke-bp.js
Created April 22, 2021 04:47
no-choke-bp.js (best performance without choke)
//
// The result pp is just an estimate!
// This list does not include plays outside of 100 bp, which causes result pp less than actual.
//
// Fun fact:
// - There are 8 harumachi clovers
//
const before = [
241.279, // Sidetracked Day (Short Ver.) [A r M i N's Extra] +HD by VINXIS (https://osu.ppy.sh/beatmaps/1632673?mode=osu)
@acrylic-style
acrylic-style / very_complex.md
Last active October 20, 2021 13:57
MapCodec<A>/Codec<A> (in 1.18)
public static final MapCodec<MultiNoiseBiomeSource> DIRECT_CODEC = RecordCodecBuilder.mapCodec(
  (instance) -> instance.group(
    RecordCodecBuilder.create(
      (instancex) -> instancex.group(
        Climate.ParameterPoint.CODEC.fieldOf("parameters").forGetter(Pair::getFirst),
        Biome.CODEC.fieldOf("biome").forGetter(Pair::getSecond)
      ).apply(instancex, Pair::of)
    )
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;