Skip to content

Instantly share code, notes, and snippets.

View netoht's full-sized avatar
🚀

Waldinar Oliveira Neto netoht

🚀
View GitHub Profile
@netoht
netoht / calculaDv.js
Created September 13, 2011 20:20
calculaDv
function calculaDVGtin(digits) {
if (isNaN(digits)) return null;
var code = (digits).toString(),
even = odd = 0;
for (var i = code.length - 1; i >= 0; --i) {
if ((code.length - i) % 2 == 0) {
odd += Number(code.charAt(i));
} else {
@netoht
netoht / gist:1539691
Created December 30, 2011 12:45
TripleDES com chaves curtas
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/**
* http://tripoverit.blogspot.com/2009/06/tripledes-encryption-compatibility.html
* http://nicholasbarger.com/2008/10/21/triple-des-encryption-class/
* @author Waldinar Oliveira Neto
*
*/
public class TripleDES {
@netoht
netoht / folders.sh
Last active January 4, 2016 09:29 — forked from zenorocha/.hyper.js
#!/bin/sh
# Moving some big folders from home user in the hard disk SSD for hard disk SATA
HDD_SATA='/Volumes/300'
folders=('Desktop' 'Documents' 'Dropbox' 'Downloads' 'Movies' 'Music' 'Pictures' 'Public' 'Screenshots')
mkdir Dropbox
for folder in ${folders[@]}
do
function speechTest() {
var speech = new webkitSpeechRecognition;
speech.continuous = true;
speech.interimResults = true;
speech.lang = 'pt-BR';
speech.onresult = function(e) {
console.log(e.results[e.results.length-1][0].transcript);
};
speech.start();
}
@netoht
netoht / SkipSSL.java
Last active August 29, 2015 14:22
SkipSSL - ignoreSSLCertificate
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class SkipSSL {
public final static TrustManager[] TRUST_ALL_CERTS = new TrustManager[] { new X509TrustManager() {
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;
@netoht
netoht / render.sh
Last active August 29, 2016 01:18
Shell as a template engine
#!/bin/sh
render=true
debug=${debug:-false}
BASENAME=`basename "$0"`
usage() {
if [ ! "$1" = "usage" ] ; then
return
fi
@netoht
netoht / realpath.sh
Created April 29, 2017 02:07
realpath
#!/bin/bash
DIR=$(dirname `readlink -f ${BASH_SOURCE[0]}`)
@netoht
netoht / README.md
Created May 5, 2017 22:45
Bouncy Castle Settings

Bouncy Castle Settings

  1. Copy the Bouncy Castle jar:
cp bcprov-jdk15on-156.jar $JAVA_HOME/jre/lib/ext/
  1. Bouncy Castle Provider Settings in java.security
sudo cat /var/log/syslog | lolcat -F 0.1