Skip to content

Instantly share code, notes, and snippets.

View maikyguanaes's full-sized avatar
🕉️
Ω

Maiky Guanaes maikyguanaes

🕉️
Ω
View GitHub Profile
@maikyguanaes
maikyguanaes / formatar_cnpj_cpf.md
Created January 24, 2024 21:06 — forked from davidalves1/formatar_cnpj_cpf.md
Função para formatar CNPJ e CPF, disponível em PHP e JS

PHP

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);
  } 
@maikyguanaes
maikyguanaes / javascript.js
Created January 11, 2024 13:42 — forked from chaintng/javascript.js
Encryption Decryption Javascript and Ruby
// 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")

Generating Authy passwords on other authenticators


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

@maikyguanaes
maikyguanaes / meta-tags-favicon.html
Created October 2, 2017 02:29 — forked from dscamahorn/meta-tags-favicon.html
Favicon, touch/web clip, tile and pin configuration. Includes Chrome for Android address bar background color (theme-color).
<!--Favicon-->
<link rel="shortcut icon" type="image/ico" href="favicon.ico" />
<!--Tile-->
<meta name="application-name" content="System Name"/>
<meta name="msapplication-TileColor" content="#000"/>
<meta name="msapplication-square70x70logo" content="tile-tiny.png"/>
<meta name="msapplication-square150x150logo" content="tile-square.png"/>
<meta name="msapplication-wide310x150logo" content="tile-wide.png"/>
<meta name="msapplication-square310x310logo" content="tile-large.png"/>
<!--Pin-->
@maikyguanaes
maikyguanaes / Custom Browsers Color.html
Created October 2, 2017 02:29 — forked from ka-seo/Custom Browsers Color.html
Set color toolbar in mobile browsers
<!-- 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 -->