Skip to content

Instantly share code, notes, and snippets.

View JohnEarnest's full-sized avatar

John Earnest JohnEarnest

View GitHub Profile
@JohnEarnest
JohnEarnest / Stop.java
Created January 8, 2013 01:19
A prototype game exploring the idea of a bullet hell space-shooter in which the player takes an entirely defensive role and must protect others in addition to themselves.
/**
* Stop
*
* A prototype game exploring the idea of a
* bullet hell space-shooter in which the
* player takes an entirely defensive role
* and must protect others in addition to
* themselves.
*
* Known issues/ things to ponder:
@JohnEarnest
JohnEarnest / Garbage.fs
Created January 13, 2013 03:21
A compact, simple implementation of a garbage-collected cons-pair heap utilizing Cheney's algorithm.
\
\ Garbage.fs
\
\ A compact, simple implementation of a garbage-collected
\ cons-pair heap utilizing Cheney's algorithm.
\ Pointers to pairs are identified by a pattern in the
\ high-order bits of a value, chosen not to collide
\ with the constants "true" or "false".
\
@JohnEarnest
JohnEarnest / gist:5617525
Created May 21, 2013 04:42
A tiny HTTP server written in Java. Requests for resources will serve them up, while requests to a raw directory will execute a shell script named to correspond to the request method, such as "GET". URL arguments are decoded and made available to the shell script as environment variables, making basic dynamic content and form processing possible.
import java.util.*;
import java.net.*;
import java.io.*;
public class Web {
public static void main(String[] args) throws Exception {
ServerSocket server = new ServerSocket(10101);
while(true) {
Socket s = server.accept();
@JohnEarnest
JohnEarnest / LCD.fs
Created June 11, 2013 22:26
A FlashForth program for the PICDEM Explorer board which interfaces with the LCD Module.
\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ LCD Driver
\
\ This project uses FlashForth to write text
\ to the LCD display on the Microchip PICDEM
\ PIC18 Explorer Demo Board, running on a
\ PIC18F8722 microcontroller.
\
\ John Earnest
\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
@JohnEarnest
JohnEarnest / euler.factor
Created June 19, 2013 00:31
Solving some Project Euler problems to become more familiar with factor. This is pretty old, but I thought it'd be worth stashing here for safekeeping.
USING:
kernel
sequences
sequences.deep
math
math.functions
math.order
math.ranges
math.primes
math.primes.factors
@JohnEarnest
JohnEarnest / Eliza.logo
Created December 8, 2013 15:39
A very simple ELIZA-style psychotherapist program written in Loko-compatible Logo.
@JohnEarnest
JohnEarnest / Adventure.logo
Created December 22, 2013 02:43
A text adventure game framework written in Loko-compatible Logo.
@JohnEarnest
JohnEarnest / HexScape.java
Created February 22, 2014 02:40
Playing with hexagons.
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import java.util.*;
import java.util.List;
import static java.lang.Math.*;
public class HexScape extends JPanel {
public static void main(String[] args) {
@JohnEarnest
JohnEarnest / WAD3.java
Created January 6, 2016 03:28
Quake WAD3 texture unpacker
import java.io.*;
import java.util.*;
import java.awt.image.*;
import javax.imageio.*;
// a very basic texture unpacker for the Quake WAD3 file format
// see http://hlbsp.sourceforge.net/index.php?content=waddef
public class WAD3 {
static int index = 0;
@JohnEarnest
JohnEarnest / CorsServer.js
Created December 27, 2016 17:47
A CORS-aware read/write HTTP server in Node.js
////////////////////////////////////////////////////////////////////////////
//
// Node.js HTTP file server example.
//
// Serves documents via GET requests with CORS headers and (if enabled)
// additionally permits writes via POST requests.
//
// Before using, PLEASE be aware of the security risks associated with
// running a server like this on publicly accessible machines!
//