function genWords($alphabet, $length) {
$alph = mb_str_split($alphabet);
$maxChar = count($alph);
$idxs = array_fill(0, $length, 0);
while (true) {
yield implode('', array_map(fn($idx) => $alph[$idx], $idxs));
$pos = $length - 1;
while (true) {
$idxs[$pos] += 1;
if ($idxs[$pos] < $maxChar) {
break;
}
$idxs[$pos] = 0;
$pos -= 1;
if ($pos < 0) {
return;
}
}
}
}
foreach (genWords('АБВГДЕЁЖЗ', 5) as $word) {
print "{$word}\n";
}
function isSeq3(int $number) : bool
{
$prevDigit = 0;
$seqLen = 0;
while ($number > 0) {
$digit = $number % 10;
if ($digit === $prevDigit - 1) {
$seqLen += 1;
} else {
$seqLen = 1;
}
if ($seqLen === 3) {
return true;
}
$number = intdiv($number, 10);
$prevDigit = $digit;
}
return false;
}
const date = new Date(1647367200 * 1000);
console.log(date); // Date Tue Mar 15 2022 21:00:00 GMT+0300 (Москва, стандартное время)
const date1 = new Date(1647378000 * 1000)
console.log(date1); // Date Wed Mar 16 2022 00:00:00 GMT+0300 (Москва, стандартное время)
$ man ssh-copy-id
...
-i identity_file
Use only the key(s) contained in identity_file (rather than looking for identities via ssh-add(1)
or in the default_ID_file). If the filename does not end in .pub this is added. If the filename
is omitted, the default_ID_file is used.
...