Skip to content

Instantly share code, notes, and snippets.

/*
Copyright (c) 2024, Dominic Szablewski - https://phoboslab.org
SPDX-License-Identifier: MIT
Compile with:
gcc l555.c -lm -O3 -o l555
PCM WAV to L555 MWV:
./l555 in.wav out.mwv
#include <stdio.h>
#include <stdlib.h>
// -----------------------------------------------------------------------------
// Cross platform high resolution timer
// From https://gist.github.com/ForeverZer0/0a4f80fc02b96e19380ebb7a3debbee5
#include <stdint.h>
#include <stdbool.h>
#if defined(__linux)
@phoboslab
phoboslab / server.js
Created June 21, 2021 06:33
Impact2 Weltmeister Server
'use strict';
let http = require('http'),
url = require('url'),
querystring = require('querystring'),
fs = require('fs'),
editorIndex = 'editor/editor.html',
port = parseInt(process.argv[2] || 8080, 10);
ig.module(
'plugins.json'
)
.defines(function(){ "use strict";
ig.JSON = ig.Class.extend({
data: null,
path: '',
ig.module(
'game.entities.door'
)
.requires(
'plugins.twopointfive.entity'
)
.defines(function(){
EntityDoor = tpf.Entity.extend({
type: ig.Entity.TYPE.NONE,
@phoboslab
phoboslab / gist:50672afc9bd6ceb36a3e
Created February 2, 2015 17:54
Impact Gamepad Plugin
ig.module(
'plugins.gamepad'
)
.requires(
'impact.input',
'impact.game'
)
.defines(function(){
// Assign some values to the Gamepad buttons. We use an offset of 256
// idbsimple - tiny wrapper around indexeDB to behave like an
// asynchronous localStorage.
// API (all callbacks are optional):
// idbsimple.getItem(key, function(error, value){...});
// idbsimple.setItem(key, value, function(error){...});
// idbsimple.removeItem(key, function(error){...});
// idbsimple.clear(function(error){...});
// idbsimple.delete();
@phoboslab
phoboslab / gist:10671262
Created April 14, 2014 18:21
ejecta color hash generator
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
typedef union {
unsigned int hex;
struct {
unsigned char r, g, b, a;
@phoboslab
phoboslab / gist:5967844
Created July 10, 2013 16:32
Get Wifi or Public IP on the iPhone. Works with iOS7
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <net/if.h>
void ip_for_interface(const char *interface_name, char *ip, const int length) {
*ip = NULL;
@phoboslab
phoboslab / OBJLoader.js
Created July 10, 2013 09:08
OBJLoader for Three.js/Ejecta
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.OBJLoader = function () {
THREE.EventDispatcher.call( this );
};