function formatCnpjCpf($value)
{
$CPF_LENGTH = 11;
$cnpj_cpf = preg_replace("/\D/", '', $value);
if (strlen($cnpj_cpf) === $CPF_LENGTH) {
return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
}
<?php | |
use Monolog\Handler\NullHandler; | |
use Monolog\Handler\StreamHandler; | |
use Monolog\Handler\SyslogUdpHandler; | |
return [ | |
/* | |
|-------------------------------------------------------------------------- |
<?php | |
use Monolog\Handler\NullHandler; | |
use Monolog\Handler\StreamHandler; | |
use Monolog\Handler\SyslogUdpHandler; | |
return [ | |
/* | |
|-------------------------------------------------------------------------- |
// IDEA FROM: https://stackoverflow.com/questions/33929712/crypto-in-nodejs-and-ruby | |
var crypto = require('crypto'), | |
algorithm = 'aes-256-cbc', | |
key = 'SOME_RANDOM_KEY_32_CHR_123456789', // 32 Characters | |
iv = "0000000000000000"; // 16 Characters | |
function encrypt(text){ | |
var cipher = crypto.createCipheriv(algorithm,key,iv) | |
var crypted = cipher.update(text,'utf-8',"base64") |
There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.
Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.
His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the
<!-- Insert in head --> | |
<!-- Custom Browsers Color Start --> | |
<!-- Chrome, Firefox OS and Opera --> | |
<meta name="theme-color" content="#000"> | |
<!-- Windows Phone --> | |
<meta name="msapplication-navbutton-color" content="#000"> | |
<!-- iOS Safari --> | |
<meta name="apple-mobile-web-app-status-bar-style" content="#000"> | |
<!-- Custom Browsers Color End --> |