Skip to content

Instantly share code, notes, and snippets.

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 / Nettyadaptor.java
Created November 19, 2012 05:22
Netty socket adaptor
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOption;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketAddress;
@md-5
md-5 / EncryptionUtil.java
Created November 16, 2012 23:21
MC Encryption
package net.md_5.bungee;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
@md-5
md-5 / BitPacking.java
Created October 14, 2012 05:57
BitPacking.java
public class App
{
public static void main(String[] args) throws Exception
{
for (byte art = 0; art < 24; art++)
{
for (byte data = 0; data < 4; data++)
{
byte packed = pack(art, data);
@md-5
md-5 / NBT.java
Created October 5, 2012 10:36
nbt lib
/**
* Copyright (c) 2012, md_5. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
@md-5
md-5 / comments.txt
Created September 15, 2012 12:45
Sure you can add comments
<roxlu> hey guys, it looks like it's not possible to add comments to gists anymore?
<roxlu> It didn't work a couple of days before but I thought it was just me doing something wierd... but today I get the same thing