Skip to content

Instantly share code, notes, and snippets.

View groundcat's full-sized avatar

groundcat

  • Pennsylvania, US
  • 02:21 (UTC -04:00)
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / .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 / 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 / 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 / block-country-ip.sh
Last active May 22, 2022 06:19
Linux VPS block country 一键屏蔽指定国家所有的IP访问
#! /bin/bash
#Block-IPs-from-countries
#Github:https://github.com/iiiiiii1/Block-IPs-from-countries
#Blog:https://www.moerats.com/
Green="\033[32m"
Font="\033[0m"
#root权限
root_need(){
@groundcat
groundcat / mousewheel.sh
Last active June 4, 2022 03:51
Ubuntu 20.04 mouse scroll wheel speed
#!/bin/bash
# Version 0.1 Tuesday, 07 May 2013
# Comments and complaints http://www.nicknorton.net
# GUI for mouse wheel speed using imwheel in Gnome
# imwheel needs to be installed for this script to work
# sudo apt-get install imwheel
# Pretty much hard wired to only use a mouse with
# left, right and wheel in the middle.
# If you have a mouse with complications or special needs,
# use the command xev to find what your wheel does.