Skip to content

Instantly share code, notes, and snippets.

@edgardo001
edgardo001 / QRAndLogo.java
Created August 8, 2016 19:44 — forked from wombat/QRAndLogo.java
QR-Code with embedded logo
// Create new configuration that specifies the error correction
Map<EncodeHintType, ErrorCorrectionLevel> hints = new HashMap<EncodeHintType, ErrorCorrectionLevel>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
QRCodeWriter writer = new QRCodeWriter();
BitMatrix bitMatrix = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
// Create a qr code with the url as content and a size of 250x250 px
@edgardo001
edgardo001 / Operaciones-Git
Created September 7, 2016 03:45 — forked from jelcaf/Operaciones-Git
Git Tips - Mini-trucos de Git para facilitarme la tarea
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@edgardo001
edgardo001 / script-bash-export-mysql-postgresql
Created September 22, 2016 14:08 — forked from gabrielkfr/script-bash-export-mysql-postgresql
Script bash que permite exportar una base de datos MySQL o PostgreSQL.
#!/bin/bash
 
# -- DEFINICIÓN VARIABLES DE FECHA Y HORA.
DIA=`date +"%Y%m%d"`
HORA=`date +"%H%M"`
 
# -- CONFIGURACIÓN DE VARIABLES GLOBALES
DUMP_HOME="."
DUMP_FILE="dump_"$DIA"_"$HORA".sql"
 
@edgardo001
edgardo001 / script-bash-import-mysql-postgresql
Created September 22, 2016 14:08 — forked from gabrielkfr/script-bash-import-mysql-postgresql
Script bash que permite importar una base de datos en MySQL o PostgreSQL a partir de una archivo dump.
#!/bin/bash
 
# -- CONFIGURACIÓN DE VARIABLES GLOBALES
APP_HOME="."
APP_OUTPUT="import.log"
 
MYSQL_DBUSER_ADM="root"
MYSQL_DBUSER="admin"
MYSQL_DBPASS="admin"
MYSQL_DBNAME="mi_db"
@edgardo001
edgardo001 / Linux Static IP
Last active November 8, 2016 12:16 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
/* Estructura y Datos de las Regiones, Provincias */
/* y Comunas de Chile. */
/* */
/* Fecha: Julio 2010 */
/* Autor: Juan Pablo Aqueveque - juque.cl */
--
-- Comunas
--
DROP TABLE IF EXISTS `comunas`;
@edgardo001
edgardo001 / mapReduceNodeMongoOse.js
Last active July 24, 2017 13:54 — forked from madhums/mapreduce.js
mapreduce using mongodb and mongoose
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/db_name');
// map function
var map = function(){
emit(this.field_to_group_by, {
other_fields: this.other_fields
// list other fields like above to select them
})
}
@edgardo001
edgardo001 / ca.md
Created September 11, 2017 13:45 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@edgardo001
edgardo001 / JavaPGP.java
Created September 26, 2017 17:57 — forked from rbrick/JavaPGP.java
Simple Java implementation of PGP (Pretty Good Privacy)
import javax.crypto.Cipher;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
@edgardo001
edgardo001 / AESCipher.py
Created October 3, 2017 12:29 — forked from swinton/AESCipher.py
Encrypt & Decrypt using PyCrypto AES 256 From http://stackoverflow.com/a/12525165/119849
#!/usr/bin/env python
import base64
from Crypto import Random
from Crypto.Cipher import AES
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]