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
<?php | |
declare(strict_types=1); | |
/** | |
* returns a plain string array of path to all files in a directory, and subdirectories, | |
* but does not return directories themselves. (meaning if a directory is empty, it will not be included at all) | |
* | |
* @param string $dir | |
* @param bool $realpath |
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
<?php | |
declare(strict_types=1); | |
return (static function (\Rector\Config\RectorConfig $rectorConfig): void { | |
$rectorConfig->paths([ | |
'/home/hans/projects/php-ml/', | |
]); | |
$rectorConfig->sets([ | |
\Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_82, |
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
<?php | |
declare(strict_types=1); | |
function fix_encoding(string $str): string | |
{ | |
//return $str; | |
return mb_convert_encoding($str, 'UTF-8', 'ISO-8859-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
#define _GNU_SOURCE | |
#include <iostream> | |
#include <pthread.h> | |
#include <chrono> | |
#include <vector> | |
#include <unistd.h> | |
#include <sched.h> | |
#include <stdexcept> | |
#include <climits> |
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
#!/usr/bin/php | |
<?php | |
declare(strict_types = 1); | |
// require_once ('hhb_.inc.php'); | |
hhb_init (); | |
if ($argc !== 3) { | |
fprintf ( STDERR, "usage: %s timestamp url\n", $argv [0] ); | |
fprintf ( STDERR, "example: %s 20091012061648 http://www.p4w.se\n", $argv [0] ); | |
die ( 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
#!/usr/bin/env php | |
<?php | |
declare(strict_types = 1); | |
// this does NOT work on my ubuntu 20.04, look at the other files for a 20.04 version | |
if (posix_geteuid () !== 0) { | |
die ( "error: this script requires root privileges, re-run it as root." ); | |
} | |
$amdgpu_dir = '/sys/bus/pci/drivers/amdgpu'; | |
$dirs = array_filter ( array_map ( 'trim', glob ( $amdgpu_dir.DIRECTORY_SEPARATOR.'*', GLOB_NOSORT | GLOB_ONLYDIR | GLOB_MARK ) ), function (string $str) { | |
return (is_writable ( $str."power_dpm_force_performance_level" ) && is_writable ( $str.'pp_compute_power_profile' )); |
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
# see https://github.com/php/php-src/issues/12450 | |
FROM ubuntu:20.04 | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update -y | |
RUN apt-get -y full-upgrade; | |
RUN apt-get -y install apt-utils | |
RUN apt-get -y install golang build-essential git autoconf bison re2c make cmake automake libtool libpsl-dev libpsl5 | |
RUN bash -c 'set -e;\ | |
git clone -b curl-8_6_0 --single-branch --depth 1 https://github.com/curl/curl.git; \ | |
cd curl; \ |
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
<?php | |
declare(strict_types=1); | |
/** | |
* better version of shell_exec(), | |
* supporting both stdin and stdout and stderr and os-level return code | |
* | |
* @param string $cmd | |
* command to execute |
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
#include <iostream> | |
#include <fstream> | |
#include <thread> | |
#include <vector> | |
#include <string> | |
#include <cstdlib> | |
char **global_argv; | |
void testMemory() { | |
std::cout << "Starting Memory Test" << std::endl; | |
std::vector<char*> allocations; |
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
<?php | |
declare(strict_types=1); | |
function clearLine() | |
{ | |
echo "\033[2K\r"; | |
} | |
$dirs = array( | |
"." | |
); |
NewerOlder