Skip to content

Instantly share code, notes, and snippets.

View chaseking's full-sized avatar
⛰️

Chase King chaseking

⛰️
View GitHub Profile
@karpathy
karpathy / min-char-rnn.py
Last active May 6, 2024 16:42
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
// https://github.com/Bukkit/CraftBukkit/blob/7e1ac0a77129b169704c1e222ff2deb3ab6cd2d2/src/main/java/net/minecraft/server/EntityPlayer.java#L596
//Method to open an anvil inventory to a player
public static void openAnvil(Player player, Inventory inventory){
//Get our EntityPlayer
EntityPlayer p = ((CraftPlayer) player).getHandle();
//Create the AnvilContainer
AnvilContainer container = new AnvilContainer(p);
@arxenix
arxenix / ImgMessage
Last active February 6, 2023 10:39
ImgMessage util class to send images to players with the chat bar!
package your-package;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.HashMap;
/**
@sahirshahryar
sahirshahryar / CompactRomanNumeral.java
Last active March 31, 2023 04:12
Roman numeral conversion
public static String romanNumerals (int value) {
String[] values = {
"M", "CM", "D", "CD", "C", "XC",
"L", "XL", "X", "IX", "V", "IV", "I"
};
int[] correspondents = {
1000, 900, 500, 400, 100, 90,
50, 40, 10, 9, 5, 4, 1
}
@JamesNorris
JamesNorris / Spiraling Effect
Last active December 29, 2015 09:39
The solution to chasechocolates' question on spiraling effects.
How do I make an effect that spirals, becoming smaller as time goes on?
So, as we know a circle is defined by the equation:
r^2 = (x - a)^2 + (y - b)^2
So that gets us the general equation with which we will be working. As a result, we should also know that:
as a->∞ = translation in the x, right
as b->∞ = translation in the y, up
@aadnk
aadnk / NbtFactory.java
Last active December 29, 2020 04:29
A compact library for editing or creating NBT tags, ready to be inserted into your project. It doesn't directly depend on CraftBukkit, but uses reflection to access it dynamically. Use this version for 1.7.2: http://tinyurl.com/attributestorage
package com.comphenix.example;
import java.io.BufferedInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@cnaude
cnaude / get.pl
Last active August 20, 2016 02:48
Parse output from http://forums.bukkit.org/members/?page=$i and sort by number of likes.
#!/usr/bin/perl
use strict;
for my $i (1..16420) {
system("wget -O data/bf.$i.html 'http://forums.bukkit.org/members/?page=$i'");
sleep 2;
}
@aadnk
aadnk / Attributes.java
Last active September 15, 2020 10:13
Edit attributes in 1.6.2 (Not dependent on ProtocolLib). See https://github.com/aadnk/AttributeStorage/tree/nms for 1.7.2.
package com.comphenix.example;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@stephan-gh
stephan-gh / ServerListAPI.java
Last active February 29, 2024 20:05
API to modify some advanced Minecraft server list data.
/*
* ServerListAPI - API to modify some advanced Minecraft server list data
* Copyright (C) 2013 Minecrell
* You are not allowed to use this API to fake online players on a production server.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*