Skip to content

Instantly share code, notes, and snippets.

View ewized's full-sized avatar

ewized

View GitHub Profile
@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 / string.json
Created March 11, 2016 18:52
JSON String
"This is a JSON string"
@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
[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 / 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;
@ewized
ewized / BeforeAfter.java
Created May 3, 2016 16:54
Before and After - Shows how R/D code becomes clean Production code
// AFTER
public static Class<?>[] after(String str) throws Exception {
Conditions.nonNull(str, "str");
str = str.substring(1, str.lastIndexOf(")"));
List<Class<?>> args = Lists.newArrayList();
for (int i = 0 ; i < str.length(); i++) {
int a = i;
if (str.charAt(i) == '[') { // Process arrays
while (str.charAt(a) == '[' && i < str.length()) {
@ewized
ewized / generate_types.py
Created May 10, 2016 17:43
This file will generate the packet types from the wiki.vg website
#!/usr/bin/python3
# Copyright 2016 Year4000. All Rights Reserved.
from urllib.request import urlopen
from xml.etree.ElementTree import fromstring
import re
def set_up():
""" Ask the user for the url and file name """
# protocol
print("echo")
@ewized
ewized / bootstrap.py
Last active August 30, 2016 22:59
Ansible bootstrap script that sets up the requirements to run a remote playbook
# This python script is a lightweight script that ensures that the proper
# packages are installed on the remote host, must have hostname defined
# $ hostname new-host ; wget -O - goo.gl/G3JWa4 | python
import os
import sys
print('-' * 5 + ' [Ansible Bootstrap Script] ' + '-' * 5)
@ewized
ewized / links.txt
Created September 26, 2016 03:41
Pictures from Addons/Plugin panel