Skip to content

Instantly share code, notes, and snippets.

module ouro.util.invokeImpl.X86_Windows.cdecl;
/**
Invokes the given function pointer.
Params:
fp = Function pointer.
ss = Size of argument stack.
sp = Pointer to bottom of argument stack.
eax = Pointer to storage for result eax register.
@DanielKeep
DanielKeep / mctranslate.py
Created November 19, 2010 15:03
Minecraft World Translater
#
# Minecraft World Translater
# Copyright (C) 2010, Daniel Keep.
# Licensed under the BSD <http://www.opensource.org/licenses/bsd-license.php>
# Canonical URL: https://gist.github.com/706617
#
# Usage: mctranslate.py X-OFFSET Z-OFFSET
#
# Translates a Minecraft world by (X-OFFSET,Z-OFFSET) chunks and places the
# result in the "translated" directory.
@DanielKeep
DanielKeep / mcresize-win32.py
Created November 13, 2010 04:51
Minecraft Resizer (for Windows)
#
# Minecraft Resizer (for Windows)
# Copyright (C) 2010, Daniel Keep.
# Licensed under the BSD <http://www.opensource.org/licenses/bsd-license.php>
# Canonical URL: https://gist.github.com/675096
#
# Changelog:
#
# 2010-11-13:
"
Function to compute DPI from diagonal screen length
and pixel dimensions.
Written in MathEval: http://github.com/DanielKeep/MathEval
"
let dpi(phD, pxW, pxH) = pxW / (phD / sqrt((pxH/pxW)**2 + 1))
module reprog_ssort;
/**
* Selection sort.
*
* This time actually writing out the various invariants and conditions.
* We're being FORMAL now, bitches.
*
* Compile with the 'paranoid' debug identifier to turn on all the various
* checks.
/*
That's 'binary search', not 'cow excrement' I'll have you know...
Written for http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/
Sadly, there IS a bug in the original, unmodified version of the search due
entirely to me trying to be clever.
To compile and run this (using dmd), use:
/**
* Collatz graph generator (inspired by http://www.xkcd.com/710/)
* Written by Daniel Keep; released to the Public Domain.
*
* To use this, compile and either dump the output to a file, or feed it
* directly into GraphViz like so:
*
* -----
* collatz 100 | dot -Ocollatz_100.svg -Tsvg
* -----
/// Parses the storage class for function arguments.
/// Authors: Daniel Keep
/// Copyright: Copyright © 2009 Daniel Keep
/// License: BSD v2 <http://www.opensource.org/licenses/bsd-license.php>
module argparse;
enum ParamSemantics
{
None = 0b0000,
In = 0b0001,
/**
* Contains functions that operate on functions and delegates.
*
* Copyright: Copyright &copy; 2009, Daniel Keep.
* License: BSD v2 <http://www.opensource.org/licenses/bsd-license.php>
* Authors: Daniel Keep
*/
module tangox.util.Func;
import tango.core.Traits;
/*
Demonstration of a library-level Property implementation.
*/
import std.stdio;
const DefaultGetter = "";
const DefaultSetter = DefaultGetter;