Skip to content

Instantly share code, notes, and snippets.

View orlp's full-sized avatar
⚠️
This user's social credit score is unknown.

Orson Peters orlp

⚠️
This user's social credit score is unknown.
View GitHub Profile
@orlp
orlp / gist:1551359
Created January 2, 2012 16:56
GLEW cythonified
from libc.stdint cimport int64_t, uint64_t
cdef extern from "glew_include.h":
ctypedef struct _cl_context:
pass
ctypedef struct _cl_event:
pass
ctypedef struct __GLsync:
pass
/*
Copyright (c) 2005-2008, Simon Howard
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
@orlp
orlp / gist:1657509
Created January 22, 2012 15:57
Pure genius
# Matthew N. Brown copyright 2007
# Here is an example program in wich
# balls hit walls and other balls:
#
# This program draws circles using: pygame.draw.circle
#
# You can copy this program on to
# your own computer and run it.
#
class Eye(object):
MAX_EYESIGHT = 500
FOV = 160
IMAGE_RESOLUTION = 360
def __init__(self, owner, game):
self.owner = owner
self.x = 0
self.y = 0
self.direction = 0
import inspect
def merge_objects(iterable):
class MergedObject: pass
merged = MergedObject()
for obj in iterable:
merged.__dict__.update(inspect.getmembers(obj))
@orlp
orlp / gist:1978092
Created March 5, 2012 12:09
Ultra fast IEEE754 double-precision mode sin function
double cc_sin(double x) {
const double a = 0.00735246819687011731341356165096815;
const double b = -0.16528911397014738207016302002888890;
const double c = 0.99969198629596757779830113868360584;
double x2;
union {
double d;
long i;
@orlp
orlp / gist:1980227
Created March 5, 2012 18:38
Fast sin function - IEEE754 only - double precision FPU mode only - (sizeof(double)/2) == sizeof(int) only - unreadable version :D
inline double fast_sin(register double x) {
register union {
double d;
int i;
} y;
register int k;
register double z;
y.d = x;
------------------
System Information
------------------
Time of this report: 3/6/2012, 19:11:37
Machine name: AEMIL-PC
Operating System: Windows 7 Home Premium 64-bit (6.1, Build 7600) (7600.win7_gdr.110622-1503)
Language: Dutch (Regional Setting: Dutch)
System Manufacturer: Packard Bell
System Model: EasyNote TK36
BIOS: InsydeH2O Version V1.14
--- Log started at Fri Feb 24 23:15:57 2012
000000.000| 8160.0000kb| 8160.0000kb added| DEBUG| RADS::API::Impl::Main::Main: User kernel is running, attempting connection.
000000.000| 8296.0000kb| 136.0000kb added| DEBUG| RADS::Common::Cider::Cider: Failed to load TGIsFullscreen, Cider not running
000000.000| 8296.0000kb| 0.0000kb added| ALWAYS| RADS::Common::Cider::Create: Running on Windows
000000.000| 8296.0000kb| 0.0000kb added| DEBUG| RADS::API::Impl::Main::Main: Using Named Pipe to attempt connection
000000.000| 8352.0000kb| 56.0000kb added| DEBUG| RADS::API::Impl::Main::Main: Connected to kernel successfully
000000.001| 8364.0000kb| 12.0000kb added| DEBUG| RADS::Common::RegistryHelp::RegKeyValueString::RegKeyValueString: (Software\Riot Games\RADS, LocalRootFolder, c:\rads)
000000.001| 8364.0000kb| 0.0000kb added| DEBUG| RADS::Common::SolutionManifest::Load: ("C:/Riot Games/League of Legends/RADS/solutions/lol_game_client_sln/releases/0.0.0.123/sol
--- Log started at Sat Feb 25 14:39:14 2012
000000.000| 8160.0000kb| 8160.0000kb added| DEBUG| RADS::API::Impl::Main::Main: User kernel is running, attempting connection.
000000.000| 8296.0000kb| 136.0000kb added| DEBUG| RADS::Common::Cider::Cider: Failed to load TGIsFullscreen, Cider not running
000000.000| 8296.0000kb| 0.0000kb added| ALWAYS| RADS::Common::Cider::Create: Running on Windows
000000.000| 8296.0000kb| 0.0000kb added| DEBUG| RADS::API::Impl::Main::Main: Using Named Pipe to attempt connection
000000.001| 8352.0000kb| 56.0000kb added| DEBUG| RADS::API::Impl::Main::Main: Connected to kernel successfully
000000.001| 8364.0000kb| 12.0000kb added| DEBUG| RADS::Common::RegistryHelp::RegKeyValueString::RegKeyValueString: (Software\Riot Games\RADS, LocalRootFolder, c:\rads)
000000.001| 8364.0000kb| 0.0000kb added| DEBUG| RADS::Common::SolutionManifest::Load: ("C:/Riot Games/League of Legends/RADS/solutions/lol_game_client_sln/releases/0.0.0.123/sol