Skip to content

Instantly share code, notes, and snippets.

View molenzwiebel's full-sized avatar
😎
Hackerman

Thijs Molendijk molenzwiebel

😎
Hackerman
View GitHub Profile
@molenzwiebel
molenzwiebel / Minecraft Server Poller
Created May 7, 2013 12:57
Code to poll a minecraft server
private String MOTD;
private String gameVersion; //Currently 1.5.2
private int onlinePlayers;
private int maxPlayers;
public static String readString(DataInputStream par0DataInputStream, int par1) throws IOException
{
short short1 = par0DataInputStream.readShort();
if (short1 > par1)
@molenzwiebel
molenzwiebel / gist:6018889
Created July 17, 2013 08:43
A way to sort the items known in Minecraft.
package nl.thijsmolendijk.LoopThruTest;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@molenzwiebel
molenzwiebel / NestedCommandDemo.java
Last active January 2, 2016 12:41
Nested commands. This example allows for /hello if you register Commands.class and allows for /myplugin hello if you register ParentCommand.class
public class Commands {
public static class ParentCommand {
@Command(aliases = { "myplugin"}, desc = "All MyPlugin commands", min = 0, max = -1)
@NestedCommand(Command.class) //All commands will get passed on to Commands.class
public static void myplugin(final CommandContext args, CommandSender sender) throws CommandException {
}
}
@Command(aliases = { "hello", "hey" }, desc = "Says hello", usage = "[player] - The player to say hello to", min = 1, max = 1)
public static void hello(final CommandContext args, CommandSender sender) throws CommandException {
Player target = Bukkit.getPlayer(args.getString(0)); //0 is the index
@molenzwiebel
molenzwiebel / ReflectionExecutor.java
Last active December 29, 2015 04:09
Helper class that can "execute" strings and helps general NSM and OBC calls.
package nl.thijsmolendijk.util.reflect;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.bukkit.Bukkit;
@molenzwiebel
molenzwiebel / generate.rb
Last active December 9, 2019 12:34
Screensaver Images as of 15-4-17
require "open-uri"
require "json"
contents = JSON.parse open("http://screensaver.riotgames.com/latest/content/data.json").read
names = contents["locale"]["translations"]["en_US"]
def get_type(asset)
return "Illustration" if !asset.nil? && asset["tags"].include?("illustrations")
return "Animation" if !asset.nil? && asset["tags"].include?("animated-art")
return "Video Still" if !asset.nil? && asset["tags"].include?("video-stills")
//META{"name":"EmojiTyperIntegration"}*//
const EmojiTyperIntegration = class EmojiTyperIntegration {
getName() { return "EmojiTyper Integration"; }
getShortName() { return "emojityper-integration"; }
getDescription() { return "Integrates https://emojityper.com with your emoji picker. Simply search with @<term> to query EmojiPicker, or type :@<query> in chat to autocomplete with EmojiPicker."; }
getVersion() { return "1.0.0"; }
getAuthor(){ return "molenzwiebel"; }
load() {}
@molenzwiebel
molenzwiebel / README.md
Last active November 3, 2017 23:58
Flash

Flash - Blazing Fast Brainfuck JIT

This will most likely be the fastest brainfuck runner in assembly that a student will ever hand in. This may sound over-confident, but I am certain that it is almost impossible to optimize brainfuck even more without implementing special cases for common constructs. I encourage you to read the code (and the accompanying comments). Although it is over 1000 lines of assembly, the comments give a lot of the information also outlined in this document.

Flash is an optimizing JIT compiler. JIT, or Just-In-Time, refers to the technique where the code to be ran is translated into machine instructions on the fly, which are then written to an executable block of memory and directly interpreted by the CPU. This is similar to how normal compilers work, but instead of writing the resulting instructions to an executable they are written and executed directly.

Program Flow

Flash goes through the following steps, in order:

  1. Construct And Optimize Code
  • Build IR
# ====================================================================================================
# ====================================================================================================
# ====================================================================================================
# ====================================================================================================
# ====================================================================================================
# ===================================== README README README README ==================================
# ====================================================================================================
# == IT IS HIGHLY RECOMMENDED THAT YOU READ THIS CODE WHILE READING THE ACCOMPANYING README FILE AT ==
# == THE SAME TIME. IT WILL EXPLAIN SOME CONCEPTS USED IN THIS CODE, AND WHILE THE COMMENTS ABOVE ==
# == FUNCTIONS CONTAIN A LOT OF CONTEXT, THEY WILL NOT EXPLAIN EVERYTHING. ALSO: I SPENT A LOT OF
const ABBREVIATIONS = {
"mumu": "Amumu",
"ali": "Alistar",
"sol": "AurelionSol",
"aurelion": "AurelionSol",
"asol": "AurelionSol",
"blitz": "Blitzcrank",
"cait": "Caitlyn",
"cass": "Cassiopeia",
"cho": "ChoGath",
@molenzwiebel
molenzwiebel / infinity-war-leaderboard.md
Created July 27, 2018 17:50
Results of the CM Infinity War ban sprees.
Rank Username Banned At
1 topcyder#0001 Winner!
2 moonguardianjaim#6033 7/27/2018, 5:29:28 PM
3 TicTacTomato#3997 7/27/2018, 5:29:27 PM
4 Hëlix#8005 7/26/2018, 7:19:54 PM
5 martinchoto#8872 7/26/2018, 7:19:52 PM
6 Kryzik#7643 7/26/2018, 7:19:51 PM
7 WolfHunter17#4342 7/26/2018, 7:19:50 PM
8 porcho20#0118 7/25/2018, 7:00:31 PM