Skip to content

Instantly share code, notes, and snippets.

View Jire's full-sized avatar
🍖
the coding caveman

Jire Jire

🍖
the coding caveman
View GitHub Profile
@Jire
Jire / World.java
Created July 14, 2011 16:58
Represents the game world. Within each world holds an EntityList for each entity type it can contain along with functionality to register and unregister those entities from both view and internal encapsulation.
/*
* Nital is an effort to provide a well documented, powerful, scalable, and robust
* RuneScape server framework delivered open-source to all users.
*
* Copyright (C) 2011 Nital Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@Jire
Jire / Scheduler.java
Created July 24, 2011 03:54
Used to schedule and manage Job implementations.
package us.ironbase.job;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* Used to schedule and manage {@link Job} implementations.
@Jire
Jire / JobLegacy.java
Created July 24, 2011 03:55
Used to contain attributes for jobs which should be client-configured.
package us.ironbase.job;
/**
* Used to contain attributes for {@link Job}s which should be
* client-configured.
*
* @author Thomas Nappo
*/
class JobLegacy {
@Jire
Jire / Job.java
Created July 24, 2011 03:56
The interface to be implemented by classes which perform business logic and desire the ability to be scheduled by a scheduler and to be maintained by the environment.
package us.ironbase.job;
/**
* The interface to be implemented by classes which perform business logic
* and desire the ability to be scheduled by a {@link Scheduler} and to be
* maintained by the environment.
*
* @author Thomas Nappo
*/
public interface Job {
@Jire
Jire / CakeJob.java
Created July 24, 2011 04:12
A job which creates and displays a virtual cake.
package us.ironbase.job.examples;
import static java.lang.System.out;
import us.ironbase.job.Job;
/**
* A job which creates and displays a virtual cake.
*
* @author Thomas Nappo
*/
package com.fijeo;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.spi.SelectorProvider;
import java.util.logging.Logger;
@Jire
Jire / Main.java
Created May 14, 2012 16:01
Baudio V2 Prototype, uses 1 character (2 bytes) per "note" :), 100 bytes / 50 notes
public class Main {
private static final int instrument = 14;
private static final int delay = 15;
private static final int note = 200;
public static void main(String[] args) {
int box = ((instrument & 0xF) << 12) | ((delay & 0xF) << 8) | (note & 0xFF);
int u_instrument = (box >> 12) & 0xF;
int u_delay = (box >> 8) & 0xF;
int u_note = (box & 0xFF);
System.out.println("Box: " + ((char) (box & 0xFFF)) + ", Instrument: " + u_instrument + ", Delay: " + u_delay + ", Note: " + u_note);
@Jire
Jire / Main.java
Created May 14, 2012 16:07
Baudio V2 generation of fields, 100 notes = 100 characters, VERY small for 100 notes (standard 100 notes in WAV = over 300KB)
public class Main {
public static void main(String[] args) {
StringBuilder total = new StringBuilder();
for (int i = 0; i < 100; i++) {
int instrument = i & 0xF;
int delay = i & 0xF;
int note = i;
int box = ((instrument & 0xF) << 12) | ((delay & 0xF) << 8) | (note & 0xFF);
int u_instrument = (box >> 12) & 0xF;
int u_delay = (box >> 8) & 0xF;
@Jire
Jire / gist:2711670
Created May 16, 2012 16:05
Huge data fit into a long
long hp = 99;
long read = 27;
long magic = 255;
long rating = 30;
long picture = 10;
long sand = 12;
long confirmation = 1;
long skin = 7;
long resolutionX = 120;
long resolutionY = 120;
@Jire
Jire / Kernel32
Created September 11, 2015 05:00
package abendigo.mem.jna;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.WinDef;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.W32APIOptions;