Skip to content

Instantly share code, notes, and snippets.

@msg555
msg555 / dustapi.as
Last active September 19, 2021 22:19
The DF API definitions
This has been replaced by https://dustapi.readthedocs.io/
@msg555
msg555 / samplevalidator.cpp
Last active June 16, 2017 15:04
Example validator used on Build-A-Cow
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <cstring>
#include <algorithm>
#include <set>
#include <fstream>
#include <sstream>
@msg555
msg555 / splay.cpp
Created May 28, 2017 23:49
Optimized splay tree implementation
template<class T> struct splnode {
typedef splnode<T> node_t;
splnode() : P(NULL) {
C[0] = C[1] = NULL;
pull();
}
/* Add extra state here. */
from dustmaker import *
import sys
import math
import os.path
import glob
for fname in glob.glob("/home/msg555/Dustforce/content/levels2_orig/*"):
with open(fname, "rb") as f:
map = read_map(f.read())
@msg555
msg555 / hitboxes.txt
Last active April 15, 2016 01:34
Dustforce Hitbox Sizes and Offsets
ah_ = attack heavy
al_ = attack light
_f = front
_u = up
_b = back
_ah = aerial front
_au = aerial up
_ad = aerial down
_of = offset relative to bottom center of character
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
using namespace std;
#define MAXN 1010
<?php
/* Create an array and populate some values. */
$arr = array();
for ($i = 0; $i < 100000; $i++) {
$arr[$i] = $i;
}
$foo = &$arr; // comment out me
for ($i = 0; $i < 100000; $i++) {
$bar = $arr; // or comment out me
@msg555
msg555 / apples.txt
Last active August 29, 2015 14:24
Apple+Any% rules and route
Apple+Any% on dustkid.com
Rules
* This is NG+ (all levels are unlocked already)
* You must start on downhill and may not use tomes.
* You must hit every apple in the stage: the apple counts are listed below. You may use a super to hit an apple.
* You only need to complete stages with apples.
* You must complete the stage after hitting all apples.
* You may die/and or deathwarp. It doesn't matter if you die immediately after hitting an apple.
* You may enable/disable checkpoints at will (though all levels are possible with checkpoints always on).
@msg555
msg555 / mutex.h
Last active August 29, 2015 14:23
/* Correct answer is "OK". Most solutions incorrectly identify
* (4, 5) as a deadlock despite it not being reachable.
*/
int NumberOfOperations(long long i) {
return 8;
}
int GetOperation(long long i, long long index) {
int op1[] = {1, 2, -2, 3, 2, -2, -1, -3};
@msg555
msg555 / dfwrap.sh
Created April 16, 2015 20:10
Dustforce Wrapper for Linux
#!/bin/sh
DIR="/home/msg555/Dustforce"
BIN="$DIR/Dustforce.bin.x86_64"
BINESC=$(echo "$BIN" | sed -e 's/[]\/$*.^|[]/\\&/g')
if ps aux | grep "$BINESC" > /dev/null; then
/bin/echo -en '\xe1\x0d\x00\x00'"$@"'\x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' | head -c 256 > "$DIR/IPC.sock"
else
"$BIN" $@
fi