Skip to content

Instantly share code, notes, and snippets.

View ecarreras's full-sized avatar
💡
IT for utilities

Eduard Carreras ecarreras

💡
IT for utilities
View GitHub Profile
def delta_months(date, months):
sign = months / abs(months)
current_day = date.day
date -= timedelta(current_day)
while months:
month_days = calendar.monthrange(date.year, date.month)[1]
date += timedelta(month_days * sign)
months += sign * -1
if current_day > month_days:
current_day = month_days
#!/usr/bin/env python
import xmlrpclib
import sys
def run_test(host, port, dbname, uid, pwd, tid):
sock = xmlrpclib.ServerProxy('https://%s:%d/xmlrpc/ws_transaction'
% (host, port))
sock.commit(dbname, uid, pwd, tid)
sock.close(dbname, uid, pwd, tid)
@ecarreras
ecarreras / VARS.sh
Last active December 11, 2015 02:28
Scripts per actualització de versió de l'ERP
VERSION="2.35.0"
@ecarreras
ecarreras / README.md
Last active December 11, 2015 17:09
Install/Upgrade packages without (re)starting services in Debian/Ubuntu
@ecarreras
ecarreras / requirements.txt
Last active December 12, 2015 04:18
osx client 5
Babel
Flask
Flask-Babel
Jinja2
Mako
MarkupSafe
PIL
Werkzeug
blinker
certifi
#!/bin/sh
VPN_PATH="/etc/openvpn/porta/[email protected]"
VPN_CONFIG="[email protected]"
case "$1" in
start)
echo "Connecting to GISCE VPN"
openvpn --client --config $VPN_PATH/$VPN_CONFIG &>$VPN_PATH/logfile &
;;
@ecarreras
ecarreras / REAME.md
Last active December 13, 2015 17:58
Switcht to previous workspace

Switch to previous workspace

  1. Start the server.
 $ python lw.py server
  1. Bind a shortcut to python lw.py client.
@ecarreras
ecarreras / README.md
Last active December 14, 2015 04:29
Docs requirements
$ pip install https://gist.github.com/ecarreras/5028757/raw/requirements.txt

Modifiquem l'sphinx per activar les extencions.

extensions = ['sphinx.ext.autodoc', 'rst2pdf.pdfbuilder', 'sphinxcontrib.blockdiag', 'sphinxcontrib.actdiag', 'sphinxcontrib.nwdiag']

pdf_documents = [
@ecarreras
ecarreras / pr.md
Last active December 14, 2015 21:28 — forked from kennethreitz/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add a new remote. Obviously, change the github url to match your project's URL. It ends up looking like this:

<xpath expr="//form/group[5]/group[1]" position="attributes">
<attribute name="attrs">[('informe','not in','(export_factures_desglossat', 'export_trams_potencia_i_municipi'))]}</attribute>
</xpath>
<xpath expr="//form/group[5]/group[2]" position="attributes">
<attribute name="attrs">[('informe','in','(export_factures_desglossat', 'export_trams_potencia_i_municipi'))]}</attribute>
</xpath>