Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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'
#!/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"
@echo off
setlocal
:: Check if a file path was provided as an argument
if "%~1"=="" (
echo No WPL file was dragged onto the script.
pause
exit /b
)
@adamz01h
adamz01h / Process_folder.bat
Created April 21, 2024 02:07
Process a folder of Windows Media Playlists to export the list to folders with files.
@echo off
setlocal
:: Check if a folder path was provided as an argument
if "%~1"=="" (
echo No folder path was provided.
pause
exit /b
)
@adamz01h
adamz01h / NTLMV1.c
Created June 20, 2024 17:10
NTLMv1 Implementation in C GPT
#include <stdio.h>
#include <stdint.h>
#include <string.h>
// Simplified MD4 implementation
typedef struct {
uint32_t state[4];
uint32_t count[2];
unsigned char buffer[64];
} MD4_CTX;
@adamz01h
adamz01h / lazydockerdownload.sh
Last active July 24, 2024 20:46
lazydockerdownload
# map different architecture variations to the available binaries
ARCH=$(uname -m)
case $ARCH in
i386|i686) ARCH=x86 ;;
armv6*) ARCH=armv6 ;;
armv7*) ARCH=armv7 ;;
aarch64*) ARCH=arm64 ;;
esac
# prepare the download URL