This file contains 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 | |
/** | |
* Plugin initialization file | |
* | |
* @package WP_Plugin_MU_Loader | |
* @since 1.0.0 | |
* | |
* @wordpress-plugin | |
* Plugin Name: WP Plugin MU Loader | |
* Plugin URI: https://gist.github.com/felixarntz/daff4006112b60dfea677ca08fc0b31c |
This file contains 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 will show you the size of post, revision, attachment and other fields in `wp_posts` | |
-- this method can be applied to any WordPress table to get a breakdown of clutter and data use | |
-- this will not get you index size, but WP indexes are typically a small fraction of overall table size | |
SELECT post_type | |
COUNT(*) AS NUM, -- adds a column with the number of rows for each key value for comparison | |
SELECT post_type, COUNT(*) AS NUM, | |
(SUM(LENGTH(ID) -- add all column data together to group the total row data by post_type | |
+LENGTH(post_author) | |
+LENGTH(post_date) | |
+LENGTH(post_date_gmt) |
This file contains 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
# Enter this command to create a sudoers override/include file: | |
# sudo visudo -f /etc/sudoers.d/nginx.overrides | |
# (Make sure you actually have this in your /etc/sudoers - Run `sudo visudo` to check) | |
# #includedir /etc/sudoers.d | |
# This file assumes your deployment user is `deploy` | |
# Nginx Commands | |
Cmnd_Alias NGINX_RESTART = /usr/sbin/service nginx restart |
This file contains 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
<?xml version="1.0"?> | |
<ruleset name="phpmd.xml" | |
xmlns="http://pmd.sf.net/ruleset/1.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" | |
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> | |
<description>PHPMD Ruleset for a WordPress Theme</description> | |
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" /> | |
<rule ref="rulesets/cleancode.xml/ElseExpression" /> | |
<rule ref="rulesets/cleancode.xml/StaticAccess" /> |
This file contains 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 | |
UP=$(pgrep mysql | wc -l); | |
if [ "$UP" -ne 1 ]; | |
then | |
echo "MySQL is down."; | |
sudo service mysql start | |
else | |
echo "All is well."; | |
fi |
This file contains 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 | |
# --- Version history --- | |
# 0.4: added variable to store file path, and $2 for base file name | |
# added variable to store desired reporting interval | |
# 0.3: added $1 to send in process ID at run time. | |
# 0.2: switched to $SECONDS for the loop. works. | |
# 0.1: didn't work well at all. | |
# --- Version history --- | |
# Usage: cputrack [PID] [filename] |