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 | |
# Apache Tomcat 9.x instructions for installation on CentOS Linux 7 | |
# Apache needs JDK 8 installed on environment (we prefer Oracle JVM HotSpot!) | |
# find out instructions how to install :D | |
# A | create tomcat user :: should be run as an unprivileged user | |
# 1. create a new tomcat group | |
sudo groupadd tomcat |
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
-- PostgreSQL 9.6 | |
-- view connections | |
select * from pg_stat_activity where datname = 'db_name'; | |
-- drop connections | |
select pg_terminate_backend(pid) from pg_stat_activity where datname = 'db_name'; |
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 | |
# Linux user management script | |
# to list all user on linux environment (listed in /etc/passwd) | |
getent passwd | |
# to list all groups on linux environment (listed in /etc/group) | |
getent group | |
# to add a new user, with sudo this add sudoers privilegies |
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 | |
sudo rm -rf /var/lib/dpkg/info/*.* | |
sudo apt-get autoremove | |
sudo apt-get autoclean | |
sudo apt-get update | |
sudo apt-get check | |
sudo apt-get -f install | |
sudo apt-get upgrade |
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 | |
# Remove files are listed in gitignore | |
git rm --cached `git ls-files -i --exclude-from=.gitignore` | |
# git bash on windows | |
# git ls-files -i -z --exclude-from=.gitignore | xargs -0 git rm --cached | |
# in case of any problem with the statements above, its run in any OS | |
git rm -r --cached . | |
git add . |
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
-- enable extensions | |
-- full-text search on postgresql | |
CREATE EXTENSION unaccent; | |
-- languages supported | |
CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french ); | |
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING | |
FOR hword, hword_part, word WITH unaccent, french_stem; | |
CREATE TEXT SEARCH CONFIGURATION en ( COPY = english ); |
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 | |
# PostgreSQL database dump | |
# troubleshooting for | |
# pg_dump: server version: 9.6.2; pg_dump version: 9.5.6 | |
# pg_dump: aborting because of server version mismatch | |
# | |
# commands to verify version mismatch on linux environment | |
# psql --version | |
# pg_dump --version |
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
<NFe xmlns="http://www.portalfiscal.inf.br/nfe" > | |
<infNFe Id="NFe31060243816719000108550000000010001234567897" versao="2.00"> | |
... | |
</infNFe> | |
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> | |
<SignedInfo> | |
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/> | |
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> | |
<Reference URI="#NFe31060243816719000108550000000010001234567897"> | |
<Transforms> |
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
// declarando variaveis e enumerador necessarios | |
enum ResultadoAssinatura | |
{ | |
XMLAssinadoSucesso, | |
CertificadoDigitalInexistente, | |
TagAssinaturaNaoExiste, | |
TagAssinaturaNaoUnica, | |
ErroAssinarDocumento, | |
XMLMalFormado, | |
ProblemaAcessoCertificadoDigital |
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
// método para serializar objeto em xml | |
public static string Serializar(object objeto) | |
{ | |
try | |
{ | |
StringBuilder writer = new StringBuilder(); | |
XmlSerializer serializer = new XmlSerializer(objeto.GetType()); | |
XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); | |
ns.Add(String.Empty, 'http://www.portalfiscal.inf.br/nfe'); |