Skip to content

Instantly share code, notes, and snippets.

@tong
tong / sfxr.c
Last active September 29, 2015 16:08
SFXR, C++ original
//#include <stdio.h>
//#include <stdarg.h>
//#include <stdlib.h>
//#include <time.h>
#include <math.h>
#include <SDL/SDL.h>
#include <neko.h>
#define rnd(n) (rand()%(n+1))
@tong
tong / C2DMessenger.hx
Last active October 1, 2015 14:08
C2DM test script
package android;
/**
Android Cloud 2 Device Messenger.
*/
class C2DMessenger {
public static inline var C2DM_URL_LOGIN = "https://www.google.com/accounts/ClientLogin";
public static inline var C2DM_URL_SEND = "https://android.apis.google.com/c2dm/send";
@tong
tong / Index.hx
Last active October 3, 2015 13:58
SASL-MD5 remote computation for XMPP clients
import jabber.sasl.MD5Calculator;
using Lambda;
/**
Simple, remote SASL-MD5 calculator for XMPP clients
*/
class Index {
static var passwords = {
tong : 'test'
@tong
tong / bosh-proxy.php
Created May 22, 2012 09:03
PHP HTTP proxy for XMPP/BOSH connections using CORS
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true ");
header("Access-Control-Allow-Methods: OPTIONS, GET, POST");
header("Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
$url = "http://example.com/http-bind"; // URI of the HTTP/BOSH gate to the XMPP server
$postdata = file_get_contents('php://input');
@tong
tong / nacl-toolchain.xml
Created February 2, 2013 12:30
NativeClient toolchain file for HXCPP
<!-- NativeClient hxcpp toolchain -->
<xml>
<include name="gcc-toolchain.xml"/>
<path name="${NACL_SDK_ROOT}/toolchain/linux_x86_newlib/bin"/>
<set name="M" value="32" unless="HXCPP_M64" />
@tong
tong / haxe-completion.sh
Last active December 14, 2015 05:49
Haxe shell completion script
#!bash
#
# Haxe bash completion
#
__haxe_commands() {
echo "-cp -js -swf -as3 -neko -php -cpp -cs -java -python -xml -main -lib -D -v -debug -dce -swf-version -swf-header -swf-lib -swf-lib-extern -java-lib -net-lib -net-std -c-arg -x -resource -prompt -cmd --flash-strict --no-traces --gen-hx-classes --next --each --display --no-output --times --no-inline --no-opt --php-front --php-lib --php-prefix --remap --interp --macro --eval --wait --connect --cwd -version --help-defines --help-metas -help --help"
}
_haxe_complete() {
@tong
tong / haxelib-completion.sh
Last active December 25, 2015 21:03
Haxelib shell completion script
#!bash
#
# Haxelib bash completion (3.2.0-rc.3)
#
__haxelib_commands() {
echo "install upgrade update remove list set search info user config path version help submit register local dev git setup newrepo deleterepo selfupdate convertxml run proxy"
}
_haxelib_complete(){
@tong
tong / NekoBoot.hx
Last active January 27, 2020 11:49
Haxe port of nekoboot.neko for creating executables from bytecode. Original: http://code.google.com/p/nekovm/source/browse/trunk/src/tools/nekoboot.neko Usage : nekoboot <file.n>
import sys.FileSystem;
import sys.io.File;
/**
Haxe port of nekoboot.neko for creating executables from neko bytecode.
Original version: https://github.com/HaxeFoundation/neko/blob/master/src/tools/nekoboot.neko
Usage : nekoboot <file.n>
*/
@tong
tong / WebSocketUtil.hx
Created March 5, 2013 09:55
Haxe/Sys websocket handshake util
package sys.net;
import haxe.crypto.Sha1;
import haxe.io.BytesInput;
import haxe.io.Output;
class WebSocketUtil {
public static inline var MAGIC_STRING = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
@tong
tong / haxe.svg
Created April 20, 2013 12:16
Haxe logo svg (optimized)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.