Skip to content

Instantly share code, notes, and snippets.

@tinogis
tinogis / svn_diff_liquidacio.diff
Created January 14, 2013 09:34
Diff a liquidacions
@@ -366,6 +366,8 @@
n = doc.createElement("DIPE_FACT_ENERGIA")
facturacion.appendChild(n)
+ if t.name.codi.startswith('6'):
+ t.facturacio_energia = 0.0
txt = doc.createTextNode(str(t.facturacio_energia))
n.appendChild(txt)
@tinogis
tinogis / treure_constraints.sh
Last active December 11, 2015 02:28
Neteja constraints de FPCC_tarifa
for i in `psql -l -A -t | grep -v 'postgres' | grep -v 'proxy'| cut -d '|' -f 1 `; do
psql -d $i -c "alter table giscedata_liquidacio_fpcc_tarifa DROP CONSTRAINT giscedata_liquidacio_fpcc_tarifa_tarifa_uniq;" ;
done
@tinogis
tinogis / pep8-git.sh
Created February 11, 2013 12:28
PEP8 només dels fitxers modificats (git status)
#!/bin/bash
pep8 $(git status -s | grep '\.py$' | cut -c3-)
@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\`\$ "
@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
#!/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 / 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\`\$ "
@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}
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 / 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]