Skip to content

Instantly share code, notes, and snippets.

View groundcat's full-sized avatar

groundcat

  • Pennsylvania, US
  • 03:07 (UTC -05:00)
View GitHub Profile
@groundcat
groundcat / swap.sh
Created April 12, 2022 19:29
Linux VPS一键添加/删除Swap虚拟内存
#!/usr/bin/env bash
#Blog:https://www.moerats.com/
Green="\033[32m"
Font="\033[0m"
Red="\033[31m"
#root权限
root_need(){
if [[ $EUID -ne 0 ]]; then
@groundcat
groundcat / changeip.sh
Last active December 8, 2023 01:11
Change static IP for Lightsail instances with AWS-CLI
#!/bin/bash
REGION=$1
readonly REGION
echo -e '*****************************************************************'
echo -e '***************************** START *****************************'
echo -e '*****************************************************************'
#定义主进程
@groundcat
groundcat / .htaccess
Last active January 17, 2025 19:39
WordPress optimization for wp-config.php
# WP ...
# Hide .htaccess and wp-config.php
<Files .htaccess wp-config.php>
order allow,deny
deny from all
</Files>
# Block wp-includes folder and files
<IfModule mod_rewrite.c>
@groundcat
groundcat / hardern-ssh.md
Last active March 10, 2022 05:32
Harden the SSHD login and configuration

Create the user, replacing example_user with your desired username. You’ll then be asked to assign the user a password:

adduser ubuntu

Add the user to the sudo group so you’ll have administrative privileges:

@groundcat
groundcat / cloudflare-allow.conf
Last active May 23, 2022 21:30
cloudflare-allow
# This script makes Nginx only allow IPs from Cloudflare
# Create file with the following at: /etc/nginx/cloudflare-allow.conf
# Then add in server {} block this line: include /etc/nginx/cloudflare-allow.conf;
# https://www.cloudflare.com/ips
allow 173.245.48.0/20;
allow 103.21.244.0/22;
allow 103.22.200.0/22;
allow 103.31.4.0/22;
allow 141.101.64.0/18;
@groundcat
groundcat / random-mac.sh
Last active September 16, 2023 12:43
Asuswrt-Merlin set random MAC
#!/bin/sh
MAC=$(m=$(openssl rand -hex 5) && echo "00":${m:0:2}:${m:2:2}:${m:4:2}:${m:6:2}:${m:8:2})
logger "Changing MAC address to $MAC"
nvram set wan0_hwaddr_x="$MAC"
nvram commit
service "restart_wan_if 0"
@groundcat
groundcat / Optimize_Oracle_Cloud_VPS.md
Created May 27, 2021 04:04
Optimize Oracle Cloud VPS

Ubuntu iptables

The Oracle Cloud Ubuntu images come with somewhat restrictive iptables rules by default. Docker manages the instance firewall and we have the Oracle Cloud firewall in front, so let's remove the current firewall to avoid trouble:

apt purge netfilter-persistent iptables-persistent

Remove useless stuff (optional)

@groundcat
groundcat / adguard-doh-ubuntu.md
Last active June 23, 2024 16:51
Setup AdGuard DNS Over HTTPS on Ubuntu

Download the cloudflared daemon.

wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
mv cloudflared-linux-amd64 /usr/sbin/cloudflared
chmod -x /usr/sbin/cloudflared
cloudflared --version

Start the DNS proxy on an address and port in your network.

@groundcat
groundcat / Allows Read and Write Access to S3 Bucket.md
Created July 18, 2020 21:21
IAM Users - Allows Read and Write Access to S3 Bucket
@groundcat
groundcat / Install Transmission on CentOS 7.md
Created July 5, 2020 03:30
Install Transmission on CentOS 7

Install dependency

yum groupinstall 'development tools'
yum install m4 libtool gettext libcurl-devel psmisc libevent-devel intltool gtk3-devel openssl-devel

Download Transmission official release