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 / App.java
Created September 6, 2012 10:03
Why Netty is awesome.
package com.md_5.jcaptive;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
import io.netty.channel.ChannelInitializer;
@md-5
md-5 / 1-0.java
Created September 16, 2012 08:39
Java NIO Webservers
package net.shadowraze.vote4diamondz;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@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
@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.

<?php
/*
Script for XenForo 1.X
Tested with: 1.1.X
Created by: #SG# Sharkiller
Forked by: JWhy
Verison: 0.2.1
*/
###############
try {
String[] split = ip.split("\\.");
StringBuilder lookup = new StringBuilder();
for (int i = split.length - 1; i >= 0; i--) {
lookup.append(split[i]);
lookup.append(".");
}
lookup.append("xbl.spamhaus.org.");
if (java.net.InetAddress.getByName(lookup.toString()) != null) {
return "Your IP address is flagged as unsafe by spamhaus.org/xbl";
package com.md_5;
public class DenySpout extends org.bukkit.plugin.java.JavaPlugin implements org.bukkit.event.Listener {
@Override
public void onEnable() {
try {
Class<?>[] params = {int.class, boolean.class, boolean.class, Class.class};
java.lang.reflect.Method addClassMapping = net.minecraft.server.Packet.class.getDeclaredMethod("a", params);
addClassMapping.setAccessible(true);
package com.raphfrk.craftproxylitest;
import com.google.gson.Gson;
import static com.raphfrk.craftproxylitest.LogManager.$;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.URL;
import java.net.URLConnection;
@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