Skip to content

Instantly share code, notes, and snippets.

View groundcat's full-sized avatar

groundcat

  • Pennsylvania, US
  • 20:40 (UTC -04:00)
View GitHub Profile
@groundcat
groundcat / check.sh
Last active July 16, 2023 21:06
CDN and Load Balancer Tester
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: ./check.sh [domain]"
exit 1
fi
DOMAIN=$1
ALL_RECORDS=$(dig @8.8.8.8 +short $DOMAIN)
@groundcat
groundcat / readme.md
Created July 8, 2023 21:22
Checks connection and auto connect to Cloudflare Warp

Cloudflare Warp Status Check Script

This bash script checks the status of Cloudflare Warp for a given endpoint (https://cloudflare.com/cdn-cgi/trace). It uses curl to make a HTTP request to the specified URL, checks if the response contains "warp=on" or "warp=plus", and acts accordingly.

Prerequisites

Before running the script, make sure you have the following tools installed on your system:

  • curl: A command-line tool for making HTTP requests. You can install it with a package manager like apt, brew, or yum.
  • warp-cli: A command-line interface for managing Cloudflare Warp. Follow Cloudflare's instructions to install it.
@groundcat
groundcat / batch-flatten-pdf.md
Last active March 17, 2023 02:15
Flatten all PDF files in a folder on Linux

To flatten all PDF files in a folder, you can use the command-line tool called pdftk. It is a powerful toolkit for working with PDF files, and it is available on most Linux distributions.

First, install pdftk on your system if you haven't already. For Ubuntu or Debian-based systems, you can use:

sudo apt update
sudo apt install pdftk

For Fedora-based systems, you can use:

@groundcat
groundcat / woocommerce-auto-complete-downloadable-orders.php
Created March 16, 2023 22:24
Automatically mark WooCommerce orders complete, only if all the products in the order is downloadable.
/**
* Auto Complete all WooCommerce orders with only downloadable products.
* If all the products are downloadable, the order status will be updated to 'completed'.
* Use this plugin to implement the function:
* https://github.com/woocommerce/theme-customisations
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
@groundcat
groundcat / wg_auto_toggle.md
Last active February 9, 2023 01:31
WireGuard auto control script

Setting up a WireGuard VPN Script on Ubuntu

Prerequisites:

  • Ubuntu system with WireGuard installed and configured

  • Root access to your Ubuntu system

@groundcat
groundcat / use-dns-over-quic-linux.md
Last active March 19, 2025 09:08
How to install DoQ (DNS-over-QUIC) client on Linux

DNS Proxy is a simple DNS proxy server that supports all existing DNS protocols including DNS-over-TLS, DNS-over-HTTPS, DNSCrypt, and DNS-over-QUIC. Moreover, it can work as a DNS-over-HTTPS, DNS-over-TLS or DNS-over-QUIC server.

1. Install DNS Proxy

VERSION=$(curl -s https://api.github.com/repos/AdguardTeam/dnsproxy/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest AdguardTeam dnsproxy version is $VERSION"
wget -O dnsproxy.tar.gz "https://github.com/AdguardTeam/dnsproxy/releases/download/${VERSION}/dnsproxy-linux-amd64-${VERSION}.tar.gz"
tar -xzvf dnsproxy.tar.gz
cd linux-amd64
@groundcat
groundcat / route48-asus.md
Created July 1, 2022 05:08
Route48.org Asus Router configuration

Go to http://YOUR_ROUTER_IP/Advanced_IPv6_Content.asp

Connection type

Client IPv6 Address:xxxx:xxxx:xxxx::2

IPv6 Prefix Length: 48

Server IPv6 Address:xxxx:xxxx:xxxx::1

@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.
@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 / 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