Skip to content

Instantly share code, notes, and snippets.

@excat
Last active December 26, 2023 19:37
Show Gist options
  • Save excat/ba1458a2db312690cf3b34c59f0dce74 to your computer and use it in GitHub Desktop.
Save excat/ba1458a2db312690cf3b34c59f0dce74 to your computer and use it in GitHub Desktop.
генератор паролей google таблиц
=ArrayFormula(let(
symbols;LAMBDA(from;to;ArrayFormula(JOIN(;СИМВОЛ(SEQUENCE(abs(КОДСИМВ(to)-КОДСИМВ(from))+1;1;МИН(КОДСИМВ(from);КОДСИМВ(to)))))));
alphabetEn;symbols("a";"z")&symbols("A";"Z");
alphabetRu;symbols("а";"я")&symbols("А";"Я")&"ёЁ";
specString;"!""№;%:?*()_+@#$%^&*\|/.,-='{}[]<>`~";
numbers;"0123456789";
generate;lambda(fromText;count;join("";ПСТР(fromText;ОКРУГЛВВЕРХ(randarray(count)*ДЛСТР(fromText));1)));
letterEn;lambda(count;ЕСЛИ(count<=0;"";generate(alphabetEn;count)));
letterRu;lambda(count;ЕСЛИ(count<=0;"";generate(alphabetRu;count)));
spec; lambda(count;ЕСЛИ(count<=0;"";generate(specString;count)));
numeric; lambda(count;ЕСЛИ(count<=0;"";generate(numbers ;count)));
shuffle;lambda(txt;join("";array_constrain(SORT({ПСТР(txt;SEQUENCE(ДЛСТР(txt));1)\RANDARRAY(ДЛСТР(txt))};2;1);ДЛСТР(txt);1)));
passw;lambda(enCount;ruCount;specCount;numsCount;
shuffle( letterEn(enCount) & letterRu(ruCount) & spec(specCount) & numeric(numsCount) )
);
passw(5;0;1;2)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment