Skip to content

Instantly share code, notes, and snippets.

View shingonoide's full-sized avatar

Rui Andrada shingonoide

View GitHub Profile
@dreispt
dreispt / odoo-sh.py
Created November 19, 2014 11:04
Odoo Shell: run Odoo commands without a server RPC connection
"""
Setup:
Assuming Odoo 8.0 sources at ~/odoo:
$ cp odoo-sh.py ~/odoo
$ cd ~/odoo
$ python -i odoo-sh.py
Usage example:
>>> env = connect('my-db-name')
>>> Users = env['res.users']
@neilbaylorrulez
neilbaylorrulez / flynn-service-discovery-postgres-node
Last active August 29, 2015 14:08
Flynn Postgres Service Discovery example with NodeJS
(function serviceDiscoveryExample() {
'use strict';
var express = require('express'),
pg = require('pg'),
exec = require('child_process').exec,
app = express(),
port = process.env.PORT || 8000,
username = process.env.PGUSER || 'pg-user',
password = process.env.PGPASSWORD || 'password',
db = process.env.PGDATABASE || 'database',
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active December 13, 2024 20:18
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@amigrave
amigrave / odoo_keycdn.md
Last active June 3, 2021 23:39
Configure Odoo with Keycdn

Support for CDN has been added to Odoo in master branch.

Just tested with KeyCDN and the setup was straightforward.

##Step 1: Create a pull zone in the KeyCDN dashboard

create a pull zone

While creating the zone, enable the CORS option in the advanced features submenu. (more on that later)

@lorin
lorin / vagrant.py
Created September 25, 2014 21:25
Vagrant dynamic inventory script for Ansible
#!/usr/bin/env python
# Adapted from Mark Mandel's implementation
# https://github.com/ansible/ansible/blob/devel/plugins/inventory/vagrant.py
import argparse
import json
import paramiko
import subprocess
import sys
@udondan
udondan / include_vars_merged
Last active June 15, 2023 17:57
Ansible action plugin "include_vars_merged". Same as "include_vars" but merges hashes instead of overriding

Why?

Current version of Ansible (1.7.1) does not merge hashes in the include_vars task even if told so via hash_behaviour = merge in your ansible.cfg. ansible/ansible#9116

This action plugin will merge hashes no matter how you have configured your hash_behaviour.

How to setup:

Save include_vars_merged.py to library/plugins/action/include_vars_merged.py

Save include_vars_merged to library/custom/include_vars_merged

@dreispt
dreispt / odoo-api.markdown
Last active December 3, 2019 14:10
Odoo API reference

Fields

from openerp import models, fields, api, _

class MyModel(models.Model):
    _name = 'mymodule.mymodel'
    # Fields are declared as class attributes:
    char = fields.Char('Char', 64)        # name, size
 text = fields.Text('Text')
2014-05-03 12:52:54.919 TRACE cinder Traceback (most recent call last):
2014-05-03 12:52:54.919 TRACE cinder File "./cinder-api", line 55, in <module>
2014-05-03 12:52:54.919 TRACE cinder rpc.init(CONF)
2014-05-03 12:52:54.919 TRACE cinder File "/opt/stack/cinder/cinder/rpc.py", line 63, in init
2014-05-03 12:52:54.919 TRACE cinder aliases=TRANSPORT_ALIASES)
2014-05-03 12:52:54.919 TRACE cinder File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/transport.py", line 183, in get_transport
2014-05-03 12:52:54.919 TRACE cinder invoke_kwds=kwargs)
2014-05-03 12:52:54.919 TRACE cinder File "/usr/local/lib/python2.7/dist-packages/stevedore/driver.py", line 45, in __init__
2014-05-03 12:52:54.919 TRACE cinder verify_requirements=verify_requirements,
2014-05-03 12:52:54.919 TRACE cinder File "/usr/local/lib/python2.7/dist-packages/stevedore/named.py", line 55, in __init__
@florentx
florentx / pgutil.py
Created April 16, 2014 13:28
OpenERP - create missing indexes on Foreign Keys
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import contextlib
__all__ = ['savepoint', 'create_missing_indexes']
@contextlib.contextmanager
def savepoint(cr, name, quiet=False):
@csuwildcat
csuwildcat / Element Resize CSS
Last active July 21, 2019 03:50
Detect resize of elements in all browsers + IE down to version 6
.resize-triggers {
visibility: hidden;
}
.resize-triggers, .resize-triggers > div, .contract-trigger:before {
content: " ";
display: block;
position: absolute;
top: 0;
left: 0;