Skip to content

Instantly share code, notes, and snippets.

@tinogis
tinogis / parse_REE_agent.py
Last active October 17, 2015 17:02
117_Distribuidores.pdf REE file parsing. Creates a csv with extracted information. Can generate a sql for GISCE-ERP ref2 update. It may be useful for 117_Comercilizadores.pdf file
# -*- coding: utf-8 -*-
# pdftotext 117_Distribuidores.pdf creates 117_Distribuidores.txt
# pdftotext 117_Comercializadores.pdf creates 117_Comercializadores.txt
import csv
import sys
import re
@tinogis
tinogis / x11vnc.md
Last active December 30, 2015 14:53
x11vnc screen and program sharing

Screen sharting with x11vnc

Share desktop screen

x11vnc -display :0

Share only one screen on a dual screeen desktop for multiples (-shared) clients

@tinogis
tinogis / actions.sql
Last active August 29, 2015 14:22
OpenERP: Find actions to a model (i.e res.users),to find duplicities
select id,name,value,object,meta, key from ir_values where key='action' and model='res.users' and key2='client_action_relate' and (user_id=1 or (user_id IS NULL));
@tinogis
tinogis / report.py
Last active January 21, 2019 18:30
Get and view an erp5 pdf report from command line
from erppeek import Client
import sys
import base64
from subprocess import call
import time
#report = 'giscedata.facturacio.factura'
#ids = [1513047, 1513049, 1513057, 1513042]
#ids = [1513042]
SELECT
c.id,c.state,
split_part(c.name,'(',2) AS contador,
split_part(c.ref2,',',2) AS id_contador,
c.description,
m.name
FROM crm_case AS c
LEFT JOIN giscedata_lectures_comptador m ON (m.id=split_part(c.ref2,',',2)::int)
WHERE state='open' AND description LIKE '%lecturas_diferentes_encontradas%';
@tinogis
tinogis / CleanGeoserver.sh
Last active August 29, 2015 14:00
GeoServer tips
#!/bin/bash
# To clean demo data from a newly installed geoserver you have to delete some data from `GEOSERVER_DATA_DIR`
# Info from http://gis.stackexchange.com/questions/33049/automating-removal-of-all-demo-layers-from-geoserver
GEOSERVER_DATA_DIR=/var/lib/tomcat7/webapps/geoserver/data/
TOMCAT_USER=tomcat7
TOMCAT_GRP=tomcat7
cd ${GEOSERVER_DATA_DIR}
@tinogis
tinogis / gist:5947644
Created July 8, 2013 10:05
bash per git
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1="\u@\h \w \`parse_git_branch\`\$ "
#!/bin/bash
d_repo=( $(git remote -v | grep '\(push\)' | cut -d':' -f 2 | \
cut -d' ' -f 1 | cut -d '.' -f 1) )
d_base="developer"
d_from=gisce:$(git branch --no-color 2> /dev/null | grep '^\*' | \
cut -d ' ' -f 2)
read -p "User:" user
read -sp "Password:" password
echo
@tinogis
tinogis / openerp-killer.sh
Last active December 17, 2015 12:58
openerp-killer
#!/bin/bash
pids=`ps ax | grep openerp-server | grep -v grep | cut -c -6`
echo "Matarem uns quants erps's.... ($pids)"
kill -9 $pids
@tinogis
tinogis / gist:5066527
Created March 1, 2013 18:07
Veure la branca actual a la shell
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1="\u@\h \w \`parse_git_branch\`\$ "