This file contains hidden or 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
| ########## Install NGINX ############## | |
| # Install software-properties-common package to give us add-apt-repository package | |
| sudo apt-get install -y software-properties-common | |
| # Install latest nginx version from community maintained ppa | |
| sudo add-apt-repository ppa:nginx/stable | |
| # Update packages after adding ppa |
This file contains hidden or 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
| rm -f /etc/localtime | |
| ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime |
This file contains hidden or 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
| CREATE DATABASE your_db_name CHARACTER SET utf8 COLLATE utf8_general_ci; | |
| -- https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql | |
| CREATE USER 'your_user_name'@'localhost' IDENTIFIED BY 'your_password_name'; | |
| GRANT ALL PRIVILEGES ON * . * TO 'your_user_name'@'localhost'; | |
| FLUSH PRIVILEGES; |
This file contains hidden or 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
| /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 | |
| /sbin/mkswap /var/swap.1 | |
| /sbin/swapon /var/swap.1 |
This file contains hidden or 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
| function tryCreateSiteArchive() { | |
| try { | |
| // | |
| } | |
| catch (exception $e) { | |
| // log | |
| } | |
| } | |
| function tryUploadArchiveToYandexDisk() { |
This file contains hidden or 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
| DECLARE @ConstraintName nvarchar(200) | |
| SELECT @ConstraintName = Name FROM SYS.DEFAULT_CONSTRAINTS WHERE PARENT_OBJECT_ID = OBJECT_ID('__TableName__') AND PARENT_COLUMN_ID = (SELECT column_id FROM sys.columns WHERE NAME = N'__ColumnName__' AND object_id = OBJECT_ID(N'__TableName__')) | |
| IF @ConstraintName IS NOT NULL | |
| EXEC('ALTER TABLE __TableName__ DROP CONSTRAINT ' + @ConstraintName) | |
| IF EXISTS (SELECT * FROM syscolumns WHERE id=object_id('__TableName__') AND name='__ColumnName__') | |
| EXEC('ALTER TABLE __TableName__ DROP COLUMN __ColumnName__') |
This file contains hidden or 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
| // конфиг: | |
| 'monitoringMinutes' => 0, | |
| 'monitoringHours' => 8, | |
| 'monitoringSeconds' => 0, | |
| // использование | |
| if (self::isNotTimeToMonitor()) { | |
| echo "\nisNotTimeToMonitor говорит: рано проверять, в конфиге указано другое время\n"; | |
| return; | |
| } |
This file contains hidden or 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
| # 1 0 * * * /etc/script.py my_param && echo $(date +\%Y-\%m-\%d_\%T) >> /etc/work_log.txt 2>&1 | |
| # 1 0 * * * /etc/script.py my_param >> /etc/work_log.txt 2>&1 |
This file contains hidden or 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
| SELECT setval('account_id_seq', (SELECT MAX(id) FROM account)+1); |
This file contains hidden or 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
| $ids = [3, 2, 1]; | |
| foreach ($ids as $id) { | |
| self::myFunc($id); | |
| sleep(1); | |
| } |