Skip to content

Instantly share code, notes, and snippets.

View MartinMiles's full-sized avatar

Martin Miles MartinMiles

View GitHub Profile

Kubectl plugin

This plugin adds completion for the Kubernetes cluster manager, as well as some aliases for common kubectl commands.

To use it, add kubectl to the plugins array in your zshrc file:

plugins=(... kubectl)
@MartinMiles
MartinMiles / z.ExternalDatabase.config
Created August 7, 2024 17:52
XM Cloud config to plug external database via SQL containers
<?xml version="1.0" encoding="UTF-8"?>
<configuration
xmlns:patch="www.sitecore.net/.../">
<sitecore>
<eventing defaultProvider="sitecore">
<eventQueueProvider>
<eventQueue name="rrh" patch:after="evertQueue[@name='web']" type="Sitecore.Data.Eventing.$(database)EventQueue, Sitecore.Kernel">
<param ref="dataApis/dataApi[@name='$(database)']" param1="$(name)" />
<param ref="PropertyStoreProvider/store[@name='$(name)']" />
</eventQueue>
# Define the folder path
$folderPath = "master:/sitecore/media library"
# Get all child media items recursively
$mediaItems = Get-ChildItem -Path $folderPath -Recurse -Language * -ErrorAction SilentlyContinue
# Calculate total size (in bytes) using the "Size" field
$totalSizeInBytes = 0
foreach ($item in $mediaItems) {
@MartinMiles
MartinMiles / Responsive-Nav.html
Created January 27, 2025 07:26
Just a responsive navigation bar for desktop and mobile layout
<!DOCTYPE html>
<html>
<head>
<style>
.navbar {
overflow: hidden;
background-color: #333;
}
.navbar a {
@MartinMiles
MartinMiles / Sitemap.aspx
Last active May 3, 2025 16:21
Admin folder tool for XM Cloud to regenerate the sitemap media library item in a development environment + sitemap generation at Next.js
<%@ Page language="c#" %>
<%@ Import Namespace="Microsoft.Extensions.DependencyInjection" %>
<%@ Import Namespace="Sitecore.Abstractions" %>
<%@ Import Namespace="Sitecore.Configuration" %>
<%@ Import Namespace="Sitecore.Data" %>
<%@ Import Namespace="Sitecore.Data.Items" %>
<%@ Import Namespace="Sitecore.DependencyInjection" %>
<%@ Import Namespace="Sitecore.Events" %>
<%@ Import Namespace="Sitecore.Globalization" %>
<%@ Import Namespace="Sitecore.Pipelines" %>