Skip to content

Instantly share code, notes, and snippets.

View Digiover's full-sized avatar
💭
☕️

Jan Reilink Digiover

💭
☕️
View GitHub Profile
@Digiover
Digiover / cache_enabler_disk.class.php.patch
Created October 25, 2016 09:42
Diff for cache_enabler_disk.class.php to add wp_is_mobile() support to KeyCDN's Cache Enabler plugin
--- cache_enabler_disk.class.php.org 2016-09-26 07:24:22.000000000 +0200
+++ cache_enabler_disk.class.php 2016-10-24 16:33:54.145108306 +0200
@@ -24,7 +24,9 @@
*/
const FILE_HTML = 'index.html';
+ const FILE_HTML_MOBILE = 'index-mobile.html';
const FILE_GZIP = 'index.html.gz';
+ const FILE_GZIP_MOBILE = 'index-mobile.html.gz';
const FILE_WEBP_HTML = 'index-webp.html';
@Digiover
Digiover / make-readonly.php
Last active November 23, 2016 17:26
Make WordPress writable before, and read-only after, WordPress updates with this MU-Plugin
<?php
/**
* Plugin Name: Make Read Only &amp; Clear Read Only WordPress
* Plugin URI: https://www.saotn.org
* Description: Makes all WordPress files read-only after updates, and writable just before updates. This should ease WordPress updates when it's read-only on the file system. Please donate <a rel="nofollow" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=J24FGGU96YSUY" title="donate to Sysadmins of the North in Dollars">$2.50 USD</a> (or <a rel="nofollow" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=QLX4RPPL3L8LY" title="donate to Sysadmins of the North in Euros">&euro; 2,50 Euro</a>) through PayPal to support me in my research time and hosting costs.
* Network: True
* Version: 1.0
* Author: Jan Reilink
* Author URI: https://www.saotn.org
* License: GPLv2
@Digiover
Digiover / web.config
Created January 16, 2018 10:47
ASP.NET set httpOnly and RequireSSL cookies
<httpCookies httpOnlyCookies="true" requireSSL="true" />
<!-- With domain: <httpCookies domain="www.saotn.org" httpOnlyCookies="true" requireSSL="true" /> -->
@Digiover
Digiover / saotn-flush-memcached.php
Last active November 12, 2018 12:50
Flush PHP memcacheD cache in WordPress - Flushes PHP memcached cache upon publish_post action. By clearing the opcode cache in memory you immediately can see a new or changed post
<?php
/**
* Plugin Name: Flush MemcacheD cache
* Plugin URI: https://www.saotn.org/
* Donate URI: https://www.paypal.me/jreilink
* Description: Flushes PHP memcached cache upon publish_post action. By clearing the opcode cache in memory you immediately can see a new or changed post. Use as a Must-Use Plugin.
* Network: True
* Version: 1.2
* Author: Jan Reilink
* Author URI: https://www.saotn.org
@Digiover
Digiover / wp-database-tables-optimizer.php
Last active April 15, 2019 15:26
Optimizes WordPress database behind the scenes by executing an OPTIMIZE TABLE statement on all MySQL tables, 'daily' or 'hourly' as a WordPress Cron. More information @ https://www.saotn.org/optimize-wordpress-mysql-tables-cron/
<?php
/**
* Plugin Name: Saotn Database Table Optimizer
* Plugin URI: https://www.saotn.org
* Description: Optimizes WordPress database behind the scenes by executing an OPTIMIZE TABLE statement on all MySQL tables, 'daily' or 'hourly'. Please <a rel="nofollow" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=4EFPSXA623NZA" title="donate to Sysadmins of the North">donate $2.50 USD</a> through PayPal to support me in my research time and hosting costs.
* Version: 1.0.2
* Author: Jan Reilink
* Author URI: https://www.saotn.org
* License: GPLv2
*/
@Digiover
Digiover / use-http11-in-wordpress.php
Created April 30, 2020 09:24
Forces HTTP/1.1 for outgoing connections in WordPress instead of HTTP 1.0
<?php
/**
* Plugin Name: Use HTTP/1.1 in WordPress
* Plugin URI: https://www.saotn.org/
* Donate URI: https://www.paypal.me/jreilink
* Description: MU Plugin. Forces HTTP/1.1 for outgoing connections in WordPress instead of HTTP 1.0
* Network: True
* Version: 1.0
* Author: Jan Reilink
* Author URI: https://www.saotn.org
@Digiover
Digiover / README.md
Last active December 4, 2021 09:26 — forked from emnavarro02/README.md
Re-index the WSUS Database

The performance of large Windows Server Update Services (WSUS) deployments will degrade over time if the WSUS database is not maintained properly. The WSUSDBMaintenance script is a T-SQL script that can be run by SQL Server administrators to re-index and defragment WSUS databases. It should not be used on WSUS 2.0 databases.This script contributed by the Microsoft WSUS team.

If you are using Windows Internal Database, you will need to use the sqlcmd utility, which can be downloaded from docs.microsoft.com page for SQLCMD. This page will also contain additional information about the sqlcmd utility.

To use this script with Windows Internal Database, you should run the following command:

sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##WID\sql\query –i <scriptLocation>\WsusDBMaintenance.sql
@Digiover
Digiover / web.config
Created January 16, 2018 10:45
Encrypt ASP.NET ViewState
<machineKey
validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps"
validation="AES" decryption="Auto"
/>
@Digiover
Digiover / add-hsts-to-wordpress.php
Last active January 15, 2022 07:15
Add HSTS to WordPress using a send_headers action
<?php
/*
* https://www.saotn.org/enable-http-strict-transport-security-hsts-on-iis/
* follow me on Twitter: @Jan_Reilink
*/
add_action( 'send_headers', 'saotn_add_hsts_header' );
function saotn_add_hsts_header() {
header( 'Strict-Transport-Security: max-age=31536000; includeSubDomains; preload' );
}
@Digiover
Digiover / disable_php_script_execution.php
Last active January 15, 2022 07:16
Function to disable PHP script execution for WordPress wp-content/uploads folder
<?php
/**
* Disable PHP script execution for WordPress wp-content/uploads folder.
* - based off the WordPress permalinks rewrite code
*
* - https://www.saotn.org/secure-wordpress-uploads-folder-disable-php-execution/
* - follow me on twitter: @Jan_Reilink
*
* don't allow this file to be loaded directly
*/