Skip to content

Instantly share code, notes, and snippets.

@mroig
mroig / generate_random_cups.py
Created July 10, 2017 11:41
Generate Random CUPS
# coding: utf-8
import random
cups_checksum_table = 'TRWAGMYFPDXBNJZSQVHLCKE'
cups_name_length = 12
def gen_checksum(cupsname):
"""Calcula el checksum d'un CUPS."""
@mroig
mroig / generate_custom_search_columns_data.py
Last active November 9, 2016 07:58
A for that creates a data in xml format for each one of the columns of a query
for i, column in enumerate(columns):
print u' <record model="custom.search.column" id="##SEARCH_ID##_column_{0}">'.format(i)
print u' <field name="sequence" eval="{0}"/>'.format(i*10)
print u' <field name="search_id" ref="##SEARCH_ID##"/>'
print u' <field name="name">{0}</field>'.format(column)
print u' </record>'