Skip to content

Instantly share code, notes, and snippets.

View NotYusta's full-sized avatar

Yusta NotYusta

View GitHub Profile
#!/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 August 7, 2024 08:45
RC Local
#!/bin/sh
if ! grep -q "bash /root/firewall.sh" "/etc/rc.local"; then
echo 'bash /root/firewall.sh' | sudo tee -a /etc/rc.local
fi
chmod +x /etc/rc.d/rc.local
sleep 1s
systemctl enable rc-local --now
@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"
@NotYusta
NotYusta / install_wings_full.sh
Last active August 7, 2024 08:46
Add swap, Install Firewall, Wings & Docker
#!/bin/sh
INSTALL_FIREWALL_URL="https://gist.githubusercontent.com/NotYusta/d1e227f6dbd27323b8c475586fe6d43d/raw/6f83177c3de274a974c93f7bced86f386f9a36ce/firewall.sh"
INSTALL_WINGS_URL="https://gist.githubusercontent.com/NotYusta/77c998832676310b53761adb0c3546c7/raw/e895f9309591ca807025732e1832838322bb6b09/install_wings.sh"
ADD_SWAP_URL="https://gist.githubusercontent.com/NotYusta/bc86b388b0661604bbab70a987c88bd2/raw/833edc535dc0e063c3f60fe402f6c23a96648231/add_swap.sh"
RC_LOCAL_URL="https://gist.githubusercontent.com/NotYusta/0d669bd57bfc67a56c8f1f18941a2b9a/raw/4e00f34a1332bcb01f425adca91d8c6e8964e2d7/rc-local.sh"
dnf update -y
dnf install curl -y
curl -s "$ADD_SWAP_URL" | bash
@NotYusta
NotYusta / install_wings.sh
Last active March 2, 2024 09:44
Install Pterodactyl Wings & Docker
#!/bin/sh
WINGS_SYSTEMD_FILE="/etc/systemd/system/wings.service"
WINGS_SYSTEMD="\
[Unit]
Description=Pterodactyl Wings Daemon
After=docker.service
Requires=docker.service
PartOf=docker.service
[Service]
@NotYusta
NotYusta / add_swap.sh
Last active August 7, 2024 08:40
Swapfile installation script (1G) - Enterprise Linux
#!/bin/sh
dnf update -y
dnf install grep -y
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
cp -rv /etc/fstab /etc/fstab.bak
if ! grep -q "/swapfile /swapfile swap sw 0 0" "/swapfile"; then
@NotYusta
NotYusta / firewall.sh
Last active August 7, 2024 08:39
Firewall Cloudflare & SSH
#!/bin/sh
dnf update -y
dnf install iptables ipset -y
ipset create cloudflare-v4 hash:net family inet
ipset add cloudflare-v4 173.245.48.0/20
ipset add cloudflare-v4 103.21.244.0/22
ipset add cloudflare-v4 103.22.200.0/22
ipset add cloudflare-v4 103.31.4.0/22
ipset add cloudflare-v4 141.101.64.0/18
@NotYusta
NotYusta / minecraft_forge.sh
Last active February 8, 2024 12:01
Minecraft Custom Startup for forge
DEFAULT_ARGUMENT="-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 \
-XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC \
-XX:G1NewSizePercent=30 \
-XX:G1MaxNewSizePercent=40 \
-XX:G1HeapRegionSize=8M \
-XX:G1ReservePercent=20 \
-XX:G1HeapWastePercent=5 \
@NotYusta
NotYusta / minecraft.sh
Last active February 8, 2024 12:00
Minecraft Custom Startup
DEFAULT_ARGUMENT="-Dterminal.jline=false \
-Dterminal.ansi=true \
-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 \
-XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC \
-XX:G1NewSizePercent=30 \
-XX:G1MaxNewSizePercent=40 \
-XX:G1HeapRegionSize=8M \