Skip to content

Instantly share code, notes, and snippets.

View bwrsandman's full-sized avatar

Sandy bwrsandman

  • Montreal
View GitHub Profile
@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
@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 / 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 / bo-openerp-HOWTO.md
Last active December 21, 2015 12:48
Seed to setup openerp virtualenv for developement
Index: ../../../Private/code/openerp/fruigor/bzr/pallet-delivery/purchase_lot_tracking/account.py
===================================================================
--- ../../../Private/code/openerp/fruigor/bzr/pallet-delivery/purchase_lot_tracking/account.py (revision )
+++ ../../../Private/code/openerp/fruigor/bzr/pallet-delivery/purchase_lot_tracking/account.py (revision )
@@ -52,17 +52,18 @@
def _estimated_tcu(self, cr, uid, ids, name, arg, context=None):
res = {}
-
for line in self.browse(cr, uid, ids):
# Maintainer: Miguel Useche <migueluseche@skatox.com>
# Contributor: Anton Leontiev <unsector /at/ km.ru>
pkgname=guake-git
pkgver=0.4.4.13.gdc71f60
pkgrel=1
pkgdesc="Top-down terminal for Gnome"
arch=('i686' 'x86_64')
url="http://guake.org/"
license=('GPL')
# Maintainer : Martin Wimpress <code@flexion.org>
# Contributor: Joris Steyn <jorissteyn@gmail.com>
# Contributor: kens
pkgname=finalterm-git
pkgver=0.r120.728072f
pkgrel=1
pkgdesc="A new breed of terminal emulator"
arch=('x86_64' 'i686')
url="http://finalterm.org"
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
@bwrsandman
bwrsandman / server_sentry.patch
Last active January 1, 2016 08:19
Raven Sentry patch to OpenERP 7.0 Server
=== added file 'openerp/bzr_client.py'
--- openerp/bzr_client.py 1970-01-01 00:00:00 +0000
+++ openerp/bzr_client.py 2013-12-26 19:03:41 +0000
@@ -0,0 +1,65 @@
+# -*- encoding: utf-8 -*-
+###############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2013 Savoir-faire Linux
+# (<http://www.savoirfairelinux.com>).
@bwrsandman
bwrsandman / checkout-flake8.sh
Last active January 2, 2016 02:59
Performs bzr branch and checks containing python scripts with fake8
#!/usr/bin/bash
# Check if flake8 and bzr exists
which flake8 > /dev/null || exit 1
which bzr > /dev/null || exit 1
# Check that only one parametter was sent
if [ "$#" -lt "1" ] || [ "$#" -gt "2" ]
then
echo "Usage:"
echo "$0 lp:repository [SUBDIRECTORY]"