This file contains hidden or 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 | |
| namespace Helpers; | |
| class Logger | |
| { | |
| private $logFile; | |
| public function __construct($logFile = 'app.log') | |
| { |
This file contains hidden or 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/bash | |
| VERSION=$(/usr/bin/curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d') | |
| DESTINATION='/usr/local/bin/docker-compose' | |
| sudo /usr/bin/curl -L https://github.com/docker/compose/releases/download/$VERSION/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION | |
| sudo /usr/bin/chmod +x $DESTINATION | |
| echo $(docker-compose --version) |
This file contains hidden or 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/bash | |
| function echo_mem_stat () { | |
| mem_total="$(free | grep 'Mem:' | awk '{print $2}')" | |
| free_mem="$(free | grep 'Mem:' | awk '{print $7}')" | |
| mem_percentage=$(($free_mem * 100 / $mem_total)) | |
| swap_total="$(free | grep 'Swap:' | awk '{print $2}')" | |
| used_swap="$(free | grep 'Swap:' | awk '{print $3}')" | |
| swap_percentage=$(($used_swap * 100 / $swap_total)) |
This file contains hidden or 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 | |
| $string = "Av Doutor Mário Guimarães - Nova Iguaçu"; | |
| echo "\n"; | |
| echo "String Original: {$string}" . PHP_EOL; | |
| echo "\n"; | |
| function corrigirCodificacao($string) { | |
| // Detecta a codificação da string | |
| $encoding = mb_detect_encoding($string, mb_list_encodings(), true); |
This file contains hidden or 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 | |
| // https://sergheipogor.medium.com/efficient-data-processing-with-php-generators-unlocking-memory-management-secrets-0bea9377e2b8 | |
| function foo() | |
| { | |
| for ($i = 0; $i < 10; $i++) { | |
| yield $i; | |
| } | |
| } |
This file contains hidden or 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 | |
| $word = "Belém do Pará"; | |
| $foo = function ($string) | |
| { | |
| if (!preg_match('/[\x80-\xff]/', $string)) | |
| return $string; | |
| $chars = array( |
This file contains hidden or 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/bash | |
| # Gerando senhas fortes no terminal do linux | |
| # Usando gpg para gerar uma senha segura com 12 caracteres | |
| gpg --gen-random --armor 1 12 | |
| # Usando openssl para gerar uma senha segura com 12 caracteres | |
| openssl rand -base64 12 |
This file contains hidden or 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/bash | |
| grep -q "word" filename.txt && echo "yes" || echo "no" |
This file contains hidden or 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
| Amex: /^3[47][0-9]{13}/ | |
| Aura: '^507860' | |
| Banese Card: '^636117' | |
| Cabal: '(60420[1-9]|6042[1-9][0-9]|6043[0-9]{2}|604400)' | |
| Diners: '(36[0-8][0-9]{3}|369[0-8][0-9]{2}|3699[0-8][0-9]|36999[0-9]) | |
| Discover: /^6(?:011|5[0-9]{2})[0-9]{12}/ | |
| Elo: ^4011(78|79)|^43(1274|8935)|^45(1416|7393|763(1|2))|^504175|^627780|^63(6297|6368|6369)|(65003[5-9]|65004[0-9]|65005[01])|(65040[5-9]|6504[1-3][0-9])|(65048[5-9]|65049[0-9]|6505[0-2][0-9]|65053[0-8])|(65054[1-9]|6505[5-8][0-9]|65059[0-8])|(65070[0-9]|65071[0-8])|(65072[0-7])|(65090[1-9]|6509[1-6][0-9]|65097[0-8])|(65165[2-9]|6516[67][0-9])|(65500[0-9]|65501[0-9])|(65502[1-9]|6550[34][0-9]|65505[0-8])|^(506699|5067[0-6][0-9]|50677[0-8])|^(509[0-8][0-9]{2}|5099[0-8][0-9]|50999[0-9])|^65003[1-3]|^(65003[5-9]|65004\d|65005[0-1])|^(65040[5-9]|6504[1-3]\d)|^(65048[5-9]|65049\d|6505[0-2]\d|65053[0-8])|^(65054[1-9]|6505[5-8]\d|65059[0-8])|^(65070\d|65071[0-8])|^65072[0-7]|^(65090[1-9]|65091\d|650920)|^(65165[2-9]|6516[6-7]\d)|^(65500\d|65501\d)|^(65502[1-9]|6550[3-4]\d|65505[0-8]) | |
| Fort |
This file contains hidden or 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
| mysql -u<user> -p<password> <database-name> -B -e "select * from \'<table-name-from-database>\';" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /path-to-save/<name-from-file-to-save>.csv |
NewerOlder