Skip to content

Instantly share code, notes, and snippets.


Richard Szalay richardszalay

View GitHub Profile
richardszalay / extract-policy.js
Created Dec 5, 2016
Extract policy document as text in AWS
View extract-policy.js
document.querySelector('#policy_document .ace_scroller').innerText
View Copy-EC2SecurityGroupIngress.ps1
Copies all EC2 Security Group rules from one IP range to one or more other ranges, optionally removing the original IP's rules
Copies all EC2 Security Group rules from one IP range to one or more other ranges, optionally removing the original IP's rules
The AWS Region to apply the changes to
.PARAMETER CurrentIpRange
The IP Address or CIDR Range that should be used as a template when copying rules
richardszalay / PositionFixedNavBar-SC-Ext.js
Created Mar 24, 2017
Positioning a fixed header below the Sitecore Experience Editor ribbon
View PositionFixedNavBar-SC-Ext.js
// Repositions a position-fixed header so that it always appears under the SC experience editor ribbon
// includes added support for the Sitecore Extensions Chrome extension and its support for hiding the ribbon entirely
define(["sitecore"], function (Sitecore) {
return {
priority: 50,
execute: function (context) {
// TODO: Change this CSS selector to suit your application
// the 'cross piece' is a blank div that is sized to match the iframe content (where the actual ribbon is)
View Reset-BashPassword.ps1
# Resets the password for the default LXSS / WSL bash user, based on
$lxssUsername = (Get-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss).DefaultUsername
lxrun /setdefaultuser root
bash -c "passwd $lxssUsername"
lxrun /setdefaultuser $lxssUsername
View Win10-16257-Console-Colors.reg
Windows Registry Editor Version 5.00
richardszalay / Test-SitecoreAssemblyList.ps1
Last active Dec 29, 2017
View Test-SitecoreAssemblyList.ps1
Validates a Sitecore "Assembly list" (from against a folder
.PARAMETER AssemblyList
The assembly list text file downloaded from
.PARAMETER AssemblyFolder
The folder containing the Sitecore assemblies to validate
.PARAMETER CheckFileVersion
If set, also verifies the file version. Requires loading the assembly, so should be invoked in an isolated powershell environment
richardszalay / Update-SitecorePackages.ps1
Created Feb 26, 2018
Update Sitecore NuGet packages
View Update-SitecorePackages.ps1
# Updates from a specific version to avoid conflicting names ("Sitecore.Framework", "Sitecore.Ship", etc)
$SourceVersion = "9.0.171002"
# Does late filtering to avoid redundant upgrades for packages that have already been upgrades as dependencies. Big time saver
Get-Package | `
Where-Object { $_.Id -like "Sitecore.*" } | `
Foreach-Object {
$id = $_.Id
if ((Get-Package -ProjectName $_.ProjectName) | ?{ $_.Id -eq $id -and $_.Version -eq $SourceVersion}) {
Update-Package -Id $_.Id -ProjectName $_.ProjectName -Version HighestPatch # Use HighestMinor for a full point release
View Invoke-SitecoreCommerceBootstrap.psm1
function Invoke-SitecoreCommerceBootstrap {
[string]$Username = "sitecore\admin",
[string]$Password = "b",
[string]$IdentityServer = "https://localhost:5050",
[string]$OpsServer = "https://localhost:5015"
$ErrorActionPreference = "Stop"
richardszalay / DiagnosticBlock.cs
Created May 15, 2018
DiagnosticBlock for Sitecore Commerce
View DiagnosticBlock.cs
This block is designed to assist with diagnosing data/pipeline issues within Sitecore
services.Sitecore().Pipelines(config => config
.ConfigurePipeline<ICalculateSellableItemSellPricePipeline>(builder => builder
.Add<DiagnosticBlock<SellableItem>>("Before CalculateSellableItemListPriceBlock").Before<CalculateSellableItemSellPriceBlock>(),
order: 1001
View Patch-SitecoreCommercePolicySet.ps1
Updates the properties of one or more Sitecore Commerce policies in a policy set or environment json file.
# Patch all policies from another file
Patch-SitecoreCommercePolicySet -Path "path\to\policy.json" -SourcePath "path\to\source.json"
# Patch a specific policy from another file
Patch-SitecoreCommercePolicySet -Path "path\to\policy.json" -SourcePath "path\to\source.json" -PolicyType "Fully.Qualified.Type, With.Assembly.But.Spaces.Are.Ignored"