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 | |
| use GuzzleHttp\Client; // guzzlehttp/guzzle | |
| use rdx\jsdom\Node; // rdx/js-dom | |
| require 'vendor/autoload.php'; | |
| $guzzle = new Client(); | |
| if (file_exists($file = 'cache/padelgids.html')) { |
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
| checkfile="${1:-composer.lock}" | |
| #echo "$checkfile" | |
| basebranch="${2:-prod}" | |
| #echo "$basebranch" | |
| branches=`git branch --format='%(refname:short)'` | |
| for branch in $branches; do | |
| #echo "$branch" | |
| cmd="git dif --stat $basebranch...$branch -- $checkfile" |
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 | |
| function incrotate(int $startLength, string $in) : string { | |
| $len = $startLength; | |
| $out = ''; | |
| while (strlen($out) < strlen($in)) { | |
| $part = substr($in, strlen($out), $len); | |
| $out .= strrev($part); | |
| $len++; | |
| } |
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 | |
| $output = trim(file_get_contents('php://stdin')); | |
| $lines = explode("\n", $output); | |
| $counts = []; | |
| $lastFile = null; | |
| foreach ($lines as $line) { | |
| if (preg_match('#^ Line \s+ (.+)#', $line, $match)) { | |
| $lastFile = trim($match[1]); |
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 | |
| $_debug = false; | |
| $_uptime = 12; | |
| if (!date_default_timezone_set($timezone = trim(file_get_contents('/etc/timezone')))) { | |
| echo "Couldn't set timezone '$timezone'\n"; | |
| exit(1); | |
| } |
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
| copy(Array(32).fill(0).map(() => '#' + ('00000' + Math.floor(Math.random()*Math.pow(256, 3)).toString(16)).slice(-6)).join("\n")) |
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 | |
| $json1 = <<<JSON | |
| ... | |
| JSON; | |
| var_dump(strlen($json1)); | |
| $data1 = json_decode($json1, true); | |
| // print_r($data1); | |
| $data2 = [ |
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 | |
| totalVotes(18.7); | |
| totalVotes(14.3); | |
| totalVotes(45.5); | |
| function totalVotes(float $target, float $margin = 0.08) : void { | |
| echo "$target %...\n"; | |
| $fVotes = 100 / $target; | |
| echo "~ $fVotes votes...\n"; |
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
| DATE="`date +"%d_%H%M"`" | |
| echo "DATE=$DATE" | |
| DB_FILEPATH="/home/forge/backups/dip_db_$DATE.sql" | |
| echo "DB_FILEPATH=$DB_FILEPATH" | |
| STORAGE_FILEPATH="/home/forge/backups/dip_storage_$DATE.tgz" | |
| echo "STORAGE_FILEPATH=$STORAGE_FILEPATH" | |
| echo | |
| echo "database:" | |
| mysqldump --defaults-file=/home/forge/.mysql.prod.cnf --skip-comments prod > "$DB_FILEPATH" || exit 1 |
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 | |
| // $ps = `ps -axf -o pid,command | grep -C3 '\/chrome\/'`; | |
| // $ps = `ps -axf -o pid,command | grep 'chrome' | grep -C1 -v '\\_'`; | |
| $ps1 = ''; | |
| if ($pid1 = findPsPid($ps1)) { | |
| sleep(20); | |
| $ps2 = ''; | |
| if ($pid2 = findPsPid($ps2)) { |
NewerOlder