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 | |
/************************ настройки ************************/ | |
const MIN_PROCESSES = 30; // минимальное количество одновременно исполняемых процессов | |
const MAX_PROCESSES = 30; // максимальное количество одновременно исполняемых процессов | |
const MAX_ITERATIONS = 1000; // максимально возможное количество итераций(выполнений), 0 = неограниченно | |
const MAX_SYSLOAD_PERCENT = 90; // максимальный процент нагрузки системы для запуска скрипта |
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 bash | |
# Первая строка скрипта - это шебанг, который сообщает системе, как выполнять | |
# скрипт: https://en.wikipedia.org/wiki/Shebang_(Unix) | |
# Как вы уже заметили, комментарии начинаются с #. Шебанг также является комментарием. | |
# Простой пример Hello world: | |
echo "Hello world!" # => Hello world! | |
# Каждая команда начинается с новой строки или после точки с запятой: | |
echo "Это первая команда"; echo "Это вторая команда" |
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 bash | |
PATH_TO_BACKUPS=/backup | |
PATH_FROM_BACKUPS=("/home/path_1" "/home/path_2") | |
DATABASES=("db_name_1" "db_name_2") | |
DB_USER="root" | |
DB_PASSWORD="" | |
DELETE_AFTER_DAYS=3 | |
if [ ! -d $PATH_TO_BACKUPS ]; then |
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 | |
class Random | |
{ | |
public static function gen($min, $max, $seed = '') | |
{ | |
$seed = self::seed($seed); | |
$sumbols = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
$md5str = md5($seed); | |
$bigseed = ''; |
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 | |
namespace App\Utils; | |
/** | |
* Class Locker | |
* | |
* This class is used to lock files for a given amount of time. | |
* | |
* @package App\Utils |
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
var platformLanguage = navigator && ( | |
navigator.language || | |
navigator.browserLanguage || | |
navigator.systemLanguage || | |
navigator.userLanguage || | |
null), | |
elemsRU, elemsEN; | |
if (platformLanguage.match("ru") && document.getElementsByClassName) { | |
elemsRU = document.getElementsByClassName("b-text_lang_ru"); | |
elemsEN = document.getElementsByClassName("b-text_lang_en"); |
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
# ---------------------------------------- файловая система | |
du -s -b [dirname] # Занимаемый директорией dirname размер в байтах | |
du -s -b [dirname] | awk '{print $1}' # Отобразить только цифры без названия директории | |
du -h [dirname] # Размеры директории и всех подкаталогов | |
du -h [dirname] | sort -r -n # Тоже с сортировкой | |
du -sh [dirname] # Общий размер директории в удобочитаемом виде | |
du -sh ./* # Вес каталогов текущей директории | |
df -h # Информация о смонтированных разделах с отображением общего, доступного и используемого пространства |
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
DirectoryIndex index.php | |
AddDefaultCharset UTF-8 | |
Options -Indexes | |
<ifModule mod_headers.c> | |
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$"> | |
Header set Cache-Control "max-age=2592000" | |
</FilesMatch> | |
</IfModule> |
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
DirectoryIndex index.php | |
AddDefaultCharset UTF-8 | |
Options -Indexes | |
<ifModule mod_headers.c> | |
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$"> | |
Header set Cache-Control "max-age=2592000" | |
</FilesMatch> | |
</IfModule> |