Skip to content

Instantly share code, notes, and snippets.

View ryanpadilha's full-sized avatar
:octocat:

Ryan Padilha ryanpadilha

:octocat:
View GitHub Profile
@ryanpadilha
ryanpadilha / java-home.sh
Last active December 15, 2015 03:50
$JAVA_HOME on Mac OS X
$ vim .profile
export JAVA_HOME=$(/usr/libexec/java_home)
$source .profile
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
$ /usr/libexec/java_home -V
@ryanpadilha
ryanpadilha / maven-home.sh
Last active December 18, 2019 13:34
$M2_HOME on Mac OSX
$ vim .profile
export M2_HOME=/Users/ryanpadilha/Documents/ambiente/apache-maven-3.3.9
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
$ source .profile
$ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T14:41:47-02:00)
@ryanpadilha
ryanpadilha / java-home-linux.sh
Last active September 19, 2017 18:36
$JAVA_HOME on Linux
$ vim .bashrc
JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$JAVA_HOME:$PATH
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
# reload bashrc file
$ . .bashrc
@ryanpadilha
ryanpadilha / maven-home-linux.sh
Created January 15, 2016 23:11
$M2_HOME on Linux
$ vim .bashrc
M2_HOME=/home/ryanpadilha/Documentos/ambiente/apache-maven-3.3.9/bin
export PATH=$M2_HOME:$PATH
$ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T14:41:47-02:00)
Maven home: /Users/ryanpadilha/Documents/ambiente/apache-maven-3.3.9
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre
@ryanpadilha
ryanpadilha / clean-jenkins-workspace.groovy
Last active February 23, 2016 11:44
Script de limpeza de workspace Jenkins
def hi = hudson.model.Hudson.instance
hi.getItems(hudson.model.Job).each {
job ->
jobName = job.getFullDisplayName()
if (job.isBuilding()) {
println(".. job " + jobName + " is currently running, skipped")
return
@ryanpadilha
ryanpadilha / eclipse-mars.desktop
Created February 23, 2016 12:37
Desktop Entry Linux Mint - IDE Eclipse
$ sudo gedit /usr/share/applications/eclipse-mars.desktop
# file eclipse-mars.desktop
# paste the lines and adjust the path application
[Desktop Entry]
Encoding=UTF-8
Exec=/home/ryan/Documentos/ambiente/eclipse/eclipse
Icon=/home/ryan/Documentos/ambiente/eclipse/icon.xpm
Type=Application
@ryanpadilha
ryanpadilha / constraint-verification.sql
Last active March 25, 2016 22:07
Oracle constraint verification
-- SQL command
SELECT CPAI.OWNER, CPAI.CONSTRAINT_NAME, CPAI.CONSTRAINT_TYPE, CPAI.TABLE_NAME,
CPAI.STATUS, CPAI.R_CONSTRAINT_NAME, COL.COLUMN_NAME,
(
SELECT F.TABLE_NAME FROM DBA_CONSTRAINTS F
WHERE F.CONSTRAINT_NAME = CPAI.R_CONSTRAINT_NAME
) TABLE_NAME_FILHA
FROM DBA_CONSTRAINTS CPAI, DBA_CONS_COLUMNS COL
WHERE CPAI.CONSTRAINT_NAME = COL.CONSTRAINT_NAME
@ryanpadilha
ryanpadilha / serializar.cs
Last active March 25, 2016 22:09
Serializar objetos em C# .NET
// 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');
@ryanpadilha
ryanpadilha / AssinarXML.cs
Created March 26, 2016 01:28
Assinatura Digital XML x509 v3
// declarando variaveis e enumerador necessarios
enum ResultadoAssinatura
{
XMLAssinadoSucesso,
CertificadoDigitalInexistente,
TagAssinaturaNaoExiste,
TagAssinaturaNaoUnica,
ErroAssinarDocumento,
XMLMalFormado,
ProblemaAcessoCertificadoDigital
@ryanpadilha
ryanpadilha / NFe2.0.xml
Created March 26, 2016 01:29
NFe - Exemplo Assinatura Digital XML
<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>