Skip to content

Instantly share code, notes, and snippets.

View JoelLisenby's full-sized avatar
🐳
sploosh

Joel Lisenby JoelLisenby

🐳
sploosh
View GitHub Profile
@JoelLisenby
JoelLisenby / reset_wf_2fa_grace_period.md
Last active April 29, 2024 23:07
Reset 2FA Grace Period in WordFence from the database/phpmyadmin

If you find yourself locked out due to no 2FA, but you have access to your WordPress database you can increase your WordFence 2FA grace period by following the instructions below.

Needed items:

  • Your user ID (find in the wp_users table)
  1. Go to phpmyadmin, view the wp_usermeta table.
  2. Do a search for meta_key = wfls-grace-period-reset and user_id = [your user id]
  3. Update the value of this row to a future unix timestamp like now + 3600 seconds to give you a 1 hour grace period.
@JoelLisenby
JoelLisenby / linode_32G_setup.md
Last active February 20, 2024 17:48
linode_32G_setup

A Linode 32GB VPS configuration

Utilizing memcached (with php8.2-memcached) over localhost. We found a 5X improvement in speed from (15s to 3s) when viewing the events default view while logged in after enabling memcached in this way for The Events Ticktes/Calendar plugin when paired with WooCommerce.

Drop in object-cache.php to /wp-content/object-cache.php from: https://github.com/Automattic/wp-memcached

  • This script uses php8.2-memcache, not php8.2-memcached, but having both installed does not harm anything. They can both be installed safely.

/etc/mysql/mariadb.conf.d/50-server.cnf

@JoelLisenby
JoelLisenby / gcode.md
Last active January 17, 2024 17:40
TEVO Tarantula i3 - Start and End GCODE with bed leveling and low preheat to prevent oozing before print

Start GCODE

G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
M109 S160 ; Preheat nozzle lower temp
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
@JoelLisenby
JoelLisenby / vt_resize.php
Last active December 23, 2023 04:33 — forked from seedprod/vt_resize.php
Resize WordPress images on the fly vt_resize w/ multisite support
<?php
/*
* Resize images dynamically using wp built in functions.
* Update: Use WP_Image_Editor class instead of deprecated image_resize.
* Updated by Joel Lisenby (original function by Victor Teixeira)
*
* php 5.2+
*
* Example use:
*
<?php
// Example run:
// php -f get_wpengine_installs_status.php > installs.csv
//
// acquire your username and password from https://my.wpengine.com/profile/api_access
define('API_USERNAME','');
define('API_PASSWORD','');
$result_obj = run_query( 'https://api.wpengineapi.com/v1/installs' );
@JoelLisenby
JoelLisenby / wordpress_disable_comments_pingbacks.php
Last active May 4, 2023 16:58
Disable comments and pingbacks settings for all WordPress network sites
<?php
// Disables comments and pingbacks settings for all existing sites in a WordPress network
$sites = get_sites();
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
update_option( 'default_comment_status', 'closed' );
update_option( 'default_ping_status', 'closed' );
restore_current_blog();
}
@JoelLisenby
JoelLisenby / archlinux.md
Last active October 31, 2022 06:51
Arch Linux Install
@JoelLisenby
JoelLisenby / jbl_find_replace.php
Last active April 20, 2022 04:34
Find and Replace Title and Content for Specific Post Type in WordPress with WP_Query
<?php
/* Backup site first before using. This adds a menu to wp-admin so you can run the script.
*** Visiting this menu will automatically run the script!! ***
*/
add_menu_page(
'jbl Find Replace',
'jbl Find Replace',
'manage_options',
'jbl-find-replace',
'jbl_find_replace'
@JoelLisenby
JoelLisenby / functions.php
Last active February 19, 2022 20:36
Remove Flash of Unstyled Content in WordPress using SiteOrigin Page Builder and Mega Menu
<?php
function head_fouc_script() {
?>
<script>
document.body.style.setProperty("visibility", "hidden", "important");
</script>
<style>
#mega-menu-wrap-primary #mega-menu-primary { /* these IDs may differ depending on the name of your menu. */
visibility: inherit; /* mega menu sets visibility visible and shows if you don't set this */
@JoelLisenby
JoelLisenby / dyndns_linode.sh
Last active August 22, 2021 19:53
A simple Dynamic DNS script for use with crontab for Linode Domain DNS Records API using dig and linode-cli from python pip
#!/bin/bash
domainid=000000
recordid=0000000
wanip=`dig @resolver4.opendns.com myip.opendns.com +short`
oldip=`linode-cli domains records-view $domainid $recordid --text --no-header --format="target"`
if [ $oldip != $wanip ]
then
linode-cli domains records-update $domainid $recordid --target $wanip