Skip to content

Instantly share code, notes, and snippets.

#!/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"
@adamz01h
adamz01h / rustdesk_install.ps1
Last active December 20, 2023 16:33
Rustdesk Powershell Installer that works.
$key = ''
$rendezvous_server = ''
$relay_server = ''
$api_server = ''
$nat_type = 1
$serial = 0
$setupUnattendedAccess = 1
$process = "rustdesk"
$ServiceName = 'Rustdesk'
@adamz01h
adamz01h / ovpn_kill_switch.sh
Created December 11, 2023 01:46
ovpn_kill_switch.sh
## 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
@adamz01h
adamz01h / kenmoini_deluge_install.sh
Last active February 14, 2024 10:30
kenmoini_deluge_install.sh
## 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
@adamz01h
adamz01h / node.js.dockerfile
Created September 5, 2023 18:37
Install Node.js and npm docker commands
# 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
@adamz01h
adamz01h / mysql_backup,sh
Created August 17, 2023 16:49
Mysql backup script
#!/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
@adamz01h
adamz01h / apache2.conf
Created August 17, 2023 14:33
Block .git access
#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>
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
@adamz01h
adamz01h / commands.txt
Created April 27, 2023 19:09
Unattended upgrades
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";
@adamz01h
adamz01h / githelp.txt
Created April 27, 2023 17:42
git help
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.