Skip to content

Instantly share code, notes, and snippets.

@umiphos
umiphos / test_pdf417_creation.py
Last active June 25, 2018 22:35
Testing different libraries to create a PDF417 barcode
"""The idea bihind this gist is to measure the amount of time it takes in 3 different packages the creation of a pdf417 barcode."""
import sys
from timeit import default_timer as timer
from elaphe import barcode
from pdf417gen import encode, render_image
import treepoem
def elaphe_image(name, text):
return barcode('pdf417', text, options=dict(eclevel=2, compact=True, columns=13), scale=5)
@umiphos
umiphos / Boleta.xml
Created June 25, 2018 17:23 — forked from giansalex/Boleta.xml
Comprobantes Facturacion Electronica SUNAT UBL 2.1 (Factura, Boleta, Nota de Crédito, Nota de Débito)
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
<cbc:CustomizationID>2.0</cbc:CustomizationID>
@umiphos
umiphos / lxml_item_delete.py
Created June 27, 2018 15:11
Deleting an XML element
"""We want to remove //content item, this is one way to do it."""
from lxml.etree import tostring
from lxml.objectify import fromstring
xml = '
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getStatusCdrResponse xmlns:ns2="http://service.sunat.gob.pe">
<statusCdr>
@umiphos
umiphos / .vimrc
Created June 27, 2018 21:39 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@umiphos
umiphos / pgk_installed_os-sys.py
Last active July 3, 2018 20:24
Check if a pgk is installed
"""If installed it will return 0"""
os.system('which your app')
@umiphos
umiphos / gist:d146d6b0596f13cba766e01e014c8309
Created October 22, 2018 23:57 — forked from mattkatz/gist:65bbc17dbad94c97a01a472734b65d50
Using the Workday API with Python and the suds client library
import sys
from suds import client
from suds.wsse import Security, UsernameToken
from suds.sax.text import Raw
from suds.sudsobject import asdict
from suds import WebFault
'''
Given a Workday Employee_ID, returns the last name of that employee.
@umiphos
umiphos / fix_bad_account.py
Created February 21, 2019 06:00
This gist will fix fix the account_id from a bad placed account in a move.
right_journal = env.ref('absa.account_journal_B2353')
bad_account = env.ref('absa.account_account_102_01_016')
for rec in records:
move_id = rec.mapped('move_id')
move_id.button_cancel()
for line in move_id.line_ids:
if line.journal_id == right_journal and line.account_id == bad_account:
line.write({'account_id':
right_journal.default_debit_account_id.id})
move_id.action_post()
@umiphos
umiphos / delete_all_invoice_related.py
Created February 22, 2019 15:26
From a set of id_galaxy, delete all about that invoice
@umiphos
umiphos / delete_all_invoice_related.py
Last active February 22, 2019 15:47
From a set of id_galaxy, delete all about that invoice