Skip to content

Instantly share code, notes, and snippets.

@positiveque
positiveque / bash
Created November 25, 2020 17:19 — forked from amorev/bash
Telegram backup script
# создаем один tar.bz2 архив
backupDirectory=<backups_directory>
projectDirectory=<projects_directory>
chatId=<telegram_chat_id>
botToken=<telegram_bot_token>
cd $backupDirectory
tar -cvjf $backupDirectory/archive.full.tar.bz2 $projectDirectory
split -b 40M archive.full.tar.bz2 "archiver.tar.bz.part"
for i in `ls $backupDirectory | grep part`
@positiveque
positiveque / installatron-cpanel-backup.sh
Created November 25, 2020 17:19
cPanel Installatron Backup
#!/bin/bash
#EK
telegram() {
USERID=""
KEY=""
URL="https://api.telegram.org/bot${KEY}/sendMessage"
TEXT="${1}"
curl -s -d "chat_id=${USERID}&text=${TEXT}&disable_web_page_preview=true&parse_mode=markdown" $URL > /dev/null
}
@positiveque
positiveque / backupRepo.sh
Created November 25, 2020 17:19 — forked from albertodeste/backupRepo.sh
Simple Raspberry backup script with notification
#/bin/bash
# USER SETTINGS
BACKUP_FOLDER="/srv/repositories"
BACKUP_FILE_NAME=backup-`date +%Y%m%d`.tar.gz
DROPBOX_FOLDER=/Backup
TELEGRAM_USER_ID=""
TELEGRAM_BOT_KEY=""
HEALTH_CHECK_KEY=""
@positiveque
positiveque / top-brew-packages.txt
Created October 28, 2020 22:15 — forked from r5v9/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
python: Interpreted, interactive, object-oriented programming language
mysql: Open source relational database management system
coreutils: GNU File, Shell, and Text utilities
openssl: SSL/TLS cryptography library
postgresql: Object-relational database system
--------------------------------------------------------------------------------------------------------------------
#setting system locale to en_US.utf8
localectl set-locale LC_CTYPE=en_US.utf8
localectl status
----------------------------------------------------------------------------------------------------
ip -o -4 addr list enp0s8 | awk '{print $4}' | cut -d/ -f1 # print IP with a given interface
ip -o -6 addr list enp0s8 | awk '{print $4}' | cut -d/ -f1
ip route get 8.8.8.8 | sed -n '/src/{s/.*src *\([^ ]*\).*/\1/p;q}' # IP reaching the public internet, multiple IPs interfaces
ifconfig | awk '/192.168.18.84/ {print $1}' RS="\n\n" # print interface with a given IP
----------------------------------------------------------------------------------------------------
@positiveque
positiveque / rclone-backup-script.sh
Created October 28, 2020 14:01 — forked from donwilson/rclone-backup-script.sh
Back up WWW, MySQL DB and separate content folder to S3 using rclone
#!/bin/bash
###
# Backup Script
###
# Toggle debug mode for CLI output - "YES" or "NO"
DEBUG="YES"
@positiveque
positiveque / rclone-backup-script.sh
Created October 28, 2020 14:01 — forked from donwilson/rclone-backup-script.sh
Back up WWW, MySQL DB and separate content folder to S3 using rclone
#!/bin/bash
###
# Backup Script
###
# Toggle debug mode for CLI output - "YES" or "NO"
DEBUG="YES"
@positiveque
positiveque / ! Shell scripts
Created October 17, 2020 00:07 — forked from yohanesgultom/! Shell scripts
Random shell scripts
Random shell scripts
@positiveque
positiveque / block-tor-exit-nodes.sh
Created August 29, 2020 10:07
Block Tor Exit-Nodes Using IPTABLES
#!/bin/bash
# Install utilities: ipset and iprange
apt install ipset iprange -y
# Create new a set
ipset create tor hash:net
# Get a list of Tor exit-nodes
curl -sSL "https://check.torproject.org/torbulkexitlist" > /tmp/exit_nodes.txt
# Optimize and merge a list
iprange --optimize --merge /tmp/exit_nodes.txt > /tmp/exit_nodes_optimized.txt
# Add to the set
@positiveque
positiveque / block-tor-exit-nodes-nginx.sh
Created August 29, 2020 10:07
How To Block Tor Exit-Nodes with Nginx (deny-list)
#!/bin/sh
wget -qO- https://check.torproject.org/torbulkexitlist | sort | sed "s/^/deny /g;" > /etc/nginx/conf.d/deny-tor.conf
systemctl nginx reload