Skip to content

Instantly share code, notes, and snippets.

View bwrsandman's full-sized avatar

Sandy bwrsandman

  • Montreal
View GitHub Profile
@bwrsandman
bwrsandman / bo-openerp-HOWTO.md
Last active December 21, 2015 12:48
Seed to setup openerp virtualenv for developement
@bwrsandman
bwrsandman / FunctionPointers.cpp
Last active December 17, 2015 08:28
Comparison between two functions that do the same thing. One is writen out in regular form with a lot of repition, the other uses function pointers.
void Ogre::DotSceneLoader::processEnvironment(TiXmlElement *XMLNode)
{
const String attrNames [] = {"fog", "skyBox", "skyDome", "skyPlane", "clipping"};
void (Ogre::DotSceneLoader::*funcNames[]) (TiXmlElement*) = {
&Ogre::DotSceneLoader::processFog,
&Ogre::DotSceneLoader::processSkyBox,
&Ogre::DotSceneLoader::processSkyDome,
&Ogre::DotSceneLoader::processSkyPlane,
&Ogre::DotSceneLoader::processClipping};
@bwrsandman
bwrsandman / bigram.py
Created December 2, 2012 07:44 — forked from zbriscoe/bigram.py
Bigram
#!/usr/bin/env python
import sys
if sys.version_info >= (3,):
xrange = range
raw_input = input
from re import sub
from numpy import log10
def trim(string):
@bwrsandman
bwrsandman / 4x4naive_bayes.py
Created November 7, 2012 22:12
4x4 naive bayes
#!/usr/bin/env python2
"""\
We are computing the probability of features 1 through 16.
Each feature represents a pixel in a 4 x 4 bitmap.
We are taking into account the probability that a pixel is black.
This simplifies calculations as the probability of white is equal to
the probability of !black.
"""
import numpy, math