Skip to content

Instantly share code, notes, and snippets.

@leoclaro
leoclaro / bancos_brasileiros.php
Created June 18, 2019 18:38 — forked from peuweb/bancos_brasileiros.php
Lista dos bancos brasileiros em formato array
<?php
//bancos brasileiros
$bancos = array(
array('code' => '001', 'name' => 'Banco do Brasil'),
array('code' => '003', 'name' => 'Banco da Amazônia'),
array('code' => '004', 'name' => 'Banco do Nordeste'),
array('code' => '021', 'name' => 'Banestes'),
array('code' => '025', 'name' => 'Banco Alfa'),
array('code' => '027', 'name' => 'Besc'),
array('code' => '029', 'name' => 'Banerj'),
@leoclaro
leoclaro / dv_ibge.sql
Created October 17, 2018 20:17 — forked from hevertonfreitas/dv_ibge.sql
Digito verificador do código do IBGE (6 digitos)
create or replace function ibge_dv(codigo char(6))
returns char(1) as $$
select ((10 - resto) * (resto != 0)::int)::char(1)
from (
select
(
a135 +
left(a2, 1)::int + right(a2, 1)::int +
left(a4, 1)::int + right(a4, 1)::int +
@leoclaro
leoclaro / verify_cert.py
Created November 30, 2017 16:54 — forked from cato-/verify_cert.py
Python script to check the status of ssl certificates
#!/usr/bin/env python
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <[email protected]> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
# ----------------------------------------------------------------------------
#
"""
Estonian ID-card authentication middleware for Django,
but this should be pretty easily modifiable for any application
To use install cryptography.io:
apt-get install -y python python-pip python-dev \
python-cffi build-essential libffi-dev libssl-dev
pip install cryptography
@leoclaro
leoclaro / client.go
Created November 9, 2017 23:43 — forked from spikebike/client.go
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@leoclaro
leoclaro / golang-tls.md
Created November 9, 2017 23:39 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@leoclaro
leoclaro / tls-client.go
Created November 9, 2017 23:29 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
<input type="text" id="search" list="datalist1" placeholder="Search cars...">
<datalist id="search-response">
    <option value="Acura">
    <option value="Audi">
    <option value="BMW">
    <option value="Cadillac">
    <option value="Chrysler">
    <option value="Dodge">
    <option value="Ferrari">
@leoclaro
leoclaro / backbutton.js
Created February 15, 2016 18:23 — forked from John-Henrique/backbutton.js
Back button handle
/**
controla os eventos online, offline, backbutton
é necessário instalar o plugin
CORDOVA-PLUGIN-DIALOGS
*/
$(function(){
document.addEventListener( 'deviceready', app_init, false );
@leoclaro
leoclaro / WSSoapClient.php
Created December 16, 2015 01:27 — forked from Turin86/WSSoapClient.php
WS-Security for PHP SoapClient
<?php
/**
* This class can add WSSecurity authentication support to SOAP clients
* implemented with the PHP 5 SOAP extension.
*
* It extends the PHP 5 SOAP client support to add the necessary XML tags to
* the SOAP client requests in order to authenticate on behalf of a given
* user with a given password.
*