Skip to content

Instantly share code, notes, and snippets.

View davepullig's full-sized avatar

Dave Pullig davepullig

View GitHub Profile
@davepullig
davepullig / gist:efddb9a894e0c4a824b4b61183cfb01c
Last active July 3, 2024 08:19
WP CLI search and replace URLs for WordPress multisite
wp search-replace --network --url=website.dev website.dev website.tld --precise --all-tables
@davepullig
davepullig / gist:81bc67301490d4865107a91e49be5803
Created September 28, 2017 07:30
Strip the audio track from a video using ffmpeg
ffmpeg -i homepage_with_audio.mp4 -vcodec copy -an homepage.mp4
@davepullig
davepullig / gist:4a8b4e88b2d90b179a9419294f38a7a2
Last active October 24, 2021 13:15
Get the top 50 visiting class-C networks from nginx log files.
cat access.log | cut -d "." -f 1,2,3 | sort -n -t. -k1,1 -k2,2 -k3,3 | uniq -c | sort -n -r -s | head -n 50
@davepullig
davepullig / gist:1b3d723487b4f4b75b6282bce5dd9b44
Created October 22, 2021 11:13
Average memory usage of a php-fpm process
ps --no-headers -o "rss,cmd" -C php-fpm7.4 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
@davepullig
davepullig / gist:595c9e3ff78d609fb7e69f5f335f846f
Created October 25, 2021 10:16
Totals for hit/miss/bypass etc when using DM's modified log format
awk '{print $3}' ~/logs/access.log | sort | uniq -c | sort -r
"""
daves_utils.py
Extra stuff for Indigo
"""
import indigo
import datetime
import time
@davepullig
davepullig / gist:64c79a70f054674a1e3edac5e3b9cca3
Created June 14, 2022 19:05
Use Stripe CLI for local testing against a site hosted on VVV
stripe listen --forward-to 192.168.56.4:443/\?wc-api=wc_stripe --headers "Host: https://hostname.test"
@davepullig
davepullig / gist:062eedc77d2d617e596c94a0c95702db
Created July 19, 2022 15:07
Get a list of WordPress roles and their capabilities in a format that can be used in code.
var_export(wp_roles()->roles,true);
@davepullig
davepullig / gist:21e03dba4db37c74bfcc9d9a085d409b
Created June 28, 2023 09:54
Create a snippet to add to composer.json for existing WordPress plugins; useful when importing sites - you'll need wpackagist setup. Any plugins not in the w.org repo will fail, if you don't exclude them as per gf. You'll need to remove the trailing comma from the last line.
wp plugin list --field=name | grep -wv "gravityforms\|sdwd-lms" | xargs -i echo "\"wpackagist-plugin/{}\" : \"@stable\","