This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convert a stand-alone WordPress site to a multisite without using the MS Setup. | |
# The Set-Up wizard requires you to deactivate all plugins, but you might not want to do that. | |
# This script helps. | |
# | |
# NOTE: No warranty, use at own risk. Has no checks for existing multisite, it assumes this is a single site installation | |
# This script ASSUMES YOU KNOW WHAT YOU ARE DOING, and so do I. | |
CTM_DB_PREFIX="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# example usage: cd ~/Local\ Sites ; find ./*/app/.idea/workspace.xml -exec patch-workspace.sh {} \; | |
[ -z "$1" ] && echo "Usage: $0 filepath-to-workspace.xml" >&2 && exit 1; | |
xmlpath="$1" | |
[ ! -f "$xmlpath" ] && echo File not found: $1 && echo "Usage: $0 filepath-to-workspace.xml" >&2 && exit 2; | |
cp "$xmlpath" "$xmlpath.bak" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This tool is 80% ChatGPT code. Just so you know. | |
error_reporting( -1 ); | |
ini_set('display_errors', 'on'); | |
// === CONFIGURATION === | |
$config = [ | |
'servers' => [ 'srv1.mail.example.com', 'srv2.mail.example.com', ], | |
'timeout' => 10, // seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"palette": { | |
"black": "#262B44", | |
"blue": "#4B95E9", | |
"green": "#59C9A5", | |
"orange": "#F07623", | |
"red": "#D81E5B", | |
"white": "#E0DEF4", | |
"yellow": "#F3AE35" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A script to generate a changelog by comparing composer packages and project commits. | |
# | |
# Disclaimer: | |
# - Using this script is at your own risk. This script only uses READ operations, but I still | |
# do not take any responsibility. | |
# | |
# License: | |
# - BSD 2-Clause — Free to use with attribution. No warranty provided. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Make local URLs domainless, for all styles and scripts, to combat CORS issues. | |
// Ideally, we fix this in .htaccess using conditional headers, but in case of nginx, that's not available. | |
add_filter( 'script_loader_src', 'make_local_urls_domainless', 10 ); | |
add_filter( 'style_loader_src', 'make_local_urls_domainless', 10 ); | |
function make_local_urls_domainless( $url ) { | |
global $wpdb; | |
$all_domains = $wpdb->get_col( "SELECT domain FROM {$wpdb->blogs} ORDER BY blog_id DESC" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Maybe login by cookie. | |
* This function will log in a user by their authentication cookie, if they have one. | |
* This will use a full authentication, so it is safe from cookie-faking. | |
* Cookie hijacking is still a possibility, however, that's a WordPress issue, not a plugin issue. | |
* (To combat this; prefix the salts in wp-config.php with $_SERVER['REMOTE_ADDR']. This is not watertight, | |
* but always better than not) | |
* | |
* Call this function in your `permission_callback`, or in case of `__return_true` in your `callback` for getting items. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# changes-to--php.ini.hbs | |
... | |
disable_functions = dns_get_record | |
... | |
auto_prepend_file = /path/to/the/dns_get_record_polyfill.php | |
... | |
# Changelog: | |
# - May 22nd, 2025; | |
# - - updated to support wildcard domain registrations, seems CloudFlare does not handle that themselves. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is a zsh script to automatically switch to the localwp shell when you enter a | |
# directory that contains a LocalWP website installation | |
# it is designed to trigger on any directory deeper or exactly the app/ folder of a localwp site. | |
# this code is FAR FROM perfect, but it works! Feel free to suggest/improve/etc | |
# | |
# this file is to be sourced in your .zshrc . | |
# | |
# Suggested install method: | |
# cd ~ ; mkdir -p .zsh ; git clone https://gist.github.com/f5c220b5e49baf0df4f5bbf5b7e76fdf.git .zsh/zsh-auto-localwp | |
# echo "source ~/.zsh/zsh-auto-localwp/zsh-auto-localwp.sh" >> ~/.zshrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cd "$(dirname $0)/.." | |
[ -z "$1" ] && echo "Usage: $0 command" && echo "commands:" && echo "make-pot : re-generate POT file from source" && echo "update-po : update PO files from POT file" && echo "make-mo : generate MO and l10n.php files from PO files" && exit 1 | |
# find textdomain from ./*php | |
for file in $(find . -name '*.php'); do | |
if grep -q "Text Domain:" "$file"; then | |
TEXTDOMAIN=$(grep -o "Text Domain:\s*\([^'\"]*\)" "$file" | sed "s/Text Domain:\s*\([^'\"]*\)/\1/") |
NewerOlder