Skip to content

Instantly share code, notes, and snippets.

View NotYusta's full-sized avatar

Yusta NotYusta

View GitHub Profile
@NotYusta
NotYusta / windows_automatic_network_config.ps1
Last active September 30, 2024 15:27
Windows Automatic Network Configuration
function windows_automatic_network_config {
param (
[string]$IPv4,
[string]$CIDR,
[string]$Gateway,
[string]$DNS1,
[string]$DNS2
)
# Check if all arguments are provided
@NotYusta
NotYusta / linux_automatic_network_config.sh
Last active June 4, 2025 08:27
Linux Automatic Network Configuration
#!/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
@NotYusta
NotYusta / test.sh
Created September 30, 2024 08:10
Test
#!/bin/sh
echo "test"
@NotYusta
NotYusta / reset_ssh_password.sh
Last active September 29, 2024 04:59
Reset SSH Password
#!/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
@NotYusta
NotYusta / enable_ssh_password
Last active September 29, 2024 04:56
Enable SSH Password
#!/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
@NotYusta
NotYusta / qm_guest_win_scripts.txt
Last active May 10, 2025 03:01
QEMU GUEST WINDOWS SCRIPTS
// 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"
#!/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
@NotYusta
NotYusta / rc-local.sh
Last active March 18, 2025 12:18
RC Local
#!/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
@NotYusta
NotYusta / install_certificate.sh
Last active February 17, 2024 05:58
Install certificate and replace all certificate subdomains with domain's one.
#!/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"
@NotYusta
NotYusta / test.sh
Last active March 2, 2024 07:57
Test bash
#!/bin/sh
mkdir test
echo "You successfully did it"
echo "$TOKEN"