Skip to content

Instantly share code, notes, and snippets.

gbot gbot

Block or report user

Report or block gbot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gbot
gbot / hash_password.php
Created Oct 16, 2018
Hash a string with PHP's password_hash() function.
View hash_password.php
<?php
// Hash a password
// by Gavin Botica
// requires PHP 5.5+
define("RQD_PHP_VER", "5.5");
// check php version
if (version_compare(PHP_VERSION, RQD_PHP_VER) == -1 ) {
echo "<p><b>ERROR:</b> PHP <i>" . RQD_PHP_VER . "</i> required. Version <i>" . PHP_VERSION . "</i> installed.</p>";
@gbot
gbot / wp_offload_media_db_migrate.json
Last active Nov 18, 2019
Migrate a WordPress database so that existing media items are served from Amazon S3 or CloudFront. Requires the WP Offload S3 Lite plugin.
View wp_offload_media_db_migrate.json
{
"use_https": "",
"purge_amazonS3_info": ""
}
@gbot
gbot / wp-xmlrpc-jail.local
Last active Nov 19, 2018
Fail2Ban WordPress XMLRPC Jail and Filter. Notes: log path is set for Plesk v12.x. Change this to appropriate path for your set up. Only works if WordPress is installed in webroot, edit the Filter failregex if installed in sub-directory.
View wp-xmlrpc-jail.local
[wp-xmlrpc]
enabled = true
filter = wp-xmlrpc
action = iptables-multiport[name=wp-xmlrpc, port="http,https"]
logpath = /var/www/vhosts/system/*/logs/*access*log
/var/log/httpd/*access_log
bantime = 86400
maxretry = 0
@gbot
gbot / woocommerce-login-logout-redirects.php
Last active Nov 12, 2019
WP: Redirect to home page for WooCommerce login and logout. #ST3
View woocommerce-login-logout-redirects.php
/*----------------------------------------------------------------------------*/
// redirects for login / logout
/*----------------------------------------------------------------------------*/
add_filter('woocommerce_login_redirect', 'login_redirect');
function login_redirect($redirect_to) {
return home_url();
}
@gbot
gbot / wp-login-jail.local
Last active Oct 10, 2015
Fail2Ban WordPress login failure Jail and Filter. Notes:The log path uses 'access*_log' to monitor http and https logins. This will only work if WordPress is installed the webroot. Tweaking the failregex would be required to work with installs in sub-directories.
View wp-login-jail.local
[wp-login]
enabled = true
filter = wp-login
action = iptables-multiport[name=wp-login, port="http,https"]
sendmail[dest="name@domain.com", sendername="Fail2Ban", sender="fail2ban", name="wp-login"]
logpath = /var/www/vhosts/system/*/logs/access*_log
maxretry = 5
findtime = 60
bantime = 1200
@gbot
gbot / WP-Stack-CDN-config.php
Last active Mar 22, 2016
WP: WP Stack CDN config #ST3
View WP-Stack-CDN-config.php
/*
======================================
WP Stack CDN config
======================================
https://github.com/markjaquith/WP-Stack
*/
//define ('WP_STAGE', 'production'); // production OR staging
// define your STAGING domain
You can’t perform that action at this time.