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 | |
// Генерируем соль | |
$salt = '$2a$10$'.substr(str_replace('+', '.', base64_encode(pack('N4', mt_rand(), mt_rand(), mt_rand(),mt_rand()))), 0, 22) . '$'; | |
// Шифруем пароль с применением данной соли | |
$hashed_password = crypt($password, $salt); |
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 | |
$handle = @fopen("ip.ru.ranges.txt", "r"); | |
$fullNetworks = []; | |
$fullNetworks[] = "104.192.136.0/21"; // ATLASSIAN PTY LTD | |
$fullNetworks[] = "69.162.124.226/28"; // uptimerobot.com | |
$fullNetworks[] = "63.143.42.242/28"; // uptimerobot.com | |
$fullNetworks[] = "66.249.64.0/19"; // Googlebot | |
$fullNetworks[] = "66.102.0.0/20"; // Google Inc |
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
#!/bin/bash | |
ROOTPASS='myPasswordDb' | |
echo "Укажите имя приложения:" | |
read USERNAME | |
echo "Укажите домен:" | |
read DOMAIN |
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 | |
$dir = './'; | |
$files = scandir($dir); | |
$list = []; | |
for ($i = 2; $i < count($files); $i++) { | |
$ext = substr($files[$i], -3, 3); | |
if ($ext != 'mp3') { | |
continue; | |
} | |
$newName = md5(uniqid()) . '.' . $ext; |
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
Остановить все контейнеры | |
docker stop $(docker ps -a -q) | |
Рестарт всех контейнеров | |
docker restart $(docker ps -q) | |
Удалить все контейнеры | |
docker rm $(docker ps -a -q) | |
Удалить все неиспользуемые образы |
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
@echo off | |
setlocal EnableDelayedExpansion | |
set myServer=google.ru | |
for /f "tokens=1,2 delims=[]" %%a IN ('ping -n 1 -w 0 !myServer!') DO ( | |
if "%%b" NEQ "" set ip=%%b | |
) | |
rem echo %myServer% ip is %ip% | |
route delete %ip% MASK 255.255.255.255 192.168.137.1 | |
route add %ip% MASK 255.255.255.255 192.168.137.1 |
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
SELECT a.usename, a.pid, a.application_name, a.backend_start, (NOW()::timestamp - a.backend_start::timestamp) as dif, a.state, a.query | |
from pg_stat_activity a |
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
# Generated by iptables-save v1.6.0 on Thu Mar 5 13:45:50 2020 | |
*nat | |
:PREROUTING ACCEPT [12:580] | |
:INPUT ACCEPT [12:580] | |
:OUTPUT ACCEPT [1:76] | |
:POSTROUTING ACCEPT [1:76] | |
-A PREROUTING -i eth0 -p tcp -m multiport --dports 80,443,880,1780,1781,8880 -j DNAT --to-destination DIST_SERVER_1_IP | |
-A PREROUTING -i eth0 -p tcp --dport 1782 -j DNAT --to-destination DIST_SERVER_2_IP | |
-A POSTROUTING -o eth0 -p tcp -m multiport --dports 80,443,880,1780,1781,8880 -j SNAT --to-source THIS_MITM_PROXY_IP | |
-A POSTROUTING -o eth0 -p tcp --dport 1782 -j SNAT --to-source THIS_MITM_PROXY_IP |
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
server { | |
listen 80; | |
server_name mydomain.ru; | |
access_log /var/log/nginx/mydomain.ru.access.log; | |
error_log /var/log/nginx/mydomain.ru.error.log; | |
rewrite_log on; | |
# задаем красивую страницу 50x для пятисотых ошибок | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { |
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
RewriteEngine On | |
Header always add Access-Control-Allow-Origin "*" | |
Header always add Access-Control-Allow-Headers "*" | |
RewriteCond %{REQUEST_METHOD} OPTIONS | |
RewriteRule ^(.*)$ $1 [R=200,L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d |