Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@md-5
md-5 / spigot.yml
Last active October 30, 2023 17:59
spigot.yml final revision
# This is the main configuration file for Spigot.
# As you can see, there's tons to configure. Some options may impact gameplay, so use
# with caution, and make sure you know what each option does before configuring.
# For a reference for any variable inside this file, check out the Spigot wiki at
# http://www.spigotmc.org/wiki/spigot-configuration/
#
# If you need help with the configuration or have any questions related to Spigot,
# join us at the IRC or drop by our forums and leave a post.
#
# IRC: #spigot @ irc.esper.net ( http://webchat.esper.net/?channel=spigot )
@md-5
md-5 / Rules.md
Created May 6, 2013 06:49
#spigot IRC rules

Please follow these rules at all times. The general rule of thumb is two kicks and a ban. A ban will be at a length determined by md_5, and never be more than a week. If you have any complaints or feel you have been unfairly banned, please message md_5.

  • Keep the chat at a PG-13 level. If you think it might be inappropriate, don't say it.
  • Racism, sexism, bigotry, harassment, threats, etc. are strictly prohibited. Do not use racial slurs, or bigoted remarks. Do not harass or threaten any user or use this channel as a place to coordinate attacks on others.
  • No trolling, flaming, or flame-baiting. Keep discussion civil. Acting like a goof will get you removed.
  • No excessive profanity. Every now and then is fine, but if every other word that comes out of your mouth is profane, that's not ok.
  • Do not flood or spam the channel, abuse bots, or abuse chat color. It is impossible to hold a conversation when the channel is filled with inane chatter. Bots are here to provide information and preform other useful
<?php
/*
Script for XenForo 1.X
Tested with: 1.1.X
Created by: #SG# Sharkiller
Forked by: JWhy
Verison: 0.2.1
*/
###############
@md-5
md-5 / Test.java
Created April 22, 2013 08:02
Netty Test
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package net.md_5.bungee.netty;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
@ChannelHandler.Sharable
public class ByteArrayEncoder extends MessageToByteEncoder<byte[]>
{
@md-5
md-5 / Metrics.java
Created February 24, 2013 03:06
Metrics
/*
* Copyright 2011-2013 Tyler Blair. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
@md-5
md-5 / gist:4713097
Last active December 12, 2015 04:18
Vartypes
This file has been truncated, but you can view the full file.
net/minecraft/src/TexturePackDownloadSuccess/<init> [Lnet/minecraft/src/TexturePackDownloadSuccess;, Lnet/minecraft/src/TexturePackList;]
net/minecraft/src/TexturePackDownloadSuccess/onSuccess [Lnet/minecraft/src/TexturePackDownloadSuccess;, Ljava/io/File;]
net/minecraft/src/Packet10Flying/<init> [Lnet/minecraft/src/Packet10Flying;]
net/minecraft/src/Packet10Flying/<init> [Lnet/minecraft/src/Packet10Flying;, Z]
net/minecraft/src/Packet10Flying/processPacket [Lnet/minecraft/src/Packet10Flying;, Lnet/minecraft/src/NetHandler;]
net/minecraft/src/Packet10Flying/readPacketData [Lnet/minecraft/src/Packet10Flying;, Ljava/io/DataInputStream;]
net/minecraft/src/Packet10Flying/writePacketData [Lnet/minecraft/src/Packet10Flying;, Ljava/io/DataOutputStream;]
net/minecraft/src/Packet10Flying/getPacketSize [Lnet/minecraft/src/Packet10Flying;]
net/minecraft/src/Packet10Flying/isRealPacket [Lnet/minecraft/src/Packet10Flying;]
net/minecraft/src/Packet10Flying/containsSameEntityIDAs [Lnet/minecraft/src/Packet10Flying;, Lnet/mi
@md-5
md-5 / gist:4645590
Created January 27, 2013 00:56
Bohemian note blocks
{
"songLength": 3292,
"songHeight": 7,
"songName": "Bohemian Rhapsody",
"songAuthor": "Lucky Cobra",
"originalSongAuthor": "Queen",
"songDescription": "\"Bohemian Rhapsody\" by Queen recreated\rin note blocks by Lucky Cobra.",
"tempo": 1000,
"autoSaving": false,
"autoSaveDuration": 10,
@md-5
md-5 / gist:4507738
Last active December 10, 2015 23:08
Java bytecode

Pseudo Java code:

public static void main(String[] args) {
    System.out.print("Enter two numbers: ");
    int x = read();
    int y = read();
    print(x / y);
}
@md-5
md-5 / beat.md
Created December 12, 2012 02:51
Variable length number encoding. Taken from http://byuu.org/programming/beat/.

Variable-length number encoding

Rather than limit the maximum file size supported to 16MB (24-bit) or 4GB (32-bit), beat patches use a variable-length encoding to support any number of bits, and thus, any possible file size.

The basic idea is that we encode the lowest seven bits of the number, and then the eighth bit of each byte is a flag to say whether the full number has been represented or not. If set, this is the last byte of the number. If not, then we shift out the low seven bits and repeat until the number is fully encoded.

One last optimization is to subtract one after each encode. Without this, one could encode '1' with 0x81 or 0x01 0x80, producing an ambiguity.

Decoding is the inverse of the above process.