Skip to content

Instantly share code, notes, and snippets.

View hdon's full-sized avatar

Donny Viszneki hdon

View GitHub Profile
@hdon
hdon / HDReflect.js
Created December 5, 2014 13:34
Part of an old mod system I wrote for Minecraft
/* MakeHDReflect() reads Mincraft Coder Pack files (MCP) to build mappings
* between Notchian names (Java classes with obfuscated class, method,
* and field names, released to the public by Mojang) and "human" names
* (names chosen by reverse engineers.)
*
* It returns an object that allows you to inspect its procedure and also
* to begin writing "human" Javascript code!
*
* This function returns an object. Below is a description of each property
* you can expect to find in that object.
@hdon
hdon / scanner.js
Created December 5, 2014 13:36
A toy I wrote for Urban Terror
#!/usr/bin/gsr
var prg = "./ioUrbanTerror.i386";
//prg = "/usr/bin/env";
const PTRSIZE = 8;
const ffi = require("gffi");
const signal = require("signal");
const {ByteArray,ByteString} = require("binary");
const {include} = require("./include");
const {Reader} = require("./readline");
@hdon
hdon / common.py
Created December 5, 2014 15:09
Find Minecraft servers with the lowest latency!
from urllib2 import Request, urlopen
class ServerList():
listName = None
def __init__(self, data):
self.headers = { 'User-Agent': 'Mozilla/5.0' }
self.servers = data['servers']
if self.listName is None:
raise NotImplementedError("ServerList must override listName")
@hdon
hdon / aljebr.formats.js
Created December 5, 2014 15:17
Javascript library for working with algebra and descendent calculuses
var util = require('./util')
, KeyValueStore = util.KeyValueStore
, aljebr = require('./aljebr')
;
function serializeExpression(expression)
{
var eqNesting = 0;
function recurse(expression, parentOperator)
{
@hdon
hdon / test11.cpp
Created December 18, 2014 04:56
Compile-time linked list and key-value store
#include <iostream>
#include <type_traits>
using namespace std;
struct Nil {
typedef Nil Head;
typedef Nil Tail;
};
template <typename H, typename T = Nil> struct Lst {
module com.codebad.shader;
import derelict.opengl3.gl3;
import file = std.file;
import std.exception : enforce;
import std.stdio : writeln, writefln;
import std.string : format, toStringz;
import std.traits : isPointer, PointerTarget;
import std.conv : to;
import std.path : baseName;
import std.traits : isSigned;
T Clone(T)(T object) {
auto size = object.classinfo.init.length;
T ret = cast(T)((cast(void*)object)[0..size].dup.ptr);
return ret;
}
@hdon
hdon / genusers.py
Last active August 29, 2015 14:16
Generate non-colliding, intuitive usernames from domain names of 8- and 16-character lengths
import re
words = filter(lambda s:all([ord(c)<128 for c in s]), map(str.strip, open('/usr/share/dict/words')))
domainExp = re.compile('^[a-z0-9_]+$')
numbersExp = re.compile('[0-9]+')
englishWords = \
filter(
lambda s: domainExp.match(s),
map(str.lower,
map(str.strip,
open('/usr/share/dict/words')
@hdon
hdon / willie-chess.py
Created June 18, 2015 03:15
Chess for IRC I guess...
# coding=utf8
"""
willie-chess.py - chess, duh
"""
# whipped this up at lunch.
# clone https://github.com/embolalia/willie
# put this in ./willie/modules
# create mysql database and table "chessgame"
# all moves are validated but en passant and castling aren't implemented
#!/usr/bin/env python
import gtk, gtk.glade as glade
class Application(object):
def __init__(self):
self.glade = glade.XML('spritecaster.glade')
self.glade.signal_autoconnect({
'on_window1_delete_event': self.delete_event,
'on_window1_destroy_event': self.destroy,
'on_auto_button_toggled': self.auto_tool_button,
'on_div_tool_button_toggled': self.div_tool_button,