Skip to content

Instantly share code, notes, and snippets.

View demyanovs's full-sized avatar

Viacheslav Demianov demyanovs

View GitHub Profile
#!/bin/bash
yum update -y
sudo yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64
cd /home/ec2-user/
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
unzip CloudWatchMonitoringScripts-1.2.2.zip
rm -rf CloudWatchMonitoringScripts-1.2.2.zip
# Use the commands below for the lab.
# /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-util --verify --verbose
@demyanovs
demyanovs / redis_scan.lua
Last active August 18, 2020 09:20
Lua and redis scan
local red = redis:new()
local ok, err = red:connect("127.0.0.1", "6379")
if not ok then
ngx.status = 503
ngx.say("Can't connect to redis: "..err)
ngx.exit(ngx.OK)
else
red:set_timeout(1000) -- 1 sec
end
@demyanovs
demyanovs / 01. Try Files & Named Locations.conf
Last active October 21, 2024 16:48
Nginx configuration and resources
events {}
http {
include mime.types;
server {
listen 80;
server_name 167.99.93.26;
@demyanovs
demyanovs / check_brackets.php
Last active October 16, 2018 10:42
Check brackets for balance
<?php
/**
* User: vyacheslav.demyanov
* Check brackets for balance
* [([]{[]})] — balanced, but {[}], [{)] and ]{}[ - not.
*/
if (isset($argv[1])) {
$str = $argv[1];
} else {
$str = '[([]{[]})]';
@demyanovs
demyanovs / blockrobots.htaccess
Last active October 20, 2023 20:21
Block useless load from bots
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Bingbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^bingbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Baiduspider [NC,OR]
RewriteCond %{HTTP_USER_AGENT} linkdexbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} coccocbot-web [NC,OR]
RewriteCond %{HTTP_USER_AGENT} FemtosearchBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Owler [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Pinterestbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} GrapeshotCrawler [NC,OR]