Skip to content

Instantly share code, notes, and snippets.

View hbrunn's full-sized avatar

Holger Brunn hbrunn

View GitHub Profile
:~$ python
Python 2.7.18 (default, Apr 20 2020, 20:30:41)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class hunki():
... def __repr__(self):
... return 'Enterprises'
...
>>> Hunki=hunki()
>>> Hunki
@hbrunn
hbrunn / build_wkhtmltopdf_stretch.sh
Last active November 8, 2017 10:41
build_wkhtmltopdf_stretch
mkdir build_wkhtmltopdf_chroot
sudo debootstrap --include=git,python,ca-certificates stretch build_wkhtmltopdf_chroot
sudo chroot build_wkhtmltopdf_chroot
# add a deb-src line to /etc/apt/source.list
grep ^deb /etc/apt/sources.list | sed 's/^deb/deb-src/' >> /etc/apt/sources.list
apt-get update
apt-get build-dep wkhtmltopdf qt5-default
cd /root
git clone --recursive https://github.com/wkhtmltopdf/wkhtmltopdf.git -b 0.12.1
cd wkhtmltopdf
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import json
from lxml import etree
from openerp import _, api, fields, models, SUPERUSER_ID
from openerp.osv import expression
class RestrictFieldAccessMixin(models.AbstractModel):
@hbrunn
hbrunn / cache_messup_demo.py
Created November 18, 2015 10:03
cache_messup_demo.py
#!/usr/bin/env python2
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('odoo_basedir')
parser.add_argument('odoo_cfg')
parser.add_argument('odoo_db')
args = parser.parse_args()
@hbrunn
hbrunn / profile_name_get.py
Created June 30, 2015 05:55
simple script to profile name_get performance
#!/usr/bin/env python2
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('odoo_basedir')
parser.add_argument('odoo_cfg')
parser.add_argument('odoo_db')
parser.add_argument('model')
args = parser.parse_args()
@hbrunn
hbrunn / profile_view_load
Created May 12, 2015 20:20
profile_view_load
#!/usr/bin/env python2
from argparse import ArgumentParser
parser = ArgumentParser(
description='Profile loading a model\'s data for a specific view in order '
'to find bottlenecks')
parser.add_argument('odoo_basedir')
parser.add_argument('odoo_cfg')
parser.add_argument('odoo_db')
@hbrunn
hbrunn / test_perf
Created March 19, 2015 09:13
Test odoo performance for select distinct
#!/bin/sh
set -e
if [ -z "$1" ]; then
echo i need to know which test to run
exit 1
fi
TEST_TYPE=$1
@hbrunn
hbrunn / rebuild_libreoffice.sh
Last active November 10, 2020 05:16
This is an instruction how to rebuild libreoffice on ubuntu trusty to use python-uno for python 2.7
# we need some fixes from 14.10
sudo add-apt-repository --enable-source ppa:libreoffice/libreoffice-4-3
# fetch this repository
sudo apt-get update
# update your libreoffice installation
sudo apt-get install libreoffice
# get all build dependencies for libreoffice
sudo apt-get build-dep libreoffice
# that strangely enough doesn't come with the above
sudo apt-get install gcj-jdk python-dev