Skip to content

Instantly share code, notes, and snippets.

View PecceG2's full-sized avatar
🚀

Giuliano Peccetto PecceG2

🚀
View GitHub Profile
@PecceG2
PecceG2 / Validar Dni
Last active October 28, 2024 13:56 — forked from jvinceso/Validar Dni
Validar Numero de Dni Solo Numeros y longitud 7-8 mediante expresiones regulares en Javascript (Fork: Soporta símbolos y acepta de 7 a 8 caracteres para personas mayores)
function validaDNI(dni){
onlyNumbersDNI = dni.toString().replace(/\D/g, '');
let ex_regular_dni = /^\d{7,8}(?:[-\s]\d{4})?$/;
if(ex_regular_dni.test(onlyNumbersDNI) == true && !(/[a-zA-Z]/g.test(dni)) && onlyNumbersDNI === dni.replace(/(\d)[\s.]+(?=\d)/g, '$1')){
alert('Dni corresponde');
return true;
}else{
alert('Dni erroneo, formato no válido');
return false;
}
@PecceG2
PecceG2 / degree.yaml
Created December 19, 2021 00:56
ESPHome LCD Screen lcd_pcf8574 draw / print degree symbol
display:
- platform: lcd_pcf8574
dimensions: 16x2
address: 0x27
lambda: |-
it.printf(0, 0, "%c", 0xDF);
----- This print degree symbol on LCD (0xDF) at col 0, row 0. ------
@PecceG2
PecceG2 / git.conf
Last active November 13, 2024 20:30
Git config for my workspace
// Git bash as admin
git config --global user.name "my super name"
git config --global user.email [email protected]
git config --global alias.superlog "log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
git config --global alias.alias "! git config --get-regexp ^alias\. | sed -e s/^alias\.// -e s/\ /\ =\ /"
git config --global core.autocrlf false
git config --system core.autocrlf false
@PecceG2
PecceG2 / gist:2bf00f71334cf19c2acb2467d6124cae
Created August 11, 2021 22:13
Remotely manage a out-of-domain Hyper-V Server
Hyper-V Server side (Powershell):
Enable-PSRemoting
Enable-WSManCredSSP -Role server
Client side:
Go to start menu -> Turn windows features on or off -> Enable "Hyper-V GUI Management Tools"
Go to start menu -> Open Powershell as Administrator:
Enable-PSRemoting
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "HyperVServerDNS"
@PecceG2
PecceG2 / commands
Last active January 2, 2021 23:40
Restart Docker to factory defaults on Linux
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker volume rm $(docker volume ls -q)
## IF NEED DELETE DOCKER COMPLETLY ##
rm /var/lib/docker/