This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Permissão 644 em lote para arquivos | |
find DIRETORIO -type f -exec chmod 644 {} \; | |
# Permissão 755 em lote para pastas | |
find DIRETORIO -type d -exec chmod 755 {} \; | |
# Recupera pasta encriptada | |
sudo ecryptfs-recover-private | |
# Adicionar usuário ao grupo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Date: 17/03/2014 | |
* Author : RobertoPC | |
* Author URI : http://www.robertopc.com.br | |
* Gist URI : https://gist.github.com/robertopc/43bcf4d28a32bc95956f | |
* Description: Functions to debug code in PHP | |
* Functions : print_r_pre, var_dump_pre, print_r_console, var_dump_console | |
* Version : 1.0 | |
* License : MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Converte caracteres especiais em caracteres simples(ASCII). | |
Exemplos: ç > c, á > a, Á > A, etc... | |
*/ | |
function utf8_translit($string) { | |
$characters = array( | |
" " /* 00a0 'NO-BREAK SPACE' */ => " ", | |
"¡" /* 00a1 'INVERTED EXCLAMATION MARK' */ => "!", | |
"¢" /* 00a2 'CENT SIGN' */ => "c", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->load->library('email'); | |
$this->email->initialize(array( | |
'protocol' => 'smtp', | |
'smtp_host' => 'ssl://smtp.googlemail.com', | |
'smtp_port' => '465', | |
'smtp_timeout' => '60', | |
'smtp_user' => '{{{email gmail}}}', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Bcrypt hashing class | |
* | |
* @author Thiago Belem <[email protected]> | |
* @link https://gist.github.com/3438461 | |
*/ | |
class Bcrypt { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Encriptando a senha | |
$senha = 'ola mundo'; | |
$hash = Bcrypt::hash($senha); | |
// $hash = $2a$08$MTgxNjQxOTEzMTUwMzY2OOc15r9yENLiaQqel/8A82XLdj.OwIHQm | |
// Salve $hash no banco de dados | |
// Verificando a senha | |
$senha = 'ola mundo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Inclui o arquivo class.phpmailer.php localizado na pasta phpmailer | |
require_once("phpmailer/class.phpmailer.php"); | |
// Inicia a classe PHPMailer | |
$mail = new PHPMailer(); | |
// Define os dados do servidor e tipo de conexão | |
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | |
$mail->IsSMTP(); // Define que a mensagem será SMTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886 && | |
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list && | |
sudo add-apt-repository -y ppa:noobslab/indicators && | |
sudo add-apt-repository -y ppa:noobslab/apps && | |
sudo add-apt-repository -y ppa:nilarimogard/webupd8 && | |
sudo add-apt-repository -y ppa:mpstark/elementary-tweaks-daily && | |
sudo add-apt-repository -y ppa:webupd8team/java && | |
sudo add-apt-repository -y ppa:transmissionbt/ppa && | |
sudo apt-add-repository -y ppa:umang/indicator-stickynotes && | |
sudo add-apt-repository -y ppa:yannubuntu/boot-repair && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function validar_cpf($cpf) | |
{ | |
$cpf = preg_replace('/\D/', '', (string) $cpf); | |
// Valida tamanho | |
if (strlen($cpf) != 11) | |
return false; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Data e hora dd/mm/yyyy hh:mm | |
var data = "01/01/2000 12:00:00".match(/^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/[0-9]{4} (0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])$/); | |
console.log(data); | |
var email = "[email protected]".match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/); | |
console.log(email); |
OlderNewer