This file contains hidden or 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 | |
| # requires inotify-tools and mailutils and rsync | |
| #echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.d/99-sysctl.conf | |
| # Directory to be monitored | |
| MONITOR_DIR="/var/www/html" | |
| # Directory to store file backups | |
| BACKUP_DIR="/var/www/filewatcher_backup/html" | |
| mkdir -p "$BACKUP_DIR" |
This file contains hidden or 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
| $key = '' | |
| $rendezvous_server = '' | |
| $relay_server = '' | |
| $api_server = '' | |
| $nat_type = 1 | |
| $serial = 0 | |
| $setupUnattendedAccess = 1 | |
| $process = "rustdesk" | |
| $ServiceName = 'Rustdesk' |
This file contains hidden or 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
| ## Allow traffic all around the local subnet | |
| ufw allow in to 192.168.1.0/24 | |
| ufw allow out to 192.168.1.0/24 | |
| ## Default deny traffic rules | |
| ufw default deny outgoing | |
| ufw default deny incoming | |
| ## Allow connections to the OpenVPN Server on the specific port/protocol | |
| ufw allow out to 12.34.56.78 port 1194 proto udp |
This file contains hidden or 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
| ## Switch to root | |
| sudo -i | |
| ## Disable IPv6 | |
| echo "net.ipv6.conf.all.disable_ipv6=1" > /etc/sysctl.d/99-disable-ipv6.conf | |
| echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.d/99-disable-ipv6.conf | |
| echo "net.ipv6.conf.lo.disable_ipv6=1" >> /etc/sysctl.d/99-disable-ipv6.conf | |
| sysctl -p /etc/sysctl.d/99-disable-ipv6.conf | |
| sed -i 's/IPV6=yes/IPV6=no/g' /etc/default/ufw | |
| ufw disable |
This file contains hidden or 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
| # Install Node.js and npm (adjust the version as needed) | |
| RUN apt-get -y update && apt-get install -y ca-certificates curl gnupg | |
| RUN mkdir -p /etc/apt/keyrings | |
| RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --batch --dearmor -o /etc/apt/keyrings/nodesource.gpg | |
| RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list | |
| RUN apt-get update && apt-get install nodejs -y |
This file contains hidden or 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 | |
| host="" | |
| username="" | |
| password="" | |
| database="" | |
| datestamp=$(date +"%m-%d-%Y") | |
| cd "/databackup/backup" | |
| ##Start DATABASE BACKUP | |
| rm *.sql | |
| for x in `mysql --skip-column-names -h$host -u$username -p$password $database -e 'show tables;'`; do |
This file contains hidden or 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
| #add to /etc/apache2/apache2.conf | |
| #this will block .git access across all sites | |
| <Directory /var/www/> | |
| # Block access to .git directory | |
| RedirectMatch 404 /\.git | |
| </Directory> |
This file contains hidden or 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
| sudo swapon --show | |
| free -h | |
| df -h | |
| sudo fallocate -l 1G /swapfile | |
| ls -lh /swapfile | |
| sudo chmod 600 /swapfile | |
| sudo mkswap /swapfile | |
| sudo swapon /swapfile |
This file contains hidden or 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
| sudo -s | |
| apt update | |
| apt install unattended-upgrades | |
| nano /etc/apt/apt.conf.d/20auto-upgrades | |
| APT::Periodic::Update-Package-Lists "1"; | |
| APT::Periodic::Download-Upgradeable-Packages "1"; | |
| APT::Periodic::Unattended-Upgrade "3"; | |
| APT::Periodic::AutocleanInterval "7"; |
This file contains hidden or 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
| roll back branch | |
| git checkout <branch> | |
| git reset --hard <commit> | |
| git push --force origin master | |
| create new from current | |
| git checkout -b <branch> | |
| always assume file is unchanged. |