Skip to content

Instantly share code, notes, and snippets.

View alexander-arce's full-sized avatar

Alex Arce alexander-arce

View GitHub Profile
@alexander-arce
alexander-arce / Debug Server Action
Created November 19, 2014 18:46
Auto reply Server Action::OpenErp
#If you need debug you variables send to python code
#then modify openerp/tools/safe_eval.py
#You need add opcodes for print statement in _SAFE_OPCODES variable
_SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR',
'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'DELETE_NAME',
'JUMP_FORWARD', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE', 'JUMP_ABSOLUTE',
'MAKE_FUNCTION', 'SLICE+0', 'SLICE+1', 'SLICE+2', 'SLICE+3',
# New in Python 2.7 - http://bugs.python.org/issue4715 :
@alexander-arce
alexander-arce / Mexican cities
Last active August 29, 2015 14:13
States, cities Id's from OpenErp
SELECT RCSC.ID, RCSC.NAME,MD.NAME,RCSC.state_id
FROM IR_MODEL_DATA AS MD
JOIN res_country_state_city AS RCSC ON RCSC.ID=MD.RES_ID
WHERE MODULE='l10n_mx_cities'
@alexander-arce
alexander-arce / README.md
Created January 28, 2015 17:11
diff products

README is empty

@alexander-arce
alexander-arce / Vagrant on RVM
Created February 22, 2015 22:30
Installing Vagrant from git on RVM
## References ##
# https://gorails.com/setup/ubuntu/14.10
# https://rvm.io/rvm/install
# https://rvm.io/integration/bundler#cd-hook
# https://github.com/mitchellh/vagrant/wiki/Installing-Vagrant-from-source
# http://gillesfabio.com/blog/2011/03/01/rvm-for-pythonistas-virtualenv-for-rubyists/
#Import public key for server
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
#Install RVM
@alexander-arce
alexander-arce / Bulk update
Created April 2, 2015 19:50
Postgresql, change owner
--Tables
SELECT 'ALTER TABLE '|| schemaname || '.' || tablename ||' OWNER TO ccaprod;'
FROM pg_tables WHERE NOT schemaname IN ('pg_catalog', 'information_schema')
ORDER BY schemaname, tablename;
--Sequences
SELECT 'ALTER SEQUENCE '|| sequence_schema || '.' || sequence_name ||' OWNER TO ccaprod;'
FROM information_schema.sequences WHERE NOT sequence_schema IN ('pg_catalog', 'information_schema')
ORDER BY sequence_schema, sequence_name;
--Views
SELECT 'ALTER VIEW '|| table_schema || '.' || table_name ||' OWNER TO ccaprod;'
@alexander-arce
alexander-arce / Append key to remote host
Last active August 29, 2015 14:20
AutoSSH tunnel mysql
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
@alexander-arce
alexander-arce / Export ODBC
Created July 5, 2015 15:25
MIgrate DB Acess
Private Sub Comando17_Click()
Dim sTblNm As String
Dim sTypExprt As String
Dim sCnxnStr As String, vStTime As Variant
Dim db As Database, tbldef As DAO.TableDef
On Error GoTo ExportTbls_Error
sTypExprt = "ODBC Database"
sCnxnStr = "ODBC;DSN=PostgreSQL35W;DATABASE=siafu;SERVER=127.0.0.1;PORT=5432;UID=postgres;PWD=postgres;CA=d;A6=;A7=100;A8=4096;B0=255;B1=8190;BI=0;C2=dd_;;CX=1c20502bb;A1=7.4-1"
@alexander-arce
alexander-arce / select row numbers
Created September 21, 2015 22:19
Row numbers, Postgresql
SELECT
row_number() over() as row_number, ..
FROM ...
@alexander-arce
alexander-arce / Excel
Last active November 26, 2015 22:13
EAN13 check digit
Español
=B1&(REDONDEAR.MAS(((MED(B1,2,1)+MED(B1,4,1)+MED(B1,6,1)+MED(B1,8,1)+MED(B1,10,1)+MED(B1,12,1))*3)+(MED(B1,1,1)+MED(B1,3,1)+MED(B1,5,1)+MED(B1,7,1)+MED(B1,9,1)+MED(B1,11,1)),-1)-(((MED(B1,2,1)+MED(B1,4,1)+MED(B1,6,1)+MED(B1,8,1)+MED(B1,10,1)+MED(B1,12,1))*3)+(MED(B1,1,1)+MED(B1,3,1)+MED(B1,5,1)+MED(B1,7,1)+MED(B1,9,1)+MED(B1,11,1))))
Ingles
=C4&(ROUNDUP(((MID(C4,2,1)+MID(C4,4,1)+MID(C4,6,1)+MID(C4,8,1)+MID(C4,10,1)+MID(C4,12,1))*3)+(MID(C4,1,1)+MID(C4,3,1)+MID(C4,5,1)+MID(C4,7,1)+MID(C4,9,1)+MID(C4,11,1)),-1)-(((MID(C4,2,1)+MID(C4,4,1)+MID(C4,6,1)+MID(C4,8,1)+MID(C4,10,1)+MID(C4,12,1))*3)+(MID(C4,1,1)+MID(C4,3,1)+MID(C4,5,1)+MID(C4,7,1)+MID(C4,9,1)+MID(C4,11,1))))
Libre Office
Español
=B1&(REDONDEAR.MAS(((EXTRAEB(B1,2,1)+EXTRAEB(B1,4,1)+EXTRAEB(B1,6,1)+EXTRAEB(B1,8,1)+EXTRAEB(B1,10,1)+EXTRAEB(B1,12,1))*3)+(EXTRAEB(B1,1,1)+EXTRAEB(B1,3,1)+EXTRAEB(B1,5,1)+EXTRAEB(B1,7,1)+EXTRAEB(B1,9,1)+EXTRAEB(B1,11,1)),-1)-(((EXTRAEB(B1,2,1)+EXTRAEB(B1,4,1)+EXTRAEB(B1,6,1)+EXTRAEB(B1,8,1)+EXTRAEB(B1,10,1)+EXTRAEB(B1,
@alexander-arce
alexander-arce / Reset stock
Created November 26, 2015 23:45
OpenERP/Odoo
DELETE FROM stock_move;
DELETE FROM mrp_production;
DELETE FROM stock_picking;
DELETE FROM sale_order;
DELETE FROM procurement_order;