Skip to content

Instantly share code, notes, and snippets.

View MikeNGarrett's full-sized avatar
🤘
Rocking this project.

Mike Garrett MikeNGarrett

🤘
Rocking this project.
View GitHub Profile
@MikeNGarrett
MikeNGarrett / import-wp-users-by-role
Last active August 29, 2015 14:23
Add a list of WordPress users from a CSV
# CSV format: username, email, password
export IFS=","; cat /path/to/test.csv | while read a b c; do wp user create $a $b --user_pass=$c --role=administrator; done
@MikeNGarrett
MikeNGarrett / siege
Last active April 3, 2024 03:49
Siege with JSON POST data
# Changed to use content-type flag instead of header: -H 'Content-Type: application/json'
siege -c50 -t60S --content-type "application/json" 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}'
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active April 26, 2024 10:15
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@MikeNGarrett
MikeNGarrett / 404s.sh
Created November 18, 2015 22:50
Go and get the most frequent 404s
grep "HTTP/1.1\" 404" access.log | awk '{print $7 } ' | sort | uniq -c | sort -n
@MikeNGarrett
MikeNGarrett / gist:40059cae93fa8311ce5c39caaefb8594
Created May 3, 2016 14:46
Acquia DevDesktop Drush Location
$ # If you're using Drush with MAMP and DevDesktop, you'll have to either change your bash profile or (my preference) specify the path to the correct instance of Drush.
$ # This solves the "Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command" issue.
$ /Applications/DevDesktop/drush/drush
─────────▄──────────────▄────
────────▌▒█───────────▄▀▒▌───
────────▌▒▒▀▄───────▄▀▒▒▒▐───
───────▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐───
─────▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐───
───▄▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀██▀▒▌───
──▐▒▒▒▄▄▄▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄▒▒▌──
──▌▒▒▐▄█▀▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐──
─▐▒▒▒▒▒▒▒▒▒▒▒▌██▀▒▒▒▒▒▒▒▒▀▄▌─
─▌▒▀▄██▄▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌─
@MikeNGarrett
MikeNGarrett / siege-ab.sh
Last active December 19, 2016 04:07
Load Testing Examples
# Siege attempts to recreate real traffic by using a CSV of urls to hit.
# This allows you to remove requests for assets, if you're running a CDN.
#
# c = concurrent users
# i = "like the internet would visit"
# b = benchmark (no delay needed)
# t = time
# f = file with urls 1 per line
siege -c100 -i -b -t120S -f urls.csv
@MikeNGarrett
MikeNGarrett / Contract Killer 3.md
Last active September 19, 2016 15:16 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@MikeNGarrett
MikeNGarrett / categories.txt
Created September 22, 2016 15:46
iOS 10 App Store iMessages Sticker Categories
Animals & Nature
Art
Celebrations
Celebrities
Comics & Cartoons
Eating & Drinking
Emoji & Expressions
Fashion
Gaming
Kids & Family
@MikeNGarrett
MikeNGarrett / wp-cli-install-rec-plugins
Last active July 12, 2021 07:18
Chained WordPress CLI commands to install and activate recommended plugins.
# wordpress-seo provides ability to edit meta information and provides sitemap.
# w3-total-cache provides advanced caching no matter the server technology available.
# better-wp-security provides brute force protection and a number of WordPress enhancements.
# google-analytics-for-wordpress provides robust Google Analytics integration through the Google API.
# redirection detects 404s and 301s and allows admins to set up redirects in the WP admin.
# ewww-image-optimizer provides automatic optimization of uploaded images with local libraries instead of cloud-based services.
# backupwordpress simple backup solution that can store backups above web root.
# relevanssi provides better site search using a local index.
# cloudflare is the best. Free automatic CDN and security solution.
# jarvis is a quick search for the WordPress admin. Indespensible.