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); | |
$dir = realpath(__DIR__ . '/..'); | |
$files = shell_exec("find " . escapeshellarg($dir) . " -print0"); | |
$files = explode("\x00", rtrim($files, "\x00")); | |
$files = array_filter($files, function ($filepath) { | |
if (!preg_match("/page/", $filepath)) { | |
return false; |
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); | |
$dir = realpath(__DIR__ . '/..'); | |
$files = shell_exec("find " . escapeshellarg($dir) . " -print0"); | |
$files = explode("\x00", rtrim($files, "\x00")); | |
$files = array_filter($files, function ($filepath) { | |
if(!preg_match("/page/", $filepath)) { | |
return false; |
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
#fix unicode | |
[[ -z $(grep LANG ~/.bash_profile) ]] && echo '[[ -z "${LANG}" ]] && export LANG='\''en_US.UTF-8'\''' >> ~/.bash_profile | |
#make sure .bashrc is loaded on ssh login | |
[[ -z $(grep bashrc ~/.bash_profile) ]] && echo 'source ~/.bashrc' >> ~/.bash_profile | |
# create .local/bin | |
mkdir -p ~/.local/bin; | |
# install screenie | |
wget 'https://gist.github.com/divinity76/1a583968c997869b27a5ee2c1ed24259/raw/76453e61a92676386589fbb3f4ef0225ac98fb19/screenie.b64' -O- | base64 -d > ~/.local/bin/screenie ; chmod 0555 ~/.local/bin/screenie; | |
# install ncdu | |
wget 'https://github.com/divinity76/static_bin/blob/static_ncdu/ncdu?raw=true' -O ~/.local/bin/ncdu; chmod 0555 ~/.local/bin/ncdu; |
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
// why max? firefox has issues if you try to click 100+ images at the same time (chrome doesn't, but firefox does, why? idk) | |
function expandAllImages(max=1){ | |
let all=document.querySelectorAll("div.file:not(.image-expanded) img:not(.autoexpanded)"); | |
max=Math.min(max,all.length); | |
for(let i=0;i<max;++i){ | |
all[i].className+=" autoexpanded"; | |
//all[i].parentNode.dispatchEvent(new MouseEvent("click", {ctrlKey: true})); | |
all[i].click(); | |
} | |
return max; |
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 same_random_bytes(int $length):string{ | |
static $buf = ""; | |
while(strlen($buf)<$length){ | |
$buf .= chr((strlen($buf)*88)%256); | |
} | |
if(strlen($buf) < $length){ | |
$buf.= random_bytes($length-strlen($buf)); | |
} |
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
# This xorg configuration file will start a dummy X11 server. | |
# move it to /etc/X11/xorg.conf | |
# don't forget apt install xserver-xorg-video-dummy; | |
# based on https://xpra.org/Xdummy.html | |
Section "ServerFlags" | |
Option "DontVTSwitch" "true" | |
Option "AllowMouseOpenFail" "true" | |
Option "PciForceNone" "true" | |
Option "AutoEnableDevices" "false" |
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 | |
// find . -iname "*.php" -print0 | xargs -0 --max-args=1 --max-procs=$(nproc) '-I{}' sh -c 'php --syntax-check {} || true' | grep --invert-match "^No syntax errors detected in" | |
function json_encode_pretty($data, int $extra_flags = 0, int $exclude_flags = 0): string | |
{ | |
// prettiest flags for: 7.3.9 | |
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | (defined("JSON_UNESCAPED_LINE_TERMINATORS") ? JSON_UNESCAPED_LINE_TERMINATORS : 0) | JSON_PRESERVE_ZERO_FRACTION | (defined("JSON_THROW_ON_ERROR") ? JSON_THROW_ON_ERROR : 0); | |
$flags = ($flags | $extra_flags) & ~ $exclude_flags; | |
return (json_encode($data, $flags)); | |
} |
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); | |
global $argc, $argv; | |
if ($argc < 3) { | |
echo ("Usage: {$argv[0]} 'FOLDER' rsync FOLDER foo@bar:server_folder arg1 arg2 arg3 etc\n"); | |
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
<?php | |
declare(strict_types = 1); | |
ini_set("memory_limit", "-1"); | |
$algo = "xxh64"; | |
$dictionary = "crackstation.txt"; | |
// MODE_dict_in_ram_hashes_in_ram($algo, $file); | |
MODE_dict_on_disk_hash_on_sqlite($algo, $dictionary); |
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); | |
use function var_dump as d; | |
function dd(...$args) | |
{ | |
$trace = debug_backtrace(0, 1)[0]; // odd, i really expected (0, 2)[1] ... but it works | |
$line = $trace['line']; | |
$file = $trace['file']; |