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 |
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 | |
# Update SSH configuration to allow root login and password authentication | |
# Check if the script is running as root | |
if [ "$EUID" -ne 0 ]; then | |
echo "Please run as root." | |
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
// All the commands can only be run if qemu guest agent is installed. | |
// Automatic resize - C Drive can only be resized when the recovery partition is deleted. | |
qm guest exec <vm-id> -- powershell -Command "Resize-Partition -DriveLetter C -Size (Get-PartitionSupportedSize -DriveLetter C).SizeMax" | |
// Automatic IPv4 network setup | |
qm guest exec <vm-id> netsh interface ipv4 set address name="Ethernet" static <ipv4> <ip-subnet> <ip-gateway> | |
// Automatic IPv4 DNS Setup | |
qm guest exec <vm-id> -- cmd.exe /c "netsh interface ipv4 add dns name=\"Ethernet\" 1.1.1.1 index=1 & netsh interface ipv4 add dns name=\"Ethernet\" 8.8.8.8 index=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/bash | |
# Backup the original repository files | |
echo "Backing up original repo files..." | |
sudo cp -r /etc/yum.repos.d /etc/yum.repos.d.backup | |
# Update the repository configuration | |
echo "Updating repository configuration..." | |
sudo sed -i 's|mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/*.repo | |
sudo sed -i 's|#baseurl=http://dl.rockylinux.org/$contentdir/$releasever|baseurl=https://rocky-linux-asia-southeast1.production.gcp.mirrors.ctrliq.cloud/pub/rocky/$releasever|g' /etc/yum.repos.d/*.repo |
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 | |
# Detect system type | |
if command -v dnf >/dev/null 2>&1; then | |
OS="rhel" | |
RC_LOCAL="/etc/rc.d/rc.local" | |
elif command -v apt >/dev/null 2>&1; then | |
OS="debian" | |
RC_LOCAL="/etc/rc.local" | |
else |
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 | |
DOMAIN_NAME="" | |
CERTIFICATE_PATH="/etc/letsencrypt/live" | |
# MAKE SURE USE \ TO PREVENT TRAILING SPACES. | |
PRIVATE_KEY="" | |
PUBLIC_CERT="" | |
rm -rfv "$CERTIFICATE_PATH/$DOMAIN_NAME" | |
mkdir -pv "$CERTIFICATE_PATH/$DOMAIN_NAME" | |
echo "$PUBLIC_CERT" | sudo tee -a "$CERTIFICATE_PATH/$DOMAIN_NAME/fullchain.pem" |
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 | |
mkdir test | |
echo "You successfully did it" | |
echo "$TOKEN" |