2023-07-31
This commit is contained in:
parent
2c7eefbb75
commit
6a0b3393cc
16 changed files with 304 additions and 113 deletions
13
.gitattributes
vendored
13
.gitattributes
vendored
|
@ -1,5 +1,14 @@
|
||||||
jekyll_site/ru/** linguist-language=Java
|
jekyll_site/ru/2023/01/** linguist-language=Java
|
||||||
jekyll_site/en/** linguist-language=Java
|
jekyll_site/en/2023/01/** linguist-language=Java
|
||||||
|
|
||||||
|
jekyll_site/ru/2023/02/** linguist-language=Java
|
||||||
|
jekyll_site/en/2023/02/** linguist-language=Java
|
||||||
|
|
||||||
|
jekyll_site/ru/2023/03/** linguist-language=Java
|
||||||
|
jekyll_site/en/2023/03/** linguist-language=Java
|
||||||
|
|
||||||
jekyll_site/ru/2023/06/** linguist-language=JavaScript
|
jekyll_site/ru/2023/06/** linguist-language=JavaScript
|
||||||
jekyll_site/en/2023/06/** linguist-language=JavaScript
|
jekyll_site/en/2023/06/** linguist-language=JavaScript
|
||||||
|
|
||||||
|
jekyll_site/ru/2023/08/** linguist-language=Bash
|
||||||
|
jekyll_site/en/2023/08/** linguist-language=Bash
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,4 +2,4 @@
|
||||||
*.iml
|
*.iml
|
||||||
*.zip
|
*.zip
|
||||||
_site*
|
_site*
|
||||||
.repo_*.sh
|
.repo_*
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
## Дерево каталогов
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
.
|
|
||||||
├─ <a href='jekyll_site'>jekyll_site</a>
|
|
||||||
│ ├─ <a href='jekyll_site/_includes'>_includes</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/_includes/counters_body.html'>counters_body.html</a>
|
|
||||||
│ │ └─ <a href='jekyll_site/_includes/counters_head.html'>counters_head.html</a>
|
|
||||||
│ ├─ <a href='jekyll_site/css'>css</a>
|
|
||||||
│ │ └─ <a href='jekyll_site/css/pomodoro5.css'>pomodoro5.css</a>
|
|
||||||
│ ├─ <a href='jekyll_site/en'>en</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/en/2023'>2023</a>
|
|
||||||
│ │ │ ├─ <a href='jekyll_site/en/2023/01'>01</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/en/2023/01/04'>04</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/en/2023/01/04/drawing-simple-captcha.md'>drawing-simple-captcha.md</a>
|
|
||||||
│ │ │ ├─ <a href='jekyll_site/en/2023/02'>02</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/en/2023/02/06'>06</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/en/2023/02/06/function-graph-in-console.md'>function-graph-in-console.md</a>
|
|
||||||
│ │ │ ├─ <a href='jekyll_site/en/2023/03'>03</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/en/2023/03/08'>08</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/en/2023/03/08/drawing-heart-in-console.md'>drawing-heart-in-console.md</a>
|
|
||||||
│ │ │ └─ <a href='jekyll_site/en/2023/06'>06</a>
|
|
||||||
│ │ │ └─ <a href='jekyll_site/en/2023/06/20'>20</a>
|
|
||||||
│ │ │ └─ <a href='jekyll_site/en/2023/06/20/password-generator.md'>password-generator.md</a>
|
|
||||||
│ │ └─ <a href='jekyll_site/en/index.md'>index.md</a>
|
|
||||||
│ ├─ <a href='jekyll_site/img'>img</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/img/captcha.png'>captcha.png</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/img/circumference-equation.svg'>circumference-equation.svg</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/img/heart-graph.png'>heart-graph.png</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/img/heart-monospaced-plain-22.bmp'>heart-monospaced-plain-22.bmp</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/img/rhombus-equation.svg'>rhombus-equation.svg</a>
|
|
||||||
│ │ └─ <a href='jekyll_site/img/square-equations.svg'>square-equations.svg</a>
|
|
||||||
│ ├─ <a href='jekyll_site/js'>js</a>
|
|
||||||
│ │ └─ <a href='jekyll_site/js/password-generator.js'>password-generator.js</a>
|
|
||||||
│ ├─ <a href='jekyll_site/ru'>ru</a>
|
|
||||||
│ │ ├─ <a href='jekyll_site/ru/2023'>2023</a>
|
|
||||||
│ │ │ ├─ <a href='jekyll_site/ru/2023/01'>01</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/ru/2023/01/03'>03</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/ru/2023/01/03/drawing-simple-captcha.md'>drawing-simple-captcha.md</a>
|
|
||||||
│ │ │ ├─ <a href='jekyll_site/ru/2023/02'>02</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/ru/2023/02/05'>05</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/ru/2023/02/05/function-graph-in-console.md'>function-graph-in-console.md</a>
|
|
||||||
│ │ │ ├─ <a href='jekyll_site/ru/2023/03'>03</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/ru/2023/03/08'>08</a>
|
|
||||||
│ │ │ │ └─ <a href='jekyll_site/ru/2023/03/08/drawing-heart-in-console.md'>drawing-heart-in-console.md</a>
|
|
||||||
│ │ │ └─ <a href='jekyll_site/ru/2023/06'>06</a>
|
|
||||||
│ │ │ └─ <a href='jekyll_site/ru/2023/06/19'>19</a>
|
|
||||||
│ │ │ └─ <a href='jekyll_site/ru/2023/06/19/password-generator.md'>password-generator.md</a>
|
|
||||||
│ │ └─ <a href='jekyll_site/ru/index.md'>index.md</a>
|
|
||||||
│ ├─ <a href='jekyll_site/Gemfile_color'>Gemfile_color</a>
|
|
||||||
│ ├─ <a href='jekyll_site/Gemfile_older'>Gemfile_older</a>
|
|
||||||
│ ├─ <a href='jekyll_site/_config_color.yml'>_config_color.yml</a>
|
|
||||||
│ ├─ <a href='jekyll_site/_config_older.yml'>_config_older.yml</a>
|
|
||||||
│ └─ <a href='jekyll_site/robots.txt'>robots.txt</a>
|
|
||||||
├─ <a href='CONTRIBUTING.md'>CONTRIBUTING.md</a>
|
|
||||||
├─ <a href='DIRECTORY-TREE.md'>DIRECTORY-TREE.md</a>
|
|
||||||
├─ <a href='LICENSE.md'>LICENSE.md</a>
|
|
||||||
├─ <a href='OPEN_LICENSE.txt'>OPEN_LICENSE.txt</a>
|
|
||||||
├─ <a href='README.en.md'>README.en.md</a>
|
|
||||||
├─ <a href='README.md'>README.md</a>
|
|
||||||
├─ <a href='build.sh'>build.sh</a>
|
|
||||||
├─ <a href='package.sh'>package.sh</a>
|
|
||||||
└─ <a href='serve.sh'>serve.sh</a>
|
|
||||||
</pre>
|
|
50
DIRECTORY_TREE.md
Normal file
50
DIRECTORY_TREE.md
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
## Дерево каталогов
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
<a href='.'>.</a>
|
||||||
|
├─ <a href='jekyll_site'>jekyll_site</a>
|
||||||
|
│ ├─ <a href='jekyll_site/_includes'>_includes</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/_includes/counters_body.html'>counters_body.html</a>
|
||||||
|
│ │ └─ <a href='jekyll_site/_includes/counters_head.html'>counters_head.html</a>
|
||||||
|
│ ├─ <a href='jekyll_site/css'>css</a>/<a href='jekyll_site/css/pomodoro5.css'>pomodoro5.css</a>
|
||||||
|
│ ├─ <a href='jekyll_site/en'>en</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/en/2023'>2023</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/en/2023/01'>01</a>/<a href='jekyll_site/en/2023/01/04'>04</a>/<a href='jekyll_site/en/2023/01/04/drawing-simple-captcha.md'>drawing-simple-captcha.md</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/en/2023/02'>02</a>/<a href='jekyll_site/en/2023/02/06'>06</a>/<a href='jekyll_site/en/2023/02/06/function-graph-in-console.md'>function-graph-in-console.md</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/en/2023/03'>03</a>/<a href='jekyll_site/en/2023/03/08'>08</a>/<a href='jekyll_site/en/2023/03/08/drawing-heart-in-console.md'>drawing-heart-in-console.md</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/en/2023/06'>06</a>/<a href='jekyll_site/en/2023/06/20'>20</a>/<a href='jekyll_site/en/2023/06/20/password-generator.md'>password-generator.md</a>
|
||||||
|
│ │ │ └─ <a href='jekyll_site/en/2023/08'>08</a>/<a href='jekyll_site/en/2023/08/04'>04</a>/<a href='jekyll_site/en/2023/08/04/directory-tree.md'>directory-tree.md</a>
|
||||||
|
│ │ └─ <a href='jekyll_site/en/index.md'>index.md</a>
|
||||||
|
│ ├─ <a href='jekyll_site/img'>img</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/img/captcha.png'>captcha.png</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/img/circumference-equation.svg'>circumference-equation.svg</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/img/heart-graph.png'>heart-graph.png</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/img/heart-monospaced-plain-22.bmp'>heart-monospaced-plain-22.bmp</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/img/rhombus-equation.svg'>rhombus-equation.svg</a>
|
||||||
|
│ │ └─ <a href='jekyll_site/img/square-equations.svg'>square-equations.svg</a>
|
||||||
|
│ ├─ <a href='jekyll_site/js'>js</a>/<a href='jekyll_site/js/password-generator.js'>password-generator.js</a>
|
||||||
|
│ ├─ <a href='jekyll_site/ru'>ru</a>
|
||||||
|
│ │ ├─ <a href='jekyll_site/ru/2023'>2023</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/ru/2023/01'>01</a>/<a href='jekyll_site/ru/2023/01/03'>03</a>/<a href='jekyll_site/ru/2023/01/03/drawing-simple-captcha.md'>drawing-simple-captcha.md</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/ru/2023/02'>02</a>/<a href='jekyll_site/ru/2023/02/05'>05</a>/<a href='jekyll_site/ru/2023/02/05/function-graph-in-console.md'>function-graph-in-console.md</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/ru/2023/03'>03</a>/<a href='jekyll_site/ru/2023/03/08'>08</a>/<a href='jekyll_site/ru/2023/03/08/drawing-heart-in-console.md'>drawing-heart-in-console.md</a>
|
||||||
|
│ │ │ ├─ <a href='jekyll_site/ru/2023/06'>06</a>/<a href='jekyll_site/ru/2023/06/19'>19</a>/<a href='jekyll_site/ru/2023/06/19/password-generator.md'>password-generator.md</a>
|
||||||
|
│ │ │ └─ <a href='jekyll_site/ru/2023/08'>08</a>/<a href='jekyll_site/ru/2023/08/03'>03</a>/<a href='jekyll_site/ru/2023/08/03/directory-tree.md'>directory-tree.md</a>
|
||||||
|
│ │ └─ <a href='jekyll_site/ru/index.md'>index.md</a>
|
||||||
|
│ ├─ <a href='jekyll_site/Gemfile_color'>Gemfile_color</a>
|
||||||
|
│ ├─ <a href='jekyll_site/Gemfile_older'>Gemfile_older</a>
|
||||||
|
│ ├─ <a href='jekyll_site/_config_color.yml'>_config_color.yml</a>
|
||||||
|
│ ├─ <a href='jekyll_site/_config_older.yml'>_config_older.yml</a>
|
||||||
|
│ └─ <a href='jekyll_site/robots.txt'>robots.txt</a>
|
||||||
|
├─ <a href='.gitattributes'>.gitattributes</a>
|
||||||
|
├─ <a href='.gitignore'>.gitignore</a>
|
||||||
|
├─ <a href='CONTRIBUTING.md'>CONTRIBUTING.md</a>
|
||||||
|
├─ <a href='DIRECTORY_TREE.md'>DIRECTORY_TREE.md</a>
|
||||||
|
├─ <a href='LICENSE.md'>LICENSE.md</a>
|
||||||
|
├─ <a href='OPEN_LICENSE.txt'>OPEN_LICENSE.txt</a>
|
||||||
|
├─ <a href='README.md'>README.md</a>
|
||||||
|
├─ <a href='WIKI.md'>WIKI.md</a>
|
||||||
|
├─ <a href='build.sh'>build.sh</a>
|
||||||
|
├─ <a href='package.sh'>package.sh</a>
|
||||||
|
└─ <a href='serve.sh'>serve.sh</a>
|
||||||
|
</pre>
|
16
README.en.md
16
README.en.md
|
@ -1,16 +0,0 @@
|
||||||
## Website pages
|
|
||||||
|
|
||||||
- [Password generator](https://pomodoro5.mircloud.ru/en/2023/06/20/password-generator.html) — 20.06.2023.
|
|
||||||
- [Drawing heart in console](https://pomodoro5.mircloud.ru/en/2023/03/08/drawing-heart-in-console.html) — 08.03.2023.
|
|
||||||
- [Function graph in console](https://pomodoro5.mircloud.ru/en/2023/02/06/function-graph-in-console.html) — 06.02.2023.
|
|
||||||
- [Drawing simple captcha](https://pomodoro5.mircloud.ru/en/2023/01/04/drawing-simple-captcha.html) — 04.01.2023.
|
|
||||||
|
|
||||||
## [Source texts](README.md)
|
|
||||||
|
|
||||||
- Series of the static websites [«Pomodori»](https://hub.mos.ru/golovin.gg/pomodoro/blob/master/README.en.md).
|
|
||||||
- Used formats — Markdown, Liquid, YAML.
|
|
||||||
- Build tool — Jekyll with tomato design themes.
|
|
||||||
- Automation of processes — Bash scripts for command line.
|
|
||||||
- [build.sh](build.sh) — Building a site in two tomato themes and optimizing the results.
|
|
||||||
- [serve.sh](serve.sh) — Local deployment to verify the correctness of the build.
|
|
||||||
- [package.sh](package.sh) — Preparing an archive for subsequent deployment.
|
|
15
README.md
15
README.md
|
@ -1,16 +1,5 @@
|
||||||
## Страницы вёб-сайта
|
## Исходные тексты
|
||||||
|
|
||||||
- [Генератор паролей](https://pomodoro5.mircloud.ru/ru/2023/06/19/password-generator.html) — 19.06.2023.
|
|
||||||
- [Рисуем сердечко в консоли](https://pomodoro5.mircloud.ru/ru/2023/03/08/drawing-heart-in-console.html) — 08.03.2023.
|
|
||||||
- [График функции в консоли](https://pomodoro5.mircloud.ru/ru/2023/02/05/function-graph-in-console.html) — 05.02.2023.
|
|
||||||
- [Рисуем простую капчу](https://pomodoro5.mircloud.ru/ru/2023/01/03/drawing-simple-captcha.html) — 03.01.2023.
|
|
||||||
|
|
||||||
## [Исходные тексты](README.en.md)
|
|
||||||
|
|
||||||
- Серия статических вёб-сайтов [«Помидоры»](https://hub.mos.ru/golovin.gg/pomodoro/blob/master/README.md).
|
|
||||||
- Используемые форматы — Markdown, Liquid, YAML.
|
- Используемые форматы — Markdown, Liquid, YAML.
|
||||||
- Инструмент сборки — Jekyll с помидорными темами оформления.
|
- Инструмент сборки — Jekyll с помидорными темами оформления.
|
||||||
- Автоматизация процессов — Bash скрипты для командной строки.
|
- Управление процессами — Bash скрипты.
|
||||||
- [build.sh](build.sh) — Сборка сайта в двух помидорных темах и оптимизация результатов.
|
|
||||||
- [serve.sh](serve.sh) — Локальное развёртывание для проверки корректности сборки.
|
|
||||||
- [package.sh](package.sh) — Подготовка архива для последующего развёртывания.
|
|
||||||
|
|
31
WIKI.md
Normal file
31
WIKI.md
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary><h3>Оглавление</h3></summary>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
- [Дерево каталогов со ссылками](https://pomodoro5.mircloud.ru/ru/2023/08/03/directory-tree.html) — 03.08.2023.
|
||||||
|
- [Генератор паролей](https://pomodoro5.mircloud.ru/ru/2023/06/19/password-generator.html) — 19.06.2023.
|
||||||
|
- [Рисуем сердечко в консоли](https://pomodoro5.mircloud.ru/ru/2023/03/08/drawing-heart-in-console.html) — 08.03.2023.
|
||||||
|
- [График функции в консоли](https://pomodoro5.mircloud.ru/ru/2023/02/05/function-graph-in-console.html) — 05.02.2023.
|
||||||
|
- [Рисуем простую капчу](https://pomodoro5.mircloud.ru/ru/2023/01/03/drawing-simple-captcha.html) — 03.01.2023.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary><h3>Contents</h3></summary>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
- [Directory tree with links](https://pomodoro5.mircloud.ru/en/2023/08/04/directory-tree.html) — 04.08.2023.
|
||||||
|
- [Password generator](https://pomodoro5.mircloud.ru/en/2023/06/20/password-generator.html) — 20.06.2023.
|
||||||
|
- [Drawing heart in console](https://pomodoro5.mircloud.ru/en/2023/03/08/drawing-heart-in-console.html) — 08.03.2023.
|
||||||
|
- [Function graph in console](https://pomodoro5.mircloud.ru/en/2023/02/06/function-graph-in-console.html) — 06.02.2023.
|
||||||
|
- [Drawing simple captcha](https://pomodoro5.mircloud.ru/en/2023/01/04/drawing-simple-captcha.html) — 04.01.2023.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<hr>
|
1
build.sh
1
build.sh
|
@ -46,6 +46,7 @@ find . -type f -name '*.html' | sort -r | while read -r file; do
|
||||||
sed -i 's/ class="language-plaintext highlighter-rouge"//g' "$file"
|
sed -i 's/ class="language-plaintext highlighter-rouge"//g' "$file"
|
||||||
sed -i 's/ class="language-java highlighter-rouge"//g' "$file"
|
sed -i 's/ class="language-java highlighter-rouge"//g' "$file"
|
||||||
sed -i 's/ class="language-js highlighter-rouge"//g' "$file"
|
sed -i 's/ class="language-js highlighter-rouge"//g' "$file"
|
||||||
|
sed -i 's/ class="language-bash highlighter-rouge"//g' "$file"
|
||||||
sed -i 's/<div><div class="highlight"><pre class="highlight">/<div class="highlight"><pre class="highlight">/g' "$file"
|
sed -i 's/<div><div class="highlight"><pre class="highlight">/<div class="highlight"><pre class="highlight">/g' "$file"
|
||||||
sed -i 's/<\/code><\/pre><\/div><\/div>/<\/code><\/pre><\/div>/g' "$file"
|
sed -i 's/<\/code><\/pre><\/div><\/div>/<\/code><\/pre><\/div>/g' "$file"
|
||||||
sed -i 's/<hr \/>/<hr>/g' "$file"
|
sed -i 's/<hr \/>/<hr>/g' "$file"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!-- Google tag (gtag.js) -->
|
<!-- Google tag (gtag.js) -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-209134013-5"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-071GTXN2K2"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
gtag('config', 'UA-209134013-5');
|
gtag('config', 'G-071GTXN2K2');
|
||||||
</script>
|
</script>
|
||||||
<!-- Yandex.Metrika counter -->
|
<!-- Yandex.Metrika counter -->
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -15,7 +15,7 @@ lang: en
|
||||||
We write a program in JavaScript for the formation of random 20-symbol combinations of latin letters,
|
We write a program in JavaScript for the formation of random 20-symbol combinations of latin letters,
|
||||||
numbers and special characters. There are 60 variants to choose from — 4 columns of 15 rows. First
|
numbers and special characters. There are 60 variants to choose from — 4 columns of 15 rows. First
|
||||||
character — is always a letter, all characters in each combination go without repetitions. We will
|
character — is always a letter, all characters in each combination go without repetitions. We will
|
||||||
generate passwords for web-sites in the browser.
|
form passwords for web-sites in the browser.
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input type="button" value="Refresh" title="Refresh combinations" onclick="refresh()">
|
<input type="button" value="Refresh" title="Refresh combinations" onclick="refresh()">
|
||||||
|
@ -53,7 +53,8 @@ characters `&`, `>` and `<` for correct display in browser. We gather 15 lines,
|
||||||
each line.
|
each line.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// gathering combinations for the web-site
|
'use strict';
|
||||||
|
// formation of combinations
|
||||||
const generate = function() {
|
const generate = function() {
|
||||||
let text = "";
|
let text = "";
|
||||||
for (let row = 0; row < 15; row++) {
|
for (let row = 0; row < 15; row++) {
|
||||||
|
@ -75,9 +76,9 @@ const generate = function() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```js
|
```js
|
||||||
// get a random number in a given range
|
// getting a random number in a given range
|
||||||
const random = (min, max) => Math.round(min + (max-min) * Math.random());
|
const random = (min, max) => Math.round(min + (max-min) * Math.random());
|
||||||
// escape HTML special characters for correct display in the browser
|
// escaping HTML special characters for correct display in the browser
|
||||||
const escapeHTML = (str) => str.replace("&", "&").replace(">", ">").replace("<", "<");
|
const escapeHTML = (str) => str.replace("&", "&").replace(">", ">").replace("<", "<");
|
||||||
// button on the page — refresh combinations
|
// button on the page — refresh combinations
|
||||||
const refresh = () => document.getElementById("combinations").innerHTML = generate();
|
const refresh = () => document.getElementById("combinations").innerHTML = generate();
|
||||||
|
|
77
jekyll_site/en/2023/08/04/directory-tree.md
Normal file
77
jekyll_site/en/2023/08/04/directory-tree.md
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
---
|
||||||
|
title: Directory tree with links
|
||||||
|
description: We write a Bash script for building a directory tree for a repository in the Markdown file. We use only the accessories of Bash and the ls program. We will...
|
||||||
|
sections: [Recursion,File processing,Web-navigation]
|
||||||
|
tags: [linux,bash,markdown,folders,files,references,sorting]
|
||||||
|
canonical_url: /en/2023/08/04/directory-tree.html
|
||||||
|
url_translated: /ru/2023/08/03/directory-tree.html
|
||||||
|
title_translated: Дерево каталогов со ссылками
|
||||||
|
date: 2023.08.04
|
||||||
|
lang: en
|
||||||
|
---
|
||||||
|
|
||||||
|
We write a Bash script for building a directory tree for a [repository]({{ site.homepage_url }}) in
|
||||||
|
the Markdown file. We use only the accessories of Bash and the `ls` program. We will use the resulting
|
||||||
|
file in the web interface to navigate over the objects of the repository.
|
||||||
|
|
||||||
|
We create a recursive function and use it to bypass files and directories of the repository.
|
||||||
|
For each directory, we execute the program `ls` and get a sorted list of files and directories
|
||||||
|
included in it: first there are directories, then files, first uppercase letters, then lowercase,
|
||||||
|
exclude the untracked files that are not in the repository — we get the directory tree in
|
||||||
|
a sorted form.
|
||||||
|
|
||||||
|
We collapse folders with one nested element into one line for conciseness.
|
||||||
|
We place the generated tree in the `<pre>` container and add the title.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
# sorted list of files and directories
|
||||||
|
function list_directory_contents {
|
||||||
|
# first uppercase letters, then lowercase, first directories, then files
|
||||||
|
eval "LC_COLLATE=C ls -A --group-directories-first $exclusions $1"
|
||||||
|
}
|
||||||
|
# directory tree with links
|
||||||
|
function directory_tree {
|
||||||
|
# arguments
|
||||||
|
local path="$1"
|
||||||
|
local head="$2"
|
||||||
|
local tail="$3"
|
||||||
|
# prefix of the current element
|
||||||
|
if [ "one" == "$4" ]; then
|
||||||
|
echo -n "/"
|
||||||
|
else
|
||||||
|
echo -ne "\n$head"
|
||||||
|
fi
|
||||||
|
# current element of the tree
|
||||||
|
echo -n "<a href='${path#*/}'>${path##*/}</a>"
|
||||||
|
# recursive calls for subdirectories
|
||||||
|
if [ -d "$path" ]; then
|
||||||
|
local list # array of files and directories
|
||||||
|
readarray -t list <<<"$(list_directory_contents "$path")"
|
||||||
|
local len=${#list[@]} # size of array
|
||||||
|
local i # counter
|
||||||
|
for ((i = 0; i < len; i++)); do
|
||||||
|
if [ -z "${list[$i]}" ]; then
|
||||||
|
continue # skip empty directory
|
||||||
|
elif ((len == 1)); then
|
||||||
|
directory_tree "$path/${list[$i]}" "$tail" "$tail" "one"
|
||||||
|
elif ((i < len - 1)); then
|
||||||
|
directory_tree "$path/${list[$i]}" "$tail├─ " "$tail│ "
|
||||||
|
else
|
||||||
|
directory_tree "$path/${list[$i]}" "$tail└─ " "$tail "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# line of exclusions for 'ls' from '.gitignore' file — the untracked files
|
||||||
|
exclusions="-I \".git\" $(sed 's/^/ -I "/;s/$/"/' .gitignore | tr -d '\n')"
|
||||||
|
# put the tree in a container, add a title and output to a file
|
||||||
|
{
|
||||||
|
echo "## Directory tree"
|
||||||
|
echo -ne "\n<pre>"
|
||||||
|
directory_tree .
|
||||||
|
echo -e "\n</pre>"
|
||||||
|
} >DIRECTORY_TREE.md
|
||||||
|
```
|
||||||
|
|
||||||
|
We save the file `DIRECTORY_TREE.md` in the root of the repository and send the changes to the server.
|
|
@ -2,7 +2,7 @@
|
||||||
title: Code with comments
|
title: Code with comments
|
||||||
description: Notes about programming with code snippets and comments. Problem solutions and solution descriptions.
|
description: Notes about programming with code snippets and comments. Problem solutions and solution descriptions.
|
||||||
sections: [Problem solutions and solution descriptions]
|
sections: [Problem solutions and solution descriptions]
|
||||||
tags: [java,javascript,algorithms,implementation,text,fonts,combinations,images,pictures,cryptography]
|
tags: [java,javascript,linux,bash,algorithms,implementation,text,fonts,combinations,images,pictures,cryptography]
|
||||||
canonical_url: /en/
|
canonical_url: /en/
|
||||||
url_translated: /ru/
|
url_translated: /ru/
|
||||||
title_translated: Код с комментариями
|
title_translated: Код с комментариями
|
||||||
|
@ -10,12 +10,29 @@ lang: en
|
||||||
---
|
---
|
||||||
|
|
||||||
{%- assign articles = "" | split: "" %}
|
{%- assign articles = "" | split: "" %}
|
||||||
|
{%- assign articles = articles | push: "Directory tree with links" %}
|
||||||
|
{%- capture article_brief %}
|
||||||
|
We write a Bash script for building a directory tree for a repository in the Markdown file. We use
|
||||||
|
only the accessories of Bash and the `ls` program. We will use the resulting file in the web interface
|
||||||
|
to navigate over the objects of the repository.
|
||||||
|
|
||||||
|
We create a recursive function and use it to bypass files and directories of the repository.
|
||||||
|
For each directory, we execute the program `ls` and get a sorted list of files and directories
|
||||||
|
included in it: first there are directories, then files, first uppercase letters, then lowercase,
|
||||||
|
exclude the untracked files that are not in the repository — we get the directory tree in
|
||||||
|
a sorted form.
|
||||||
|
{%- endcapture %}
|
||||||
|
{%- assign articles = articles | push: article_brief %}
|
||||||
{%- assign articles = articles | push: "Password generator" %}
|
{%- assign articles = articles | push: "Password generator" %}
|
||||||
{%- capture article_brief %}
|
{%- capture article_brief %}
|
||||||
We write a program in JavaScript for the formation of random 20-symbol combinations of latin letters,
|
We write a program in JavaScript for the formation of random 20-symbol combinations of latin letters,
|
||||||
numbers and special characters. There are 60 variants to choose from — 4 columns of 15 rows. First
|
numbers and special characters. There are 60 variants to choose from — 4 columns of 15 rows. First
|
||||||
character — is always a letter, all characters in each combination go without repetitions. We will
|
character — is always a letter, all characters in each combination go without repetitions. We will
|
||||||
generate passwords for web-sites in the browser.
|
form passwords for web-sites in the browser.
|
||||||
|
|
||||||
|
I have been using this algorithm for a long time — I have all passwords for web-sites generated by
|
||||||
|
this scheme, so I recommend it. The first version was written in Java, but for web-sites it turns
|
||||||
|
out easier in JavaScript, so as not to go far.
|
||||||
{%- endcapture %}
|
{%- endcapture %}
|
||||||
{%- assign articles = articles | push: article_brief %}
|
{%- assign articles = articles | push: article_brief %}
|
||||||
{%- assign articles = articles | push: "Drawing heart in console" %}
|
{%- assign articles = articles | push: "Drawing heart in console" %}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
// собираем комбинации для вёб-сайта
|
// © Головин Г.Г., Генератор паролей, 2023
|
||||||
|
'use strict';
|
||||||
|
// формирование комбинаций
|
||||||
const generate = function() {
|
const generate = function() {
|
||||||
let text = "";
|
let text = "";
|
||||||
for (let row = 0; row < 15; row++) {
|
for (let row = 0; row < 15; row++) {
|
||||||
|
@ -19,9 +21,9 @@ const generate = function() {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// получаем случайное число в заданном диапазоне
|
// получение случайного числа в заданном диапазоне
|
||||||
const random = (min, max) => Math.round(min + (max-min) * Math.random());
|
const random = (min, max) => Math.round(min + (max-min) * Math.random());
|
||||||
// экранируем спецсимволы HTML для корректного отображения в браузере
|
// экранирование спецсимволов HTML для корректного отображения в браузере
|
||||||
const escapeHTML = (str) => str.replace("&", "&").replace(">", ">").replace("<", "<");
|
const escapeHTML = (str) => str.replace("&", "&").replace(">", ">").replace("<", "<");
|
||||||
// кнопка обновить на странице — обновляем комбинации
|
// кнопка обновить на странице — обновляем комбинации
|
||||||
const refresh = () => document.getElementById("combinations").innerHTML = generate();
|
const refresh = () => document.getElementById("combinations").innerHTML = generate();
|
||||||
|
|
|
@ -13,7 +13,7 @@ date: 2023.06.19
|
||||||
|
|
||||||
Пишем программу на JavaScript для формирования случайных 20-значных комбинаций из латинских букв, цифр и
|
Пишем программу на JavaScript для формирования случайных 20-значных комбинаций из латинских букв, цифр и
|
||||||
спецсимволов. На выбор 60 вариантов — 4 столбца по 15 строк. Первый символ — всегда буква, все символы в
|
спецсимволов. На выбор 60 вариантов — 4 столбца по 15 строк. Первый символ — всегда буква, все символы в
|
||||||
каждой комбинации идут без повторов. Будем генерировать пароли для вёб-сайтов в браузере.
|
каждой комбинации идут без повторов. Будем формировать пароли для вёб-сайтов в браузере.
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input type="button" value="Обновить" title="Обновить комбинации" onclick="refresh()">
|
<input type="button" value="Обновить" title="Обновить комбинации" onclick="refresh()">
|
||||||
|
@ -50,7 +50,8 @@ l m n o p q r s t u v w x y z { | } ~
|
||||||
корректного отображения в браузере. Собираем 15 строк, в каждой строке по 4 комбинации.
|
корректного отображения в браузере. Собираем 15 строк, в каждой строке по 4 комбинации.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// собираем комбинации для вёб-сайта
|
'use strict';
|
||||||
|
// формирование комбинаций
|
||||||
const generate = function() {
|
const generate = function() {
|
||||||
let text = "";
|
let text = "";
|
||||||
for (let row = 0; row < 15; row++) {
|
for (let row = 0; row < 15; row++) {
|
||||||
|
@ -72,9 +73,9 @@ const generate = function() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```js
|
```js
|
||||||
// получаем случайное число в заданном диапазоне
|
// получение случайного числа в заданном диапазоне
|
||||||
const random = (min, max) => Math.round(min + (max-min) * Math.random());
|
const random = (min, max) => Math.round(min + (max-min) * Math.random());
|
||||||
// экранируем спецсимволы HTML для корректного отображения в браузере
|
// экранирование спецсимволов HTML для корректного отображения в браузере
|
||||||
const escapeHTML = (str) => str.replace("&", "&").replace(">", ">").replace("<", "<");
|
const escapeHTML = (str) => str.replace("&", "&").replace(">", ">").replace("<", "<");
|
||||||
// кнопка обновить на странице — обновляем комбинации
|
// кнопка обновить на странице — обновляем комбинации
|
||||||
const refresh = () => document.getElementById("combinations").innerHTML = generate();
|
const refresh = () => document.getElementById("combinations").innerHTML = generate();
|
||||||
|
|
76
jekyll_site/ru/2023/08/03/directory-tree.md
Normal file
76
jekyll_site/ru/2023/08/03/directory-tree.md
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
---
|
||||||
|
title: Дерево каталогов со ссылками
|
||||||
|
description: Напишем скрипт Bash для построения дерева каталогов для репозитория в файле Markdown. Будем использовать только средства Bash и программу ls. Полученный...
|
||||||
|
sections: [Рекурсия,Обработка файлов,Вёб-навигация]
|
||||||
|
tags: [linux,bash,markdown,каталоги,файлы,ссылки,сортировка]
|
||||||
|
canonical_url: /ru/2023/08/03/directory-tree.html
|
||||||
|
url_translated: /en/2023/08/04/directory-tree.html
|
||||||
|
title_translated: Directory tree with links
|
||||||
|
date: 2023.08.03
|
||||||
|
---
|
||||||
|
|
||||||
|
Напишем скрипт Bash для построения дерева каталогов для [репозитория]({{ site.homepage_url }}) в файле
|
||||||
|
Markdown. Будем использовать только средства Bash и программу `ls`. Полученный файл будем использовать
|
||||||
|
в вёб-интерфейсе для навигации по объектам репозитория.
|
||||||
|
|
||||||
|
Создаём рекурсивную функцию и с её помощью обходим файлы и каталоги репозитория. Для каждого
|
||||||
|
каталога выполняем программу `ls` и получаем отсортированный список входящих в него файлов
|
||||||
|
и каталогов: сначала идут каталоги, потом файлы, сначала заглавные буквы, потом строчные,
|
||||||
|
исключаем неотслеживаемые файлы, которых нет в репозитории — получаем дерево каталогов
|
||||||
|
в отсортированном виде.
|
||||||
|
|
||||||
|
Папки с одним вложенным элементом сворачиваем в одну строку для лаконичности.
|
||||||
|
Сформированное дерево помещаем в контейнер `<pre>` и добавляем заголовок.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
# отсортированный список файлов и каталогов
|
||||||
|
function list_directory_contents {
|
||||||
|
# сначала заглавные буквы, потом строчные, сначала каталоги, потом файлы
|
||||||
|
eval "LC_COLLATE=C ls -A --group-directories-first $exclusions $1"
|
||||||
|
}
|
||||||
|
# дерево каталогов со ссылками
|
||||||
|
function directory_tree {
|
||||||
|
# аргументы
|
||||||
|
local path="$1"
|
||||||
|
local head="$2"
|
||||||
|
local tail="$3"
|
||||||
|
# префикс текущего элемента
|
||||||
|
if [ "one" == "$4" ]; then
|
||||||
|
echo -n "/"
|
||||||
|
else
|
||||||
|
echo -ne "\n$head"
|
||||||
|
fi
|
||||||
|
# текущий элемент дерева
|
||||||
|
echo -n "<a href='${path#*/}'>${path##*/}</a>"
|
||||||
|
# рекурсивные вызовы для подкаталогов
|
||||||
|
if [ -d "$path" ]; then
|
||||||
|
local list # массив файлов и каталогов
|
||||||
|
readarray -t list <<<"$(list_directory_contents "$path")"
|
||||||
|
local len=${#list[@]} # размер массива
|
||||||
|
local i # счётчик
|
||||||
|
for ((i = 0; i < len; i++)); do
|
||||||
|
if [ -z "${list[$i]}" ]; then
|
||||||
|
continue # пропустить пустой каталог
|
||||||
|
elif ((len == 1)); then
|
||||||
|
directory_tree "$path/${list[$i]}" "$tail" "$tail" "one"
|
||||||
|
elif ((i < len - 1)); then
|
||||||
|
directory_tree "$path/${list[$i]}" "$tail├─ " "$tail│ "
|
||||||
|
else
|
||||||
|
directory_tree "$path/${list[$i]}" "$tail└─ " "$tail "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# строка исключений для 'ls' из файла '.gitignore' — неотслеживаемые файлы
|
||||||
|
exclusions="-I \".git\" $(sed 's/^/ -I "/;s/$/"/' .gitignore | tr -d '\n')"
|
||||||
|
# помещаем дерево в контейнер, добавляем заголовок и выводим в файл
|
||||||
|
{
|
||||||
|
echo "## Дерево каталогов"
|
||||||
|
echo -ne "\n<pre>"
|
||||||
|
directory_tree .
|
||||||
|
echo -e "\n</pre>"
|
||||||
|
} >DIRECTORY_TREE.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Сохраняем файл `DIRECTORY_TREE.md` в корне репозитория и отправляем изменения на сервер.
|
|
@ -2,18 +2,35 @@
|
||||||
title: Код с комментариями
|
title: Код с комментариями
|
||||||
description: Заметки на тему программирования с примерами кода и комментариями. Решения задач и описания решений.
|
description: Заметки на тему программирования с примерами кода и комментариями. Решения задач и описания решений.
|
||||||
sections: [Решения задач и описания решений]
|
sections: [Решения задач и описания решений]
|
||||||
tags: [java,javascript,алгоритмы,реализация,текст,шрифты,комбинации,изображения,картинки,криптография]
|
tags: [java,javascript,linux,bash,алгоритмы,реализация,текст,шрифты,комбинации,изображения,картинки,криптография]
|
||||||
canonical_url: /
|
canonical_url: /
|
||||||
url_translated: /en/
|
url_translated: /en/
|
||||||
title_translated: Code with comments
|
title_translated: Code with comments
|
||||||
---
|
---
|
||||||
|
|
||||||
{%- assign articles = "" | split: "" %}
|
{%- assign articles = "" | split: "" %}
|
||||||
|
{%- assign articles = articles | push: "Дерево каталогов со ссылками" %}
|
||||||
|
{%- capture article_brief %}
|
||||||
|
Напишем скрипт Bash для построения дерева каталогов для репозитория в файле Markdown. Будем использовать
|
||||||
|
только средства Bash и программу `ls`. Полученный файл будем использовать в вёб-интерфейсе для навигации
|
||||||
|
по объектам репозитория.
|
||||||
|
|
||||||
|
Создаём рекурсивную функцию и с её помощью обходим файлы и каталоги репозитория. Для каждого
|
||||||
|
каталога выполняем программу `ls` и получаем отсортированный список входящих в него файлов
|
||||||
|
и каталогов: сначала идут каталоги, потом файлы, сначала заглавные буквы, потом строчные,
|
||||||
|
исключаем неотслеживаемые файлы, которых нет в репозитории — получаем дерево каталогов
|
||||||
|
в отсортированном виде.
|
||||||
|
{%- endcapture %}
|
||||||
|
{%- assign articles = articles | push: article_brief %}
|
||||||
{%- assign articles = articles | push: "Генератор паролей" %}
|
{%- assign articles = articles | push: "Генератор паролей" %}
|
||||||
{%- capture article_brief %}
|
{%- capture article_brief %}
|
||||||
Пишем программу на JavaScript для формирования случайных 20-значных комбинаций из латинских букв, цифр и
|
Пишем программу на JavaScript для формирования случайных 20-значных комбинаций из латинских букв, цифр и
|
||||||
спецсимволов. На выбор 60 вариантов — 4 столбца по 15 строк. Первый символ — всегда буква, все символы в
|
спецсимволов. На выбор 60 вариантов — 4 столбца по 15 строк. Первый символ — всегда буква, все символы в
|
||||||
каждой комбинации идут без повторов. Будем генерировать пароли для вёб-сайтов в браузере.
|
каждой комбинации идут без повторов. Будем формировать пароли для вёб-сайтов в браузере.
|
||||||
|
|
||||||
|
Давно пользуюсь этим алгоритмом — у меня все пароли для вёб-сайтов по этой схеме сгенерированы,
|
||||||
|
поэтому рекомендую. Первая версия была написана на Java, но для вёб-сайтов проще получается на
|
||||||
|
JavaScript, чтобы далеко не ходить.
|
||||||
{%- endcapture %}
|
{%- endcapture %}
|
||||||
{%- assign articles = articles | push: article_brief %}
|
{%- assign articles = articles | push: article_brief %}
|
||||||
{%- assign articles = articles | push: "Рисуем сердечко в консоли" %}
|
{%- assign articles = articles | push: "Рисуем сердечко в консоли" %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue