Skip to content

Instantly share code, notes, and snippets.

View HashRaygoza's full-sized avatar

David Raygoza Gómez HashRaygoza

View GitHub Profile
@HashRaygoza
HashRaygoza / rss.xml
Created December 29, 2019 19:27
Ejemplo de un feed RSS
<?xml version="1.0" encoding="UTF-8"?>
<!-- Declaracion de RSS -->
<rss version="2.0">
<!-- Declaracion del canal -->
<channel>
<!-- Titulo del Canal -->
<title>rss-example</title>
<!-- Descripcion del Canal -->
<description>Ejemplo de un RSS hecho a mano</description>
<!-- Enlace al sitio del Feed RSS -->
@HashRaygoza
HashRaygoza / RandomString.java
Created November 10, 2019 19:50
Generador de cadena alfanumerica aleatoria
import java.security.SecureRandom;
import java.util.Locale;
import java.util.Objects;
import java.util.Random;
public class RandomString {
/**
* Generate a random string.
*/
@HashRaygoza
HashRaygoza / Properties.java
Created October 20, 2019 19:54
Ejemplo de como crear, leer y editar archivos properties en Java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.hash.properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@HashRaygoza
HashRaygoza / CertificadoJAR.java
Last active September 28, 2019 04:09
Clase Java para leer el archivo dataCert.txt
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package certificadojar;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@HashRaygoza
HashRaygoza / build.xml
Created September 26, 2019 20:07
Build.xml con los target necesarios para almacenar la información del certificado.
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="ProyectoCRE" default="default" basedir=".">
@HashRaygoza
HashRaygoza / EncriptadoAES.java
Created September 14, 2019 04:27
Ejemplo de encriptado AES
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package encriptadoaes;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
@HashRaygoza
HashRaygoza / EncriptadorAES.java
Created September 14, 2019 04:26
Funciones para aplicar encriptado AES
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package encriptadoaes;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
@HashRaygoza
HashRaygoza / pom.xml
Created August 21, 2019 16:55
Pom.xml con jarsigner
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mx.com.pydee</groupId>
<artifactId>MavenFirma</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
@HashRaygoza
HashRaygoza / build_signer.xml
Created August 20, 2019 20:15
Target para build.xml que agrega la firma digital al archivo .jar
<target name="-post-jar" depends="signjar">
</target>
<target name="signjar" depends="">
<echo message="Signing ${dist.dir}/NOMBRE_ARCHIVO_JAR ..."/>
<exec dir="${work.dir}" executable="jarsigner">
<arg value="-verbose" />
<arg value="-keystore" />
<arg value="ARCHIVO_JKS" />
<arg value="-storepass" />
@HashRaygoza
HashRaygoza / App.java
Created August 10, 2019 22:23
Clase main del programa para consultar la hora via NTP
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.hash.ejemplontp;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;