Skip to content

Instantly share code, notes, and snippets.

View ewized's full-sized avatar

ewized

View GitHub Profile
@ewized
ewized / Main.cpp
Created May 1, 2016 23:08
JNI Test
#include <iostream>
#include "Main.h"
using namespace std;
// /usr/lib/jvm/java-8-oracle/include/linux
JNIEXPORT void JNICALL Java_Main_test__(JNIEnv *env, jobject obj) {
cout << env << endl;
cout << obj << endl;
[15:28:01] [Netty Server IO #1/INFO] [STDERR]: [net.year4000.utilities.sponge.protocol.PipelineHandles$PacketInterceptor:intercept:55]: java.lang.NullPointerException
[15:28:01] [Netty Server IO #1/INFO] [STDERR]: [net.year4000.utilities.sponge.protocol.PipelineHandles$PacketInterceptor:intercept:55]: at org.spongepowered.common.effect.particle.SpongeParticleHelper.toPackets(SpongeParticleHelper.java:57)
[15:28:01] [Netty Server IO #1/INFO] [STDERR]: [net.year4000.utilities.sponge.protocol.PipelineHandles$PacketInterceptor:intercept:55]: at net.minecraft.world.World.spawnParticles(World.java:106)
[15:28:01] [Netty Server IO #1/INFO] [STDERR]: [net.year4000.utilities.sponge.protocol.PipelineHandles$PacketInterceptor:intercept:55]: at net.minecraft.world.World.spawnParticles(World.java:97)
@ewized
ewized / minecraft.desktop
Created March 27, 2016 22:21
Linux minecraft desktop icon
[Desktop Entry]
Version=1.0
Type=Application
Name=Minecraft
Icon=/opt/minecraft/favicon.png
Exec=/usr/bin/java -splash:/opt/minecraft/favicon.png -jar /opt/minecraft/Minecraft.jar
Terminal=false
@ewized
ewized / string.json
Created March 11, 2016 18:52
JSON String
"This is a JSON string"
@ewized
ewized / Perm.java
Created November 22, 2015 17:24
Testing the performance hit of using different methods of running code.
import java.util.*;
public class Perm {
public static void main(String[] args) throws Exception {
Perm perm = new Perm();
long start = System.currentTimeMillis();
for (int i = 0; i < Integer.MAX_VALUE; i ++) {
perm.run();
}
System.out.println("Normal method: " + (System.currentTimeMillis() - start) + "ms");
@ewized
ewized / wrapper.py
Last active February 14, 2022 12:10
A watchdog for Minecraft servers to make sure they are running all the time, even in the event of a crash.
#!/usr/local/bin/python3
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
@ewized
ewized / statusping.py
Last active January 26, 2024 02:18
Python3 class to ping a Minecraft server and get its response including ping in ms
#!/usr/bin/python3
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
@ewized
ewized / Circles.groovy
Last active February 3, 2022 02:28
Parametric equations for circles
import net.year4000.ducktape.bukkit.DuckTape
import net.year4000.ducktape.bukkit.module.BukkitModule
import net.year4000.ducktape.bukkit.module.ModuleListeners
import net.year4000.ducktape.module.ModuleInfo
import org.bukkit.Bukkit
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.Material
@ewized
ewized / install-java8.sh
Last active August 29, 2015 14:23
Install Oracle Java 8
#! /bin/bash
# Make sources
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | \
tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | \
tee -a /etc/apt/sources.list.d/webupd8team-java.list
# Update sources
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
@ewized
ewized / pidkill.sh
Last active August 29, 2015 14:11
This script will kill all dead java processes
#!/bin/bash
# This script will find kill all dead minecraft servers
# It will attempt to restart the servers before they die
LAST=""
for process in $(ps a | grep java | awk '{print $1 " " $4}') ; do
if [ "$LAST" = "" ] ; then
LAST=$process
else