- ValidaExprRegFactura.xsl
- ValidaExprRegGuiaRemitente.xsl
- ValidaExprRegNC.xsl
- ValidaExprRegND.xsl
- ValidaExprRegPercepcion.xsl
- ValidaExprRegRetencion.xsl
- ValidaExprRegSummary.xsl
- ValidaExprRegVoided.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from OpenSSL import crypto, SSL | |
from socket import gethostname | |
from pprint import pprint | |
from time import gmtime, mktime | |
from os.path import exists, join | |
CERT_FILE = "myapp.crt" | |
KEY_FILE = "myapp.key" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# for-grep-sed script used to match a string and replace it in set of files | |
FGS_FIELD=$1; | |
FGS_FIELD_REPLACEMENT=$2; | |
for mf in `grep -rn ${FGS_FIELD} --include=\*.{xml,py} | tr ":" " " | awk '{print $1}' | uniq`; do | |
sed_replace="sed -i 's/${FGS_FIELD}/${FGS_FIELD_REPLACEMENT}/g' ${mf}"; | |
eval $sed_replace; | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Originally taken from https://medium.com/@djperalta/python-suds-sunat-example-afc6c37ad426#.mlm9q2lqb | |
from suds.client import Client | |
from suds.wsse import * | |
import requests | |
import base64 | |
import logging | |
logging.basicConfig(level=logging.INFO) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
magia = defaultdict(self.env['account.tax']) | |
for i in self.tax_line_ids: | |
magia[i.tax_group_id.name] += i |
Two ways to do it, but only worked for me so I'll put it first and the second for reference:
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem
Other options for this method in comments below:
# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -certfile root.crt -out hostname.p12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- taken from https://github.com/erickorlando/openinvoiceperu/blob/develop/OpenInvoicePeru/OpenInvoicePeru.Servicio.Soap/Service%20References/Documentos/billService.wsdl --> | |
<wsdl:definitions xmlns:wsp200607="http://www.w3.org/2006/07/ws-policy" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns0="http://service.gem.factura.comppago.registro.servicio.sunat.gob.pe/" xmlns:ns1="http://service.sunat.gob.pe" xmlns:wsp200409="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://service.sunat.gob.pe" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | |
<wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<xsd:schema> | |
<xsd:import schemaLocation="billService.xsd2.xsd" namespace="http://service.sunat.gob.pe" /> | |
</xsd:schema> | |
</wsdl:types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## PFX Creation taken from https://github.com/Azure/azure-xplat-cli/wiki/Getting-Self-Signed-SSL-Certificates-(.pem-and-.pfx) | |
## PEM to CER (DER encoded) taken from http://stackoverflow.com/a/405545 | |
## PFX from PEM FIles taken from https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/ | |
# Install `openssl` package | |
# Generating a private key: | |
openssl genrsa 2048 > private_key.pem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import argv | |
import zipfile | |
from zipfile import BadZipFile | |
message = "zip file okay" | |
try: | |
the_zip_file = zipfile.ZipFile(argv[1]) | |
except BadZipFile: | |
message = "Bad file detected" | |
finally: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/python | |
# Taken from Python examples: https://docs.python.org/2.6/library/itertools.html#examples | |
from operator import itemgetter | |
from itertools import groupby | |
data_list = [[1,3], [1, 2, 3], [3]] | |
for data in data_list: | |
for k, g in groupby(enumerate(data), lambda ix :ix[0]-ix[1]): | |
print map(itemgetter(1), g) |