Skip to content

Instantly share code, notes, and snippets.

@azetherpat
azetherpat / gist:a7a51a147201f6b5031812f8a8e354ee
Last active April 4, 2025 02:35
update Ubuntu servers python
import paramiko
import logging
import logging.handlers
import os
import time
import json
import sys
# Constants
USERNAME = 'root'
@azetherpat
azetherpat / gist:1ee043b412b7795ebcd56021784f71cc
Last active February 21, 2025 04:10
Woocommerce: add visible prefix label to prices "List price" and "Your price" for logged in users
function patricks_format_accessible_sale_price( $formatted_price, $regular_price, $sale_price ) {
// Only modify for logged-in users
if ( is_user_logged_in() ) {
$formatted_price = '<del>
<span class="screen-reader-text">' . esc_html__('Original price was:', 'woocommerce-accessible-sale-price') . '</span>
List Price: ' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) .
'</del>
<br>
<ins>
<span class="screen-reader-text">' . esc_html__('Current price is:', 'woocommerce-accessible-sale-price') . '</span>
@azetherpat
azetherpat / wp-core-update.sh.txt
Last active May 14, 2025 04:14
WP hosting script - Get sites that have a pending core update (Dry Run or Update)
#!/bin/bash
# wp-core-update.sh
#
# This script iterates over each user directory in /home, recursively searches for wp-config.php files,
# and for each found file treats its containing directory as a WordPress installation.
# It uses WP-CLI (with --allow-root) to check for and update the WordPress core if an update is available.
#
# It supports a "--dry-run" flag. In dry-run mode, the script logs which sites need updating
# without executing the update.
#
@azetherpat
azetherpat / disable-auto-updates.php.txt
Last active May 14, 2025 04:14
mu-plugin - disables Auto Updates for plugins & themes, sets wp minor auto core update email notifications.
<?php //wp-content/mu-plugins/disable-auto-updates.php
/*
Plugin Name: Control Auto Updates (wp,plugins,themes)
Plugin URI: https://example.co
Description: Disables Auto Updates for plugins & themes, sets minor auto core update email notifications.
Version: 1.4
Author: example co
AuthorURI: https://example.co
*/
@azetherpat
azetherpat / PIAGatewaySetup.md
Last active December 31, 2024 02:54 — forked from helloavo/PIAGatewaySetup.md
Setup Linux server to act as a PIA VPN Gateway

Install Debian 11 and update

apt update && apt dist-upgrade -y && apt install libgthread curl ufw -y

If the only account is root, create a new account

adduser pia-gateway
usermod -aG sudo pia-gateway
su pia-gateway