Skip to content

Instantly share code, notes, and snippets.

View viniciusdaniel's full-sized avatar

Vinicius Daniel Antunes Oliveira viniciusdaniel

View GitHub Profile
@viniciusdaniel
viniciusdaniel / cpf_validator.php
Last active May 6, 2021 23:23 — forked from guisehn/gist:3276015
Validar CPF (PHP)
<?php
function validar_cpf($cpf)
{
// Limpa caracteres e mantem apenas dígitos
$cpf = preg_replace('/[^0-9]/', '', (string) $cpf);
// Valida tamanho
if (strlen($cpf) != 11)
return false;
@viniciusdaniel
viniciusdaniel / psql-with-gzip-cheatsheet.sh
Created May 28, 2021 03:16 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@viniciusdaniel
viniciusdaniel / SWAP-101.md
Created September 26, 2023 14:33 — forked from vpnwall-services/SWAP-101.md
[SWAP 101] Swap 101 #linux #swap #101

SWAP 101

  • Allocate swap sudo fallocate -l 1G /swapfile

  • Alternate allocation sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576

  • Perms