lsof -PiTCP -sTCP:LISTENnetstat -nr| # ================================================================================================== | |
| # | |
| # NOTICE | |
| # | |
| # This gist is no longer maintained. It was moved to repo: | |
| # | |
| # https://github.com/maratori/golangci-lint-config | |
| # | |
| # Full history and all v2 releases are preserved in the repo. | |
| # |
| ===SQL==== | |
| Транзакция — это операция, состоящая из одного или нескольких запросов к базе данных. | |
| Суть транзакций — обеспечить корректное выполнение всех запросов в рамках одной транзакции, | |
| а так-же обеспечить механизм изоляции транзакций друг от друга для решения проблемы совместного доступа к данным. | |
| set autocommit=0; //отключаем autocommit | |
| Start transaction; (также, можно написать BEGIN; ) | |
| Select * from table where ... FOR UPDATE; // блокирует записаь, снимается после commit | |
| …какие-то действий с БД (insert, update,delete…) |
| # Dante-Server install script (Debian 8 - Jessie) | |
| # Start with 'chmod +x danted_install_script.sh && danted_install_script.sh' | |
| # duketwo - 12.11.2017 | |
| random_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| network_adapter=$(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//") | |
| username="SallySample" | |
| port="31337" | |
| public_ip=$(dig +short myip.opendns.com @resolver1.opendns.com) | |
| echo "Random password: $random_pw" | |
| echo "deb-src http://ftp.de.debian.org/debian/ sid main non-free contrib" >> /etc/apt/sources.list |
| 1. Получаем хэш-код коммита, к которому хотим вернуться. | |
| 2. Заходим в папку репозитория и пишем в консоль: | |
| $ git reset --hard a3775a5485af0af20375cedf46112db5f813322a | |
| $ git push --force |
| public function getresultTree(array $elements, $parentId = 0) { | |
| $branch = array(); | |
| foreach ($elements as $element) { | |
| if ($element['parent_id'] == $parentId) { | |
| $children = getresultTree($elements, $element['id']); | |
| if ($children) { | |
| <?php | |
| /** | |
| * @file | |
| * Basic demonstration of how to do parallel threads in PHP. | |
| */ | |
| // This array of "tasks" could be anything. For demonstration purposes | |
| // these are just strings, but they could be a callback, class or | |
| // include file (hell, even code-as-a-string to pass to eval()). |
| #!/usr/bin/env bash | |
| #This script backups selected databases in local MySQL server | |
| #REQUIREMENTS | |
| ##mysqldump gzip | |
| ##mysql database has no root password. This script uses 'root' MySQL user without password as no 'root' password is set. | |
| ##This is not good practice. User with more restrictive permission should be used. | |
| #set database user |
| <?php | |
| date_default_timezone_set('UTC'); | |
| require 'vendor/autoload.php'; | |
| use Monolog\Logger; | |
| use Monolog\Handler\StreamHandler; | |
| use GuzzleHttp\Pool; | |
| use GuzzleHttp\Client; |