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 / BuildInfoBuilder.java
Created September 3, 2015 12:15
reads some Information from Manifest File and returns them as String
import java.io.InputStream;
import java.net.URL;
import java.util.Collections;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
public class BuildInfoBuilder {
public static String buildInfo() {
@Sythelux
Sythelux / MinimumTimeTicker.java
Last active August 29, 2015 14:25
A small Class that helps with Timing Stuff
/*
*Copyright (c) 2015, Sythelux Rikd All rights reserved.
*
*Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
@Sythelux
Sythelux / ByteUnit.java
Last active August 29, 2015 14:11
ByteUnit enum. Made like TimeUnits from Sun
public enum ByteUnit {
BYTE {
public long toBytes(long d){return d;}
public long toKilos(long d){return d/(DEC1/DEC0);}
public long toMegas(long d){return d/(DEC2/DEC0);}
public long toGigas(long d){return d/(DEC3/DEC0);}
public long toTeras(long d){return d/(DEC4/DEC0);}
public long toPetas(long d){return d/(DEC5/DEC0);}
public long toExas(long d){return d/(DEC6/DEC0);}
public long toZettas(long d){return d/(DEC7/DEC0);}
@Sythelux
Sythelux / SystemInformationProvider.java
Created September 30, 2014 14:50
SystemInformationProvider will provide Information about for example jvm mem or cpu...
import java.io.File;
import java.lang.management.ManagementFactory;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
@Sythelux
Sythelux / ProcessBuilderSerializer.java
Created September 30, 2014 14:46
Class to convert Processbuilder to Linux Shell commands.
import java.io.File;
import java.lang.ProcessBuilder.Redirect.Type;
import java.util.Arrays;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/** This Class Provides a Way to Serialize and deserialize Simple Processbuilder Commands. For this it will use the Bash Syntax.
*
@Sythelux
Sythelux / TimeFlowParser.java
Created September 15, 2014 11:27
Parser for Times like: 1d14h5min5sec40ms
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author Sythelux Rikd
@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;
@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 / Square.cpp
Last active July 25, 2022 19:13
Example GLFW,C++,OpenGL,GLEW Program
/******************************
*
* Example "Square"
* created by Syd
*
*******************************/
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <cstdlib>
@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++) {