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);
}
Discover gists
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
More recent resolution: | |
1. cd ~/../../etc (go to etc folder in WSL). | |
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line). | |
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line). | |
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian). | |
5. cd ~/../../etc (go to etc folder in WSL). | |
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file). | |
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and | |
secondary. |
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
#! /bin/sh | |
set -eu | |
jq -V >/dev/null | |
if [ $# -lt 1 ] | |
then | |
printf 'Usage: %s rad:… [name-of-worktree]\n' "$0" | |
printf 'The worktree will be created in a new directory within the current working directory.' | |
exit 1 |
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
' Disables Vanguard from starting when you boot your computer | |
Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= disabled & sc config vgk start= disabled""", "", "runas") |
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
#!/bin/sh | |
#https://github.com/PythonicNinja/jetbrains-reset-trial-mac-osx/blob/master/runme.sh | |
for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine Rider; do | |
echo "Closing $product" | |
ps aux | grep -i MacOs/$product | cut -d " " -f 5 | xargs kill -9 | |
echo "Resetting trial period for $product" |
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
REM Delete eval folder with licence key and options.xml which contains a reference to it | |
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do ( | |
for /d %%a in ("%USERPROFILE%\.%%I*") do ( | |
rd /s /q "%%a/config/eval" | |
del /q "%%a\config\options\other.xml" | |
) | |
) | |
REM Delete registry key and jetbrains folder (not sure if needet but however) | |
rmdir /s /q "%APPDATA%\JetBrains" |
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
#EXTM3U | |
#EXTINF:-1,ARD | |
https://mcdn.daserste.de/daserste/de/master.m3u8 | |
#EXTINF:-1,ARD ONE | |
https://mcdn.one.ard.de/ardone/hls/master.m3u8 | |
#EXTINF:-1,ARD Alpha | |
https://mcdn.br.de/br/fs/ard_alpha/hls/de/master.m3u8 | |
#EXTINF:-1,ARD Tagesschau | |
https://tagesschau.akamaized.net/hls/live/2020115/tagesschau/tagesschau_1/master.m3u8 | |
#EXTINF:-1,ZDF |
See how a minor change to your commit message style can make a difference.
Tip
Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs
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
from scapy.all import sniff, PPPoED | |
import threading | |
import subprocess | |
def packet_listener(): | |
print("Starting packet listener on interface eth0...") | |
def handle_packet(packet): | |
print("Packet detected. Checking for PADI packets...") | |
# Check if it's a PADI packet (code 0x09 for PPPoE Discovery Initiation) | |
if PPPoED in packet and packet[PPPoED].code == 0x09: |
NewerOlder