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
#! /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: |
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
/* | |
* Copyright (c) 2023 Russell Harmon | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
NewerOlder