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 | |
function sanitize($filename) | |
{ | |
$text = 'txt|md|rtf|xml|html|css|js|json|csv|sql|log|sh|cer|rss'; | |
$image = 'jpg|jpeg|png|gif|svg|ico|webp|bmp|avif|apng|ai|psd'; | |
$audio = 'mp3|wav|ogg|aac'; | |
$video = 'mp4|mkv|avi|webm|mov|wmv|flv'; | |
$archive = 'zip|gz|7z|rar|apk|jar'; | |
$other = 'pdf|docx|xlsx|pptx|iso|db|ttf|otf|tmp'; |
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
cd | |
VERSION=$(php -r 'echo phpversion();') | |
wget https://www.php.net/distributions/php-$VERSION.tar.gz | |
tar xf php-$VERSION.tar.gz | |
cd php-$VERSION/ext/exif | |
phpize | |
./configure | |
make | |
echo n | make test | |
make install |
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
cd | |
VERSION=$(php -r 'echo phpversion();') | |
wget https://www.php.net/distributions/php-$VERSION.tar.gz | |
tar xf php-$VERSION.tar.gz | |
cd php-$VERSION/ext/pdo_mysql | |
phpize | |
./configure | |
make | |
make test | |
make install |
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
const days = 365 | |
const urls = ['', ...[...Array(days).keys()].map(i=>i+1).map(i=>new Date(Date.now() - 1000*60*60*24*i).toLocaleDateString('sv').replaceAll('-', '')).map(d => '/' + d)].map(path => 'https://b.hatena.ne.jp/hotentry/it' + path) | |
const htmls = await Promise.all(urls.map(url => fetch(url).then(r=>r.text()))) | |
const docs = htmls.map(html => new DOMParser().parseFromString(html,'text/html')) | |
function countAndSort(arr) { | |
return Object.entries(arr.reduce((prev, curr) => (prev[curr] = ++prev[curr] || 1, prev), {})).sort((a,b) => b[1]-a[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
let getRandomBytes = ( | |
(typeof self !== 'undefined' && (self.crypto || self.msCrypto)) | |
? function() { // Browsers | |
var crypto = (self.crypto || self.msCrypto), QUOTA = 65536; | |
return function(n) { | |
var a = new Uint8Array(n); | |
for (var i = 0; i < n; i += QUOTA) { | |
crypto.getRandomValues(a.subarray(i, i + Math.min(n - i, QUOTA))); | |
} | |
return a; |
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
# https://github.com/dbrgn/coverage-badge/blob/ea399fc586eb00ec7f77e355a2e4b2b7cebd24c1/tests/test_output.py#L49 | |
p=$(printf %.0f $(grep -Pom1 '(?<=aria-valuenow=").*?(?=")' reports/index.html)) | |
color=$([[ $p -gt 96 ]] && echo 4c1 || ([[ $p -gt 92 ]] && echo 97CA00 || ([[ $p -gt 79 ]] && echo a4a61d || ([[ $p -gt 64 ]] && echo dfb317 || ([[ $p -gt 44 ]] && echo fe7d37 || ([[ $p -gt 14 ]] && echo e05d44 || echo 9f9f9f)))))) | |
wget -O reports/badge.svg https://shields.io/badge/coverage-$p%25-$color?logo=github |
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
sudo apt install -y php8.2 php8.2-xml php8.2-curl php8.2-xdebug iputils-ping | |
echo xdebug.mode=profile | sudo tee -a /etc/php/8.2/cli/conf.d/20-xdebug.ini | |
echo xdebug.output_dir=$HOME | sudo tee -a /etc/php/8.2/cli/conf.d/20-xdebug.ini |
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
sudo dnf install -y net-tools libnsl nano wget \ | |
&& curl -LO https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.2.0/xampp-linux-x64-8.2.0-0-installer.run \ | |
&& chmod +x xampp-linux-x64-8.2.0-0-installer.run \ | |
&& sudo ./xampp-linux-x64-8.2.0-0-installer.run --mode unattended \ | |
&& echo 'PATH="/opt/lampp/bin:$PATH"' >> ~/.bashrc \ | |
&& source ~/.bashrc \ | |
&& sudo /opt/lampp/lampp start | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" |
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
for i in `seq 200`; do google-chrome-stable --headless --single-process --disable-gpu --disable-dev-shm-usage --disable-audio-output --dump-dom https://itm.deno.dev?sleep=60000 & done |
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 | |
require __DIR__ . '/../vendor/autoload.php'; | |
use function Amp\async; | |
use function Amp\delay; | |
$array = []; | |
// deferは新しいFiberを作り、実行中のFiberが終了したら自動的に次を実行する |
NewerOlder