Skip to content

Instantly share code, notes, and snippets.

View gotty.service
# systemd unit file
# place in /etc/systemd/system
# systemctl enable gotty.service
# systemctl start gotty.service
[Unit]
Description=Gotty Web Terminal
After=network.target
[Service]
View Triangle.java
/*
Enter height of triangle: 10
*
**
***
****
*****
******
*******
********
View MinecraftServerPatch.java
protected final Queue<FutureTask<?>> j = new java.util.concurrent.ConcurrentLinkedQueue<FutureTask<?>>() {
// PaperSpigot: Make size() constant-time
private AtomicInteger cachedSize = new AtomicInteger(0);
@Override
public boolean add(FutureTask<?> e) {
boolean result = super.add(e);
if (result) {
cachedSize.incrementAndGet();
}
@vemacs
vemacs / compton.conf
Last active Jan 1, 2020
Reasonable compton.conf (fixes shadows in the stock desktop environment) for Xubuntu 16.04
View compton.conf
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
backend = "glx";
View PositionLookHook.java
package es.nkmem.da.movefreq.packethooks;
import com.comphenix.packetwrapper.WrapperPlayClientPositionLook;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import es.nkmem.da.movefreq.MoveFreqPlugin;
import lombok.Data;
import lombok.RequiredArgsConstructor;
View ReflUtil.java
package net.ess3.nms.refl;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.bukkit.Bukkit;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
View app.py
import mcserver, time, threading
from bottle import route, run, response, hook
server = mcserver.McServer('play.primemc.org', 25565)
def schedule_update():
threading.Timer(1, schedule_update).start()
threading.Thread(target=lambda: server.Update()).start()
@hook('after_request')
View reset.py
import os, yaml
datadir = 'userdata'
key = 'money'
maxbal = 2500.0
def is_non_zero_file(fpath):
return True if os.path.isfile(fpath) and os.path.getsize(fpath) > 0 else False
for f in os.listdir(datadir):
if str(f).endswith('.yml'):
View GetCommandMap.java
private static Method getCommandMap;
public static CommandMap getCommandMap(Server server) {
try {
if (getCommandMap == null) {
getCommandMap = server.getClass().getDeclaredMethod("getCommandMap");
getCommandMap.setAccessible(true);
}
return (CommandMap) getCommandMap.invoke(server);
} catch (Exception exception) {
View PotionMetaUtil.java
package com.earth2me.essentials.utils;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionType;
public class PotionMetaUtil {
@SuppressWarnings("deprecation")
public ItemStack createPotionItem(int effectId) throws IllegalArgumentException {
int damageValue = getBit(effectId, 0) +
You can’t perform that action at this time.