Skip to content

Instantly share code, notes, and snippets.

View NotYusta's full-sized avatar

Yusta NotYusta

View GitHub Profile
@NotYusta
NotYusta / install_cadvisor_firewall.sh
Last active April 29, 2025 03:04
Install cadvisor firewall
#!/bin/sh
CADVISOR_PORT=9101
IPSET_NAME=cadvisor_whitelist
CHAIN_NAME=cadvisor_firewall
# Function to install necessary packages
install_packages() {
if command -v apt-get >/dev/null 2>&1; then
apt-get update -y
apt-get install -y ipset iptables
@NotYusta
NotYusta / install_node_exporter_full.sh
Last active April 28, 2025 01:31
Install Node Exporter Full
#!/bin/sh
set -e # Stop the script if any command fails
TMP_APP_FILE="/tmp/node_exporter_install.sh"
TMP_FW_FILE="/tmp/node_exporter_firewall.sh"
NODE_EXPORTER_APP_URL="https://gist.githubusercontent.com/NotYusta/7f0121db2fb01c60edb3d64ad1b9cd27/raw/dd98f7a7a9ef0dfd552679474a116514a48548ee/install_node_exporter.sh"
NODE_EXPORTER_FW_URL="https://gist.githubusercontent.com/NotYusta/a0aa75ccd11f8966ececd50916a08be2/raw/9884a086c9f55615bab741272340c83214f6d1c3/node_exporter_firewall.sh"
# Prompt user for IP list
echo "Enter IPs separated by commas (e.g., 1.2.3.4,5.6.7.0/24):"
@NotYusta
NotYusta / node_exporter_firewall.sh
Last active April 29, 2025 02:55
Install Node Exporter Firewall
#!/bin/sh
# Function to download and extract cadvisor
install_cadvisor() {
curl -sLo /bin/node-exporter https://github.com/google/cadvisor/releases/download/v0.52.1/cadvisor-v0.52.1-linux-amd64
chmod +x /bin/node-exporter
}
# Function to create systemd service for cadvisor
create_systemd_service() {
@NotYusta
NotYusta / install_node_exporter.sh
Last active May 18, 2025 12:43
Install Node-Exporter
#!/bin/sh
PORT=9100
BIN_DIR="/usr/local/bin"
SERVICE_NAME="node-exporter"
BINARY_NAME="node-exporter"
VERSION="1.9.1"
DOWNLOAD_URL="https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz"
# Function to download and extract node_exporter
install_node_exporter() {
@NotYusta
NotYusta / rename_package_name.sh
Created April 7, 2025 13:09
Rename Package Name Go
#!/bin/sh
echo -n "Enter new Go package name: "
read pkg_name
# Get the previous package name from go.mod
prev_pkg_name=$(grep '^module ' go.mod | awk '{print $2}')
# Update go.mod
go mod edit -module $pkg_name
@NotYusta
NotYusta / ssh_strict_hardening.sh
Last active March 30, 2025 09:13
SSH Strict Authentication (MFA)
#!/bin/bash
# 🔹 Backup directory for rollback
BACKUP_DIR="/root/.ssh-security-backup"
SUDO_GROUP="sudo"
generate_password() {
local password length num_count special_count char_count
while true; do
# Random total length between 24 and 32
@NotYusta
NotYusta / database-backup.sh
Last active March 23, 2025 02:16
Start Database Backup
#!/bin/sh
DIR_PATH="$HOME/database-backup"
OUTDIR_PATH="$DIRPATH/out"
CLEAR_PERIOD="7"
cd $DIR_PATH
# Ensure the output directory exists
mkdir -p "$OUTDIR_PATH"
# Make sure the backup script is executable
@NotYusta
NotYusta / delete_jar.sh
Created October 22, 2024 09:54
Delete Jars
#!/bin/bash
# Check if the user provided a path argument
if [ -z "$1" ]; then
echo "Usage: $0 <path>"
exit 1
fi
# Set the PATH variable to the user-provided argument
SEARCH_PATH=$1
@NotYusta
NotYusta / proxmox_automatic_boot_order.sh
Last active May 2, 2025 07:34
Proxmox Automatic Boot Order - <vm-id>
#!/bin/bash
# Check if exactly one argument (vm-id) is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <vm-id>"
exit 1
fi
VMID="$1"
@NotYusta
NotYusta / import_proxmox_vm_with_label.sh
Last active October 3, 2024 15:13
Proxmox Import VM Disk (Formatted) - <vm-id> <image-file> <storage> <label> <slot> (0-20, can be single or ranges)
#!/bin/bash
# Function to check the exit status of the last command
check_error() {
if [ $? -ne 0 ]; then
echo "Error: $1"
exit 1
fi
}