Skip to content

Instantly share code, notes, and snippets.

@bemasher
bemasher / stack.go
Last active August 19, 2020 10:59
A simple LIFO stack backed by a linked list implemented with golang.
package main
import (
"fmt"
)
type Stack struct {
top *Element
size int
}
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@aadnk
aadnk / ExampleMod.java
Created January 13, 2013 00:17
Set a different armor color per observer.
package com.comphenix.example;
import org.bukkit.Color;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolLibrary;
@Thinkofname
Thinkofname / boundingboxes.json
Last active June 27, 2021 05:02
Minecraft Block bounding boxes
{
"pistonExtension":{
"0":[
[
0.0,
0.0,
0.0,
1.0,
0.25,
1.0
@toqueteos
toqueteos / sha1.go
Last active April 10, 2023 19:34
Minecraft player auth SHA-1 digest.
// You can test this online at: https://play.golang.org/p/hhayRT1VWgj
package main
import (
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
"strings"
)
@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;
package de.zh32.slp;
import com.google.gson.Gson;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@vemacs
vemacs / Skin.php
Last active August 29, 2015 13:58 — forked from tonybruess/Skin.php
<?php
class Skin {
public static function get($username) {
$steve = in_array(strtolower($username), array("steve", "player", "default"));
if(!$steve) $contents = self::fetch('http://skins.minecraft.net/MinecraftSkins/' . $username . '.png');
$defaultImage = WideImage::load("char.png");
$defaultType = "image/png";
if ($steve || $contents === false) {
$img = $defaultImage;
@aadnk
aadnk / PlayerDisplayModifier.java
Last active November 6, 2024 14:27
Change the display name and skin of any player. Credit to @bigteddy98, @ferrybig and @lenis0012 for writing the original version.
package com.comphenix.example;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
@aadnk
aadnk / GlowInCreativeMode.java
Created August 11, 2014 23:13
Add enchantment glow to items in creative mode. Requires AttributeStorage and TinyProtocol (can be added directly to your plugin).
package com.comphenix.example;
import java.sql.Ref;
import java.util.Collections;
import java.util.UUID;
import net.minecraft.util.io.netty.channel.Channel;
import org.bukkit.Material;
import org.bukkit.command.Command;