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
# https://www.saotn.org/aspnet-performance-what-to-keep-in-mind/#highdensitywebhosting | |
$bitness = @("64", "") | |
foreach ($bits in $bitness) { | |
$xml = New-Object xml | |
$xml.Load("C:\Windows\Microsoft.NET\Framework${bits}\v4.0.30319\Aspnet.config") | |
# Check whether the runtime control gcTrimCommitOnLowMemory is already registered | |
$nodeGcTrimCommitOnLowMemory = $xml.SelectSingleNode("configuration/runtime/gcTrimCommitOnLowMemory") |
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
# https://www.saotn.org/aspnet-performance-what-to-keep-in-mind/#highdensitywebhosting | |
$bitness = @("64", "") | |
foreach ($bits in $bitness) { | |
$xml = New-Object xml | |
$xml.Load("C:\Windows\Microsoft.NET\Framework${bits}\v4.0.30319\Aspnet.config") | |
# Check whether HighDensityWebHosting performanceScenario is already registered | |
$nodePerformanceScenario = $xml.SelectSingleNode("configuration/performanceScenario") |
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
# Add to your PS profile to create random strings / secure passwords | |
# from within your PowerShell shell. | |
# | |
# Source / Author: Daniel Kåven | |
# https://teams.se/powershell-script-generate-a-random-password/ | |
function Get-RandomString { | |
param ( | |
[CmdletBinding(PositionalBinding=$false)] | |
[Parameter(Position=0)] | |
[ValidateRange(8, 256)] |
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
# Query Win32_PerfRawData_W3SVC_WebService for all metric labels (names), including all website names hosted in IIS | |
# | |
# The Web Service object includes counters specific to the World Wide Web Publishing Service. | |
(Get-CimInstance -EA SilentlyContinue -Query "select * from Win32_PerfRawData_W3SVC_WebService" -Namespace root\cimv2).Name | |
# https://www.saotn.org/monitor-website-performance-in-iis-with-zabbix/ |
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
# Import a PFX certificate into Windows Server and change its | |
# FriendlyName property in PowerShell. | |
# | |
# Using Get-Credential here ensures the password doesn't get saved | |
# into PowerShell's history file. | |
# -- see https://www.saotn.org for more PowerShell goodness :) | |
# | |
$CommonName = "CHANGEME" | |
$CertFileName = "CHANGEME.pfx" |
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 Name: Clear PHP opcode caches | |
* Plugin URI: https://www.saotn.org/wordpress-plugin-flush-php-opcache/ | |
* Donate URI: https://www.paypal.me/jreilink | |
* Description: Purges various PHP opcode and user caches. Currently it tries to clear / purge / flush PHP OPcache and WinCache caches from your web server's memory. This should ease WordPress updates and plugin activation / deactivation. | |
* Network: True | |
* Version: 1.2 | |
* Author: Jan Reilink | |
* Author URI: https://www.saotn.org |
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
/** | |
* Executes an OPTIMIZE TABLE statement on all WordPress database | |
* tables. | |
*/ | |
public static function saotn_wpdb_optimizer() { | |
global $wpdb; | |
$tables = $wpdb->get_col( "SHOW TABLES" ); | |
foreach ( $tables as $table ) { | |
$wpdb->query( "OPTIMIZE TABLE $table" ); | |
} |
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
# Ansible can use a custom ssh config file if you configure its | |
# ANSIBLE_SSH_ARGS environment variable. Add to your `~/.bashrc` | |
# | |
# source: Windows 11/10 and WSL 2 DevOps environment | |
# - Sysadmins of the North | |
# https://www.saotn.org/windows-11-10-and-wsl-2-devops-environment/ | |
# | |
export ANSIBLE_SSH_ARGS="-F ~/.ssh/wsl_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
-- Clean WordPress Post Meta Data | |
SELECT * FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL; | |
DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL; | |
-- Clean WordPress Comment Meta Data | |
SELECT * FROM wp_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM wp_comments ); | |
DELETE FROM wp_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM wp_comments ); | |
SELECT * FROM wp_commentmeta WHERE meta_key LIKE '%akismet%'; | |
DELETE FROM wp_commentmeta WHERE meta_key LIKE '%akismet%'; |
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 | |
/** | |
* PHP/cURL function to check a web site status. If HTTP status is not 200 or 302, or | |
* the requests takes longer than 10 seconds, the website is unreachable. | |
* | |
* Follow me on Twitter: @Jan_Reilink | |
* | |
* @param string $url URL that must be checked | |
*/ | |
function url_test($url) { |
NewerOlder