Skip to content

Instantly share code, notes, and snippets.

View anex's full-sized avatar

Carlos Paredes anex

View GitHub Profile
@anex
anex / docker-machine-forward-port.sh
Last active December 18, 2015 18:53
Docker machine forward port
#SSH Tunnel
ssh docker@$(docker-machine ip default) -L host_ip:host_port:guest_ip:guest_port (pass: tcuser)
#Virtualbox forward
#When the machine is running
VBoxManage controlvm <docker_machine_name> natpf1 “<rule_name>,<rule_protocol>,<host_ip>,<host_port>,<guest_ip>,<guest_port>“;
#When the machine isn't running
@anex
anex / python_unicode.py
Created December 15, 2015 22:47
Python unicode
import sys
reload(sys)
sys.setdefaultencoding('utf8')
@anex
anex / gist:106de0ed53fd7ef07f51
Created July 14, 2015 01:44
Fix QWeb reports rendering to PDF, HTML version problems.
1. Go to settings > Technical > Parameters > System parameters
2. Make a new paramater
Name: web.base.url.freeze
Value: True
3. Edit the parameter web base.url and place the ip on http://0.0.0.0:8069
4. Refresh and everything is fixed.
@anex
anex / ssl_ss_certificate.sh
Last active August 29, 2015 14:23
SSL self signed certificate
openssl req -new -x509 -days 365 -nodes -out /etc/ssl/certs/test.crt -keyout /etc/ssl/private/test.key
@anex
anex / menu&groups
Created April 15, 2015 15:53
ir.ui.menu relation with groups openerp
<record id="original_module.menu_id" model="ir.ui.menu">
<field name="groups_id" eval="[(3,ref('my_new_group_id'))]"/>
</record>
There are actually0-6 numbers for representing each job for a many2many/ one2many field
(0, 0, { values }) -- link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) -- update the linked record with id = ID (write values on it)
(2, ID) -- remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
(3, ID) -- cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
@anex
anex / odoo_m2m_o2m
Created January 23, 2015 01:03
Numbers for representing each job for a many2many/ one2many field
#To do it:
<field name="groups_id" eval="[(3,ref('my_new_group_id'))]"/>
#Numbers relation
(0, 0, { values }) -- link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) -- update the linked record with id = ID (write values on it)
(2, ID) -- remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
(3, ID) -- cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
(4, ID) -- link to existing record with id = ID (adds a relationship)
(5) -- unlink all (like using (3,ID) for all linked records)
@anex
anex / add_old2gitlab
Created November 3, 2014 15:14
Add old repos to gitlab
bundle exec rake gitlab:import:repos RAILS_ENV=production
/* fkey of pkey: */
select * from information_schema.referential_constraints where unique_constraint_name = 'delivery_carrier_pkey';
mike@rbci:~$ psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
@anex
anex / lamba_filter_rml
Created May 28, 2014 22:41
Lambda filter RML reports
<para>[[ repeatIn(filter( lambda participant : participant.is_instructor == True ,course.participant_ids), 'participant') ]]</para>