Skip to content

Instantly share code, notes, and snippets.

View ara303's full-sized avatar

E ara303

  • uk
View GitHub Profile
@ara303
ara303 / twitter_media_source.user.js
Last active November 11, 2026 05:41 — forked from TheAMM/twitter_media_source.user.js
Twitter Media Source userscript
// ==UserScript==
// @name Twitter Media Source
// @namespace https://gist.github.com/ara303
// @downloadURL https://gist.github.com/ara303/775c72887f3850d553a4bee84f1744e4
// @updateURL https://gist.github.com/ara303/775c72887f3850d553a4bee84f1744e4
// @version 2.1.10
// @description Allows copying direct full-size image/video links on Twitter (without a #tweetid source suffix), downloading media, and navigating back to a Tweet from a media URL.
// @author AMM
// @match https://twitter.com/*
// @match https://x.com/*
@ara303
ara303 / instructions.txt
Created October 13, 2026 00:09
Use SiteGround SMTP directly (without using SG's DNS)
The hostname came straight from the server itself. Every SMTP server announces its own name in its greeting banner — I just asked it. You don't need to guess or look it up anywhere.
The two commands that did it
1. Ask the server on the SMTP port:
printf 'EHLO test.local\r\n' | nc -G 6 mail.<domain_name>.co.uk 25
The reply was:
220-uk33.siteground.eu ESMTP #2 ...
250-uk33.siteground.eu Hello test.local ...
That first line after 220- is the server's canonical name — uk33.siteground.eu. That's the name on its own valid certificate. Done.
2. Confirm that name has a valid cert (before trusting it):
openssl s_client -connect uk33.siteground.eu:465 -servername uk33.siteground.eu </dev/null 2>&1 | grep "Verify return code"
#!/usr/bin/env bash
# =============================================================================
# Arch Linux + KDE Plasma — Automated Setup Script
# =============================================================================
# Run as your normal user (NOT root). sudo will be invoked as needed.
# Usage: bash arch-setup.sh
# =============================================================================
set -euo pipefail
<?php
/**
* Plugin Name: Preserve Taxonomy Hierarchy on Nav Menus
* Description: Adapted from https://core.trac.wordpress.org/attachment/ticket/18282/preserve-page-and-taxonomy-hierarchy.php and https://wordpress.org/plugins/preserve-taxonomy-hierarchy/
* Author: E. Adams
* Version: 1
*/
defined( 'ABSPATH' ) || exit;
@ara303
ara303 / index.php
Created September 1, 2025 23:04
dogshit gpt5 subscription system
<?php
/**
* Plugin Name: Woo Subscriptions: Shared Access + Renewal Notices
* Description: Extend WooCommerce Subscriptions so multiple users share one subscription’s benefits; includes admin UI to assign members and a renewal notice hook framework.
* Author: GPT
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 7.4
* License: GPLv2 or later
*
@ara303
ara303 / use-mailgun-as-wordpress-smtp.php
Created December 19, 2024 20:59
Use Mailgun as WordPress SMTP email sending
<?php
/**
* Use Mailgun as WordPress's default SMTP sender instead of built-in mailer.
* All of these should be set for the best chance of email delivery.
* Create constant MAILGUN_PASSWORD in wp-config.php for secure storage of API secret.
*/
function use_mailgun_as_smtp( $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = 'smtp.eu.mailgun.org'; // Or not if you're using NA
$phpmailer->Port = 587;
@ara303
ara303 / close-match-json.py
Created October 15, 2024 02:22
Accept a main and sub JSON and establish if they have elements in common to merge into one
import json
from difflib import get_close_matches
import os
os.system("color")
class clrs:
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
@ara303
ara303 / wp-only-default-image-sizes.php
Created October 12, 2024 06:17
WordPress remove all but default image sizes
function only_default_image_sizes(){
foreach( get_intermediate_image_sizes() as $size ){
if( ! in_array( $size, ['thumbnail', 'medium', 'medium_large', 'large'] ) ){
remove_image_size( $size );
}
}
}
add_action( 'init', 'only_default_image_sizes' );
@ara303
ara303 / wp-tags-for-category-cpt-with-caching.php
Created September 13, 2024 16:52
Get a list of all of the tags used on a custom post type of a certain category
<?php
/*
* Assumes your custom post type is called `sma_members`, and that your category has ID `70`.
* You'd want to chage this if you reused these.
*/
function get_cached_sma_members_tags() {
$cached_tags = get_transient('sma_members_category_70_tags');
if (false !== $cached_tags) {
@ara303
ara303 / wp-db-table-import-export.php
Created September 10, 2024 17:53
WordPress database table import/export (as CSV)
<?php
/**
* Plugin Name: Table Import/Export
* Description: For internal use only. To access, WP-Admin > Tools > Table Import/Export.
*/
function table_import_export_menu(){
add_submenu_page(
'tools.php',
'Table Import/Export',
'Table Import/Export',