Skip to content

Instantly share code, notes, and snippets.

@miltonlab
miltonlab / gen_emails.py
Last active July 21, 2021 03:47
Generador de direcciones de correo electrónico a partir de nombres y apellidos
# -*- coding: utf-8 -*-
"""
@file : gen_emails.py
@author : Milton Labanda
@date : 24-04-2014
@description: : Un Generador de nombres de usuario para emails a partir de nombres y apellidos
"""
import itertools
import unicodedata
@miltonlab
miltonlab / insert_mdb_mssql.py
Last active April 14, 2018 11:10
Set record read from Access to insert into SQLServer
import decimal
from decimal import Decimal
import datetime
#Read from Microsoft Access
#rows = cursor_access.execute("SELECT * FROM Predios")
#One record example:
row = (98, '11', '04', '57', '01', '01', '004', '005', '000', '00', '000', '1104570101004005', 'EDIFICADO', 'TNTE MAXIMILIANO RODRIGUEZ', 'UNIPROPIEDAD', 'Residencial', 'C:\\FOTOS\\570101\\004\\005.jpg', 'MODESTO BURNEO', 'S/N', 'JACINTA REYES', 'LOJA, SAN SEBASTIAN', 'Natural', None, datetime.datetime(1973, 1, 26, 0, 0), 44, 'Femenino', False, 'CARMEN PAULINA', 'ILLESCAS BURNEO', 'Cédula', '1102962741', '-', '-', 'Casado', 'MANUEL AGUSTIN', 'TOLEDO CUEVA', 'Cédula', '-', '-', '-', 'BURNEO CAMPOVERDE JULIO MARIANA', '-', None, None, None, None, None, None, None, 'Cédula', None, None, None, False, True, 'Loja', 'Celica', '3', datetime.datetime(2011, 10, 7, 0, 0), '254', datetime.datetime(2011, 10, 31, 0, 0), False, 0, 0, 'Compra - venta', True, 'Calle', 'Adoquín de cemento', True, True, True, True, False, True, True, True, False, True, False, False,
# List branches for remote repositorie
git ls-remote --heads https://github.com/jquemada/cal_branches
@miltonlab
miltonlab / Odoo8.md
Last active September 27, 2015 10:50
Notes about OpenERP (Odoo) development - implementation

Functional Notes

  • The admin user must have Technicals rights to update list modules al Configuration Menu
  • To work the fist login of admin, he have set the password. By default admin not have password
  • Import examples: http://openerp.zikzakmedia.com/Importaci%C3%B3nExportaci%C3%B3nOpenERP
  • CSV Products importation:
    • Basic columns: Name, Internal Reference (Code), Optionall but usefull Customer Taxes , Supplier Taxes
  • Update/Correct translations at GUI, also load custom module translations: Configuration > Load Translation > Language : Select the right and 'Load'
  • Custom reports in my module: *"Sí, lo exportas a RML y en tu módulo creas un arhivo xml que contenga una entrada report que sobre escriba la que está en el archivo: addons/purchase/purchase_report.xml el que se refiere a order.rml
import urllib.request
import json
def analisa_detalhe(cod):
url = 'http://educacao.dadosabertosbr.com/api/escola/'
resp = urllib.request.urlopen(url+str(cod)).read()
resp = json.loads(resp.decode('utf-8'))
if int(resp['salasExistentes']) > 1:
print ('Salas Existentes:', resp['salasExistentes'])
print ('Funcionários:', resp['funcionarios'])
@miltonlab
miltonlab / matrcies.py
Last active August 29, 2015 14:20
Matrices
from numpy import array
a = array([[5.1, 7.4, 3.2, 9.9],
[1.9, 6.8, 4.1, 2.3],
[2.9, 6.4, 4.3, 1.4]])
#cantidad de elemtos
a.size
#dimensiones
a.shape
#Lectura: Obtener un elemento contenido en la matriz
a[1, 3]
@miltonlab
miltonlab / operaciones_arreglos-.py
Created May 4, 2015 14:23
Operaciones con arreglos en Python
edades = numpy.array[(20,23,22)]
#lectura
print (edades[2])
#escritura
edades[1] = 27
#presentacion
for i in range(0, len(edades)):
print (edades[i])
#aunque en python no hace falta el bucle
print(edades)
@miltonlab
miltonlab / manejo_arreglos.py
Created May 4, 2015 14:13
Manejo de Arreglos en Python
import numpy
#creacion e inicializacion
a = numpy.array([2,4,5,9])
#creacion
b = numpy.array()
#inicializacion, por defecto el tipo de dato usado es float
b = numpy.empty(4)
#Mas formas de inicializacion
dias = numpy.empty(7)
edades = numpy.empty(20, dtype=int)
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com
@miltonlab
miltonlab / test_ips.sh
Created December 11, 2014 17:29
Verify conection to certain IPs range
echo "" > /tmp/bads.txt
inicio=164
fin=165
for i in `seq $inicio $fin`
do
ip=10.10.$i.1
if ping $ip -w2 | grep "0 received"
then
echo $ip >> /tmp/bads.txt
fi