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 | |
# Injest / setup vars // TODO: error handling needed | |
client_id=$( cat parsedmarc/credentials.json | jq -r '.installed.client_id' ) | |
client_secret=$( cat parsedmarc/credentials.json | jq -r '.installed.client_secret' ) | |
scope="https://www.googleapis.com/auth/gmail.modify" | |
echo | |
echo "This script will take your OAuth Desktop Application credentials.json and use it to get a token to interact with the API" | |
sleep 2 |
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
/** | |
* Scan Gravity Forms uploads with ClamAV | |
* Based on 'Custom Scan AV function by Kris Chase' | |
* https://krischase.com/detect-and-prevent-malware-in-gravity-forms-file-upload-with-php-clamav/ | |
* Requires clamav and php-clamav installed and enabled | |
*/ | |
function myfunc_uploads_clamav( $validation_result ) { | |
if ( $_FILES ) { | |
$form = $validation_result['form']; |
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 -e | |
# | |
# Description: | |
# This will deploy WordPress in the current directory. | |
# Without modification it: | |
# - will configure basic security: | |
# - remove initial user created | |
# - deploy 6G firewall in .htaccess | |
# - attempt to prevent user enumeration in .htaccess | |
# - protect sensitive files and disallow executables in /wp-uploads |
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 | |
# vars | |
default_workdir=~/phpcompatabilitytest | |
default_targetversion="8.1" | |
default_ignore="*/vendor/*,*/sites/*,*/tests/*" | |
default_testdir="/var/www" | |
phpcsconfigfile="CodeSniffer.conf" | |
# config |
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 -e | |
clear | |
echo "============================================" | |
echo "WordPress Install Script" | |
echo "============================================" | |
echo "Do you need to setup new MySQL database? (y/n)" | |
read -e setupmysql | |
if [ "$setupmysql" == y ] ; then | |
echo "MySQL Admin User: " | |
read -e mysqluser |
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 | |
# Help / usage info. | |
USAGE=$'WordPress Helper script, built for EasyEngine but should be widely compatible.\nWithout any args it will search /var/www/ for WordPress sites, loop over them in alphabetical order and check for core and plugin updates.\nAlso accepts:\n\t--sites=[space seperated list of site paths relative to /var/www]\n\t--update=[plugins|wp|all].' | |
# Die function for exiting on errors. | |
die () { | |
echo "${1}, exitting..." >&2 ; echo ; exit 1 | |
} |
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
SELECT | |
wp_posts.post_title AS Product, | |
wp_postmeta1.meta_value AS SKU, | |
wp_postmeta2.meta_value AS Price, | |
GROUP_CONCAT( wp_terms.name ORDER BY wp_terms.name SEPARATOR ', ' ) AS ProductCategories | |
FROM wp_posts | |
LEFT JOIN wp_postmeta wp_postmeta1 | |
ON wp_postmeta1.post_id = wp_posts.ID | |
AND wp_postmeta1.meta_key = '_sku' | |
LEFT JOIN wp_postmeta wp_postmeta2 |
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
/** | |
* Filter the_time and get_the_date to return a relative string. | |
* Inspired by http://www.jasonbobich.com/2011/04/10/a-better-way-to-add-time-ago-to-your-wordpress-theme/ | |
* Based on code from https://buddypress.trac.wordpress.org/browser/tags/2.8.2/src/bp-core/bp-core-functions.php#L1118 | |
* | |
* @param string $formatted The formatted time. | |
* @param string $format The time format used. | |
* @param object $the_post Optional - current Post object. | |
* @return string Modified formatted time. | |
*/ |
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 | |
# No conflict, changes in branch time order. | |
mkdir merge-conflict1 | |
cd merge-conflict1 | |
git init | |
touch test1.sh | |
git add test1.sh | |
echo $'Start\nOne\n\n\n\nTwo\n\n\n\nThree\n\n\n\nFour\n\n\n\nEnd' > test1.sh | |
git commit -am 'initial commit on master test1.sh' |
NewerOlder