Skip to content

Instantly share code, notes, and snippets.

//-------------------------------------------------------------------
// File: NxGrid.h
// Author: Choi, Changrak
// Date: 2007.10.18.
// Update:
//
//-------------------------------------------------------------------
#ifndef _NXGRID_H_
#define _NXGRID_H_
#include <NxNode.h>
@sigman78
sigman78 / l15decode.py
Last active December 19, 2015 18:09
Convert L15 raw to 8 bit pgm image
#!/usr/bin/env python
"""l15decode.py: L15 image format decoder."""
import os, sys
from time import time
import array
NUMPY = False
try:
@sigman78
sigman78 / l15decode.py
Last active December 19, 2015 18:09
Convert L15 raw to 8 bit pgm
#!/usr/bin/env python
"""l15decode.py: L15 image format decoder."""
import os, sys
from time import time
import array
NUMPY = False
try:
@sigman78
sigman78 / test.as
Created August 20, 2013 20:18
Repro case for TypeError: Error #1034: Type Coercion failed
package experimental {
import flash.display.Sprite;
public class CoercionError extends Sprite {
private var inner:Inner = new Inner();
public function CoercionError() {
test();
}
@sigman78
sigman78 / .tmux.conf
Created December 11, 2013 00:13
current tmux conf
# Custom status
set-option -g status-utf8 on
set-option -g status-interval 1
set-option -g status-attr bright
set-option -g status-fg green
set-option -g status-bg colour0
set-option -g status-left-length 20
set-option -g status-left '#[fg=green][#[fg=red]#S#[fg=green]]#[default]'
set -g status-justify centre
@sigman78
sigman78 / cubrot.py
Created December 17, 2013 19:10
generate sequence of cube rotation group
# Generate all cube rotation group (permutations)
# There are 24 of them, including identity
# Pure integer arithmetic
#
#
# {1,a,a2,a3,b,ba,ba2,ba3,b2,b2a,b2a2,b2a3,b3,
# b3a,b3a2,b3a3,ab,aba,aba2,aba3,a3b,a3ba,a3ba2,a3ba3}
#
#
# fast form of the 8x8 dct/idct
# 16bit integer, simd-capable
"""
http://fgiesen.wordpress.com/2013/11/10/bink-2-2-integer-dct-design-part-2/
The DCT described last time (and implemented with the Matlab/Octave code above)
is a scaled DCT, and I didn’t mention the scale factors last time.
However, they’re easy enough to solve for. We have a forward transform matrix, M.
Since the rows are orthogonal (by construction), the inverse of M (and hence our IDCT)
@sigman78
sigman78 / opt_int.cpp
Created February 4, 2014 14:11
Optional Int type
#include <cassert>
#include <climits>
template<typename T>
struct integer_limits {
static const T min;
static const T max;
};
template<>
/// in file dd_publishing.h
/// replace
#include <stdint.h>
#include <stdbool.h>
/// to
#include <stdint.h>
#if defined(_MSC_VER)
#ifndef __cplusplus
@sigman78
sigman78 / gist:9355537
Last active August 29, 2015 13:57
Game authentication mechanics

What we want

  • Player should be able to play anonymously (however he might be exempted from the leaderboards - no shirt, no pants, no identity)
  • Whenever Gamecenter or Facebook ID is provided, we can bind user profile to the identity
  • Player should be able to access the game from the multiple devices (exclusively, though)
  • Identity should persist even if identity service is not available right now (cant login to facebook?)
  • Game should handle change of the identity predictably - either prompt to create new account or not (logged as another user)
  • There are should be a method to reset the identity (and maybe to restore it)
  • There can be multiple vendor devices (android and iOS for example)