Skip to content

Instantly share code, notes, and snippets.

@nagyv
nagyv / odoo.ini
Created Dec 29, 2014
odoo supervisor ini
View odoo.ini
[program:odoo]
user=openerp
directory=/home/openerp/odoo
command=odoo.py -c /home/openerp/odoo/openerp_serverrc.prod
environment=PATH="/home/openerp/odoo/venv/bin"
autostart=true
autorestart=true
stopsignal=QUIT
stopwaitsecs=30
startsecs=5
@nagyv
nagyv / 0 - odoo logs to sentry
Last active Dec 5, 2018 — forked from avoine/gist:2912777
Script to send rsyslog message of OpenERP to Sentry
View 0 - odoo logs to sentry
This gist provides a simple setup to add Sentry logging to OpenERP/Odoo.
As Odoo's logging setup is rather limited, I'm using syslog to collect and forward logs to Sentry.
These scripts should run without any modification on an Ubuntu based server, assuming the paths and user names for openerp match with the ones in the `supervisord.conf` file.
To have rsyslog2sentry run fine, you'll need some python pagkages installed
$ pip install raven loggerglue
@nagyv
nagyv / gist:e8673fb9344bf6b7fc58
Last active Aug 29, 2015
brew install -v --HEAD goaccess 2>&1 failure
View gist:e8673fb9344bf6b7fc58
$ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: f92e7ec4077ebb226a9637b369db0e294a7afa8e
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit ivybridge
OS X: 10.9.2-x86_64
Xcode: 5.1.1
CLT: 5.1.0.0.1.1396320587
@nagyv
nagyv / goaccess.py
Created May 6, 2014
A python script for downloading and processing Amazon S3 logs using goaccess
View goaccess.py
#!/bin/python
import os
from boto.s3.connection import S3Connection
import subprocess
from datetime import datetime, date
import argparse
import tempfile
import json
parser = argparse.ArgumentParser(description="Downloads logs from S3, and parses them with goaccess.")
@nagyv
nagyv / middleware.py
Created Oct 29, 2012
Django facebook connect middleware w/ facepy
View middleware.py
import logging
import facepy as facebook
from django.conf import settings
from django.contrib.auth.signals import user_logged_in
from django.db import models
from django.contrib.auth import logout
from django.contrib.auth.models import User
class FBAuthMiddleware(object):
def __init__(self):
@nagyv
nagyv / fields.py
Created May 22, 2012
Google Protobuffer field for Django
View fields.py
''' A model field to store and retrieve Google Protocol Buffer objects easily.
Uses the BlobField available on GAE for storage.
Usage:
myfield = ProtobufField(protoclass=MyProtocolClass)
where MyProtocolClass is a protocol descriptor class generated from a .proto file.
The field is supposed to store only the given kind of protocol messages.
@nagyv
nagyv / gist:2538496
Created Apr 29, 2012
Testing mongoose pre-save with async
View gist:2538496
var mongoose = require('mongoose'),
async = require('async'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
var MyS = new Schema({
feeling: String
});
MyS.pre('save', function(done){
async.parallel([
@nagyv
nagyv / mongoose-test.js
Created Apr 4, 2012
The simplest Mongoose app to run
View mongoose-test.js
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
var myS = new Schema({
name: {type: String, required: true}
});
var My = mongoose.model('My', myS);
var my = new My({'name': 'bika'});
@nagyv
nagyv / file1.js
Created Mar 17, 2012
Creating JSON request browser with Tobi
View file1.js
var tobi = require('tobi'),
browser = tobi.createBrowser(8000, "localhost");
json_browser = (function(){
var json_header = {headers:
{
"Accept": "application/json",
"X-Requested-With": "XMLHttpRequest"
}
};
@nagyv
nagyv / file1.js
Created Mar 11, 2012
Connecting to mongodb using a mongodb:// uri
View file1.js
var Db = require('mongodb').Db;
//...
options.noOpen = true;
myDb = Db.connect(mongouri, options);
// or
options.noOpen = false;