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 | |
grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" /etc/fstab | uniq | sort > mount_on_boot | |
df -h | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | uniq | sort > already_mounted | |
DIFF=$(diff mount_on_boot already_mounted) | |
if [ "$DIFF" != "" ] | |
then | |
logger "do something" |
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 | |
if [[ "$EUID" -ne 0 ]]; then | |
echo "Permission denied" | |
exit 1 | |
fi | |
cp /etc/network/interfaces /etc/network/interfaces.new | |
systemctl restart networking.service |
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 | |
if [[ "$EUID" -ne 0 ]]; then | |
echo "Permission denied" | |
exit | |
fi | |
WG_CONFIG="/etc/wireguard/wg0.conf" | |
[ -f $WG_CONFIG ] || echo "Wireguard config not found"; exit 86 |
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/expect | |
#============== | |
# 1510 series = | |
#============== | |
set switch "DGS-1510-52" | |
set ip "switch_ip" | |
set tftp_host "remote_tftp_server" | |
set password "pass" |
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
# Nginx | |
check process nginx | |
with pidfile /run/nginx.pid | |
start program = "/bin/systemctl start nginx.service" | |
stop program = "/bin/systemctl stop nginx.service" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed host 127.0.0.1 port 80 protocol http | |
then restart |
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
-- Создайте базу данных test_guru | |
CREATE DATABASE test_guru; | |
-- Таблицу categories с атрибутом title | |
CREATE TABLE categories( | |
id SERIAL PRIMARY KEY, | |
title VARCHAR(50) NOT NULL | |
); | |
-- Таблицу tests в которой должны быть атрибуты title, level, внешний ключ к таблице categories |
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
====================================== | |
GET /anything HTTP/1.1 | |
Host: httpbin.org | |
HTTP/1.1 200 OK | |
Connection: keep-alive | |
Server: gunicorn/19.9.0 | |
Date: Mon, 01 Oct 2018 14:10:05 GMT | |
Content-Type: application/json | |
Content-Length: 247 |
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 | |
curl -XPOST -H "Authorization: token $GITHUB_TOKEN"\ | |
https://api.github.com/user/repos -d "{\"name\":\"$1\"}" | |
mkdir ~/github/$1 | |
cd ~/github/$1 | |
echo "# $1" >> README.md | |
git init | |
git add README.md | |
git commit -m "first commit" |
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 | |
repo_name=$1 | |
test -z $repo_name && echo "Repo name required." 1>&2 && exit 1 | |
curl -XPOST -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user/repos -d "{\"name\":\"$repo_name\"}" |
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 python3 | |
import argparse | |
import os | |
from sys import argv | |
parser = argparse.ArgumentParser() | |
parser.add_argument("file", help='file with shots numbers') | |
parser.add_argument("folder", help='folder to scan') | |
args = parser.parse_args() |
NewerOlder