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/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 |
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 | |
# 🔹 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 |
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/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 |
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 | |
# 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 |
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 | |
# Check if exactly one argument (vm-id) is provided | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <vm-id>" | |
exit 1 | |
fi | |
VMID="$1" |
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 | |
# Function to check the exit status of the last command | |
check_error() { | |
if [ $? -ne 0 ]; then | |
echo "Error: $1" | |
exit 1 | |
fi | |
} |
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
function windows_automatic_network_config { | |
param ( | |
[string]$IPv4, | |
[string]$CIDR, | |
[string]$Gateway, | |
[string]$DNS1, | |
[string]$DNS2 | |
) | |
# Check if all arguments are provided |
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 | |
# Check if all arguments are provided | |
if [ $# -ne 6 ]; then | |
echo "Usage: $0 <ipv4> <cidr/subnet-mask> <gateway> <dns1> <dns2> <mac-address>" | |
exit 1 | |
fi | |
IPV4=$1 | |
CIDR=$2 |
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/sh | |
echo "test" |
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 | |
NEW_PASSWORD="$1" | |
# Check if a password argument is provided | |
if [ "$#" -ne 1 ]; then | |
echo "bash script.sh <new_password>" | |
exit 1 | |
fi |
NewerOlder