Skip to content

Instantly share code, notes, and snippets.

@bdelbosc
bdelbosc / ci-stat.gplot
Created August 26, 2014 09:12
Jenkins build stats using gnuplot
set terminal png transparent nocrop enhanced font arial 8 size 640,480
#set terminal png nocrop enhanced font arial 8 size 640,480
set output 'ci-stat.png'
set border 3 front linetype -1 linewidth 1.000
set boxwidth 0.75 absolute
set style fill solid 0.75 border -1
set grid nopolar
set grid noxtics nomxtics ytics nomytics noztics nomztics \
nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
@bdelbosc
bdelbosc / logstash.conf
Created March 12, 2014 15:06
logstash conf to get info from Apache/Nuxeo/PostgreSQL stack
input {
file {
path => "/var/log/nuxeo/server.log"
type => "nuxeo"
}
file {
path => "/var/log/postgresql/postgresql-9.1-main.log"
type => "postgresql"
}
file {
@bdelbosc
bdelbosc / dump-nuxeo-oracle-conf.sql
Last active December 30, 2015 03:08
Dump the Oracle configuration of a Nuxeo DB, this script will output a /tmp/oraconf.txt file, you can run it using sqlplus using the Nuxeo db account.
-- ------------------------------------------------------------
-- Dump Nuxeo and Oracle info
--
SET ESCAPE \
SET SQLPROMPT 'SQL> '
SPOOL '/tmp/oraconf.txt';
SET PAGESIZE 50000;
SET LONG 50000;
SET LINESIZE 200;
-- version and db name
@bdelbosc
bdelbosc / NXP-11897-convert-fulltext-to-tsvector.sql
Last active December 28, 2015 20:49
Script to store Nuxeo fulltext field as tsvector instead of text. See https://jira.nuxeo.com/browse/NXP-11897 for more information.
-- ------------------------------------------------------------
-- NXP-11897 Script to store fulltext field as tsvector instead of text
-- WARNING:
-- 1. Be aware that after converting the fulltext table from text to tsvector
-- the phrase search will not work anymore
-- 2. Make sure to backup you database before running the script
-- 3. Make sure that your fulltext table is not already using tsvector (From
-- psql type '\d fullltext' and check that the fulltext field is 'text'
-- 4. Run the script using psql using the same user as the Nuxeo instance
-- Note that the old fulltext table is renamed into fulltext_old
@bdelbosc
bdelbosc / nuxeo-gendata.py
Created June 28, 2013 08:52
Dummy script to generate Nuxeo SQL dump that can be used for mass import.
#!/usr/bin/python
"""
1m docs gen in 6s
"""
#NB_FOLDER=50000
#NB_FILE=1000000
#NB_FOLDER= 1000*1000
@bdelbosc
bdelbosc / nuxeo-gendata-dbpedia.py
Created June 28, 2013 08:43
Dummy script to generate Nuxeo SQL dump that can be used for mass import, create Nuxeo documents using dbpedia.
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Extract dbpedia summaries and export Nuxeo SQL dump.
It requires dbpediakit https://github.com/ogrisel/dbpediakit.
"""
import sys
import random
import itertools
@bdelbosc
bdelbosc / dump-nuxeo-postgres-config.sql
Last active December 16, 2015 22:29
Dump the PostgreSQL configuration of a Nuxeo DB, this script will output a /tmp/pgconf.txt file, you can run it using psql using the Nuxeo db account.
\o /tmp/pgconf.txt
\timing
SELECT now(), Version();
SELECT current_database() AS db_name, pg_size_pretty(pg_database_size(current_database())) AS db_size, pg_size_pretty(SUM(pg_relation_size(indexrelid))::int8) AS index_size FROM pg_index;
-- pg buffer cache first so they are not modified by stats
SELECT (SELECT pg_size_pretty(COUNT(*) * 8192) FROM pg_buffercache) AS buffer_size,
pg_size_pretty(count(*) * 8192) as buffered FROM pg_class c
INNER JOIN pg_buffercache b ON b.relfilenode = c.relfilenode
INNER JOIN pg_database d ON (b.reldatabase = d.oid AND d.datname = current_database())
@bdelbosc
bdelbosc / dbpediakit.py
Created January 26, 2012 14:28
DBpedia abstract extractor
"""Utility script to tweak the ntriples DBpedia dumps"""
# License: MIT
import csv
import logging
import os
import sys
import re
from collections import namedtuple
from urllib import unquote