Skip to content

Instantly share code, notes, and snippets.

View Sythelux's full-sized avatar
🐻
Always Beary ready

Sythelux Rikd Sythelux

🐻
Always Beary ready
View GitHub Profile
@Sythelux
Sythelux / FastMath.java
Last active August 29, 2015 14:05
Gears
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@Sythelux
Sythelux / TestFieldHandling.java
Created September 12, 2014 13:08
Abstract Access
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class TestFieldHandling {
private int Field1;
private String Field2;
@Sythelux
Sythelux / TimeStamp.java
Created September 12, 2014 15:24
Timestamp
import java.text.DateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* <p>This Class provides Some Funktionality around Working with Timestamps, it provides the Funktionality to convert Timestamps into human readable Date Formats and it provides a Funktionality for accuracy.</p>
* <p>Human readable Date Formats mean, that after you made a timestamp with Constructor or by setting them you can get a "DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)" formatted Date back. (that means something like "27.08.2014 13:37" in Germany.
* you can also change it by using: setDateFormat() </p>
* <p>Accuracy is something special, this means, that the internal Value is saved in the currency Accuracy gives</p>
* <p> for Example: <br />
@Sythelux
Sythelux / PerlinNoise.java
Created September 12, 2014 15:27
PerlinNoise
import java.util.Arrays;
import java.util.Random;
/**
* I'm not the Author of this Implementation, I just capsuled it the way i want it. Should I ever find him/her I will put them in here
*
* Perlin Noise is Noise Generator by Ken Perlin.
* @author <unknown>,sythelux, origin: Ken Perlin
*/
public class PerlinNoise {
@Sythelux
Sythelux / SystemInformation.java
Created September 12, 2014 15:30
System/JVM Information provider/formatter
import com.sun.management.OperatingSystemMXBean;//TODO: package could be removed in future relaeses
import java.io.File;
import java.lang.management.ManagementFactory;
//import java.lang.management.OperatingSystemMXBean;
import java.text.DecimalFormat;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
/**
@Sythelux
Sythelux / PrintFrame.java
Last active August 29, 2015 14:06
Frame that can hook into java.util.logging and show the logs
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
@Sythelux
Sythelux / WhiteToTransparent.java
Created September 12, 2014 15:33
A Script that can convert White to Transparency, as good as such a thing can be.
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class WhiteToTransparent {
public static void main(String[] args) {
if (args.length < 2) {
@Sythelux
Sythelux / GroundPatternResizer.java
Created September 12, 2014 15:35
A Class that can resize an Array (see oldArray in Code) to larger Arrays
public static void main(String[] args) {
int[] oldArray = new int[]{5, 6,
8, 4};
int[] newArray = new int[(int) Math.pow(2, 16)];
int halfNewLength = newArray.length / 2;
int rootNewLength = (int) Math.sqrt(newArray.length);
int rootHalfNewLength = rootNewLength / 2;
System.out.printf("%1$2d %2$2d %3$2d %4$2d\n",newArray.length,halfNewLength,rootNewLength,rootHalfNewLength);
for (int i = 0; i < halfNewLength; i+=rootNewLength) {
for (int j = 0; j < halfNewLength; j++) {
@Sythelux
Sythelux / Vertex.cpp
Last active August 29, 2015 14:06
Vertex Arrays
/**
* verticies Test,C++,OpenGL
* I have no rights on this ~Syd
*/
typedef struct {
GLfloat x, y, z;
GLfloat r, g, b;
} Vertex;
const Vertex vertices[48] = {
@Sythelux
Sythelux / Object3D.java
Created September 12, 2014 15:39
OBJ Loader
/*
* Modified on August 8, 2005
*/
package tools;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import org.lwjgl.opengl.GL11;