Skip to content

Instantly share code, notes, and snippets.

View branan's full-sized avatar
💩

Branan Riley branan

💩
View GitHub Profile
@branan
branan / gist:1015617
Created June 8, 2011 22:36
shared_ptr wrapping
template<typename T>
struct PySharedPtr {
PyObject_HEAD;
std::shared_ptr<T> ptr;
static PyTypeObject type;
static void dealloc(PySharedPtr<T>* self) {
(&(self->ptr))->~shared_ptr();
Py_TYPE(self)->tp_free((PyObject*)self);
}
@branan
branan / gist:1016012
Created June 9, 2011 03:45
Oh look, interactive material files
>>> from SensEngine import *
>>> m = MaterialDef()
>>> m.vertex_shader = "vert"
>>> m.fragment_shader = "frag"
>>> m.geometry_shader = "geom"
>>> m.vertex_shader
'vert'
>>> m.fragment_shader
'frag'
>>> m.geometry_shader
(function(){var g=null,h;try{if(!google.doodle)google.doodle={};var j,m,o,p,r,s,aa,t,u,ba,v,ca,da,ea=navigator.userAgent.indexOf("MSIE")>=0,fa=[[3,"#776a62","#2063ff",2,[[28,23],[103,23]]],[5,"#776a62","#f61b33",2,[[28,38],[103,38]]],[0,"#776a62","#ffdd24",2,[[65,67],[318,67]]],[2,"#776a62","#07d238",2,[[28,81],[281,81]]],[7,"#776a62","#2063ff",1,[[28,96.5],[281,96.5]]],[9,"#776a62","#f61b33",1,[[29,111.5],[104,111.5]]],[1,"#776a62","#07d238",2,[[358,66],[433,66]]],[4,"#776a62","#2063ff",2,[[358,81],[433,81]]],[6,"#776a62","#f61b33",2,[[330,96],[405,96]]],[8,"#776a62","#ffdd24",1,[[358,111.5],[434,111.5]]]],ga=0,ha=0,w=0,x=0,y=!0,z=[],A=g,B=g,C=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},D=function(a,b,c){if(a){if(!google.doodle.ka)google.doodle.ka=[];google.doodle.ka.push(arguments);var d=a,e=b,f=c;d.addEventListener?d.addEventListener(e,f,!1):d.attachEvent("on"+e,f)}},ia=function(a,b,c){a&&(a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c))},ja=function(){if(google.do
@branan
branan / gist:1081106
Created July 13, 2011 19:21
Things my python parser can parse
pass
del myvar
break
continue
global myvar
global myvar1, myvar2
assert a and not not b or c
a+b*c/d
a**b+c
a+=b
if ( !TestRsLoadArchive ( "data.dat" ) ) return false;
if ( !TestRsLoadArchive ( "graphics.dat" ) ) return false;
if ( !TestRsLoadArchive ( "loading.dat" ) ) return false;
if ( !TestRsLoadArchive ( "sounds.dat" ) ) return false;
if ( !TestRsLoadArchive ( "music.dat" ) ) return false;
if ( !TestRsLoadArchive ( "fonts.dat" ) ) return false;
if ( !TestRsLoadArchive ( "patch.dat" ) ) return false;
if ( !TestRsLoadArchive ( "patch2.dat" ) ) return false;
if ( !TestRsLoadArchive ( "patch3.dat" ) ) return false;
import re
import web
import zipfile
ogg_re = re.compile(r'sfx/\w+\.ogg')
prp_re = re.compile(r'dat/'+agename+'_\w+\.prp')
age_re = re.compile(r'dat/'+agename+'\.age')
misc_re = re.compile(r'dat/[\w ]+\.((csv)|(p2f))')
py_re = re.compile(r'python/\w+\.py')
sdl_re = re.compile(r'SDL/'+agename+'\.sdl')
Shorah!
We're working on a database for CWE ages, and we're looking to re-awaken the maintainers. If the maintainers as a guild can be brought back we'd love to work with them, but if there's not enough life left there then volunteers that work directly with the GoW would be greatly appreciated.
We'll work with volunteers to figure out exactly what tools they'll need to make it possible to test CWE ages, and get them together.
You'll need to be able to look at ages from a technical perspective. Our main goal with the first stage of maintaining ages is simply to have somebody read through python scripts and make sure they're doing nothing malicious and to make sure that ages don't crash the game.
CREATE TABLE ages (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, description varchar(255), creator INTEGER, fullname varchar(64), shortname varchar(32) UNIQUE);
CREATE TABLE files (id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, timestamp TIMESTAMP, gamever DECIMAL(5,2), age MEDIUMINT FOREIGN KEY REFERENCES ages(id), status varchar(16), version varchar(32));
=>0 0x006b38a7 plDynamicTextMap::SetJustify+0x57(j=kLeftJustify) [c:\urulive\plasma\sources\plasma\pubutillib\plgimage\pldynamictextmap.cpp:417] in plclient (0x0169de9c)
1 0x0050f5b0 pfGUITextBoxMod::IUpdate+0x7f() [c:\urulive\plasma\sources\plasma\featurelib\pfgameguimgr\pfguitextboxmod.cpp:119] in plclient (0x0169df1c)
2 0x0050ef1d pfGUITextBoxMod::SetText+0x7c(text=0x169df50) [c:\urulive\plasma\sources\plasma\featurelib\pfgameguimgr\pfguitextboxmod.cpp:240] in plclient (0x0169df2c)
3 0x005bc70c pyGUIControlTextBox::SetTextW+0x6b(text={}) [c:\urulive\plasma\sources\plasma\featurelib\pfpython\pyguicontroltextbox.cpp:115] in plclient (0x0169df48)
4 0x005bc793 pyGUIControlTextBox::SetText+0x52(text="") [c:\urulive\plasma\sources\plasma\featurelib\pfpython\pyguicontroltextbox.cpp:104] in plclient (0x0169df78)
5 0x0057af7c ptGUIControlTextBox_setString+0x4b(self=0xd4b49f0, args=0xf278410) [c:\urulive\plasma\sources\plasma\featurelib\pfpython\pyguicontroltextboxglue.cpp:81] in plclient (0x0169df88)
6
@branan
branan / gist:1562391
Created January 4, 2012 21:56
Example OpenGL3.2 buffer/shader usage
#include <GL/glew.h>
#include <GL/glut.h>
GLfloat vert_data[] = {
-1.0, -1.0, 0.0,
1.0, -1.0, 0.0,
0.0, 1.0, 0.0,
};
GLfloat col_data[] = {