Skip to content

Instantly share code, notes, and snippets.

@ThomPuiman
ThomPuiman / xConnect.Identify.aspx
Created December 9, 2020 07:20
Sitecore 9/10 - Quickly identify contact and set facets
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="xConnect.Identify.aspx.cs" Inherits="HeadlessTraining.sitecore.admin.xConnect_Identify" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
@ThomPuiman
ThomPuiman / prepare-sitecore-k8s.ps1
Last active June 29, 2021 01:52
Sitecore Kubernetes - Generate Self Signed Certificate and fill out secrets
$prefix = ""
function ConvertTo-CompressedBase64String {
[CmdletBinding()]
Param (
[Parameter(Mandatory)]
[ValidateScript({
if (-Not ($_ | Test-Path) ) {
throw "The file or folder $_ does not exist"
}
@ThomPuiman
ThomPuiman / sc-license-base64.ps1
Created August 12, 2020 05:50
Sitecore K8s Convert License file to base64
function ConvertTo-CompressedBase64String {
[CmdletBinding()]
Param (
[Parameter(Mandatory)]
[ValidateScript({
if (-Not ($_ | Test-Path) ) {
throw "The file or folder $_ does not exist"
}
if (-Not ($_ | Test-Path -PathType Leaf) ) {
throw "The Path argument must be a file. Folder paths are not allowed."
@ThomPuiman
ThomPuiman / app-service-add-ip-restriction.ps1
Created September 3, 2019 05:16
Add IP Restrictions to all Sitecore roles on Azure App Services
$resourceGroupNames = @("")
$includeContentDeliveryServer = $TRUE
$allowIpAddress = @(
""
)
#copy pasted the function Add-AzureIpRestrictionRule from: https://about-azure.com/2018/11/26/configure-azure-app-service-ip-restrictions-using-powershell/
function Add-AzureIpRestrictionRule
{
@ThomPuiman
ThomPuiman / deploy-paas.psm1
Created July 10, 2017 10:01
Script to deploy Sitecore to Azure PaaS using Sitecore Azure Toolkit
Function GenerateIncrementalPackage {
[CmdletBinding(SupportsShouldProcess = $true)]
param(
#The full path to the Sitecore Azure Toolkit
[Parameter(Mandatory = $true)]
[string]$toolsPath,
#Sitecore directory (containing Website, Data and Databases folder)
[Parameter(Mandatory = $true)]
[string]$sitecorePath,
from collections import Counter
import re
from itertools import combinations, product,permutations
import threading
def groupChars(inputChars):
c = Counter(inputChars)
return [ [k,]*v for k, v in sorted(c.items())]
def listEqual(listA, listB):
from collections import Counter
import re
def groupChars(inputChars):
c = Counter(inputChars)
return [ [k,]*v for k, v in sorted(c.items())]
def listEqual(listA, listB):
if len(listA) != len(listB):
return False
reqs = input()
if len(reqs) > 0:
splitted = reqs.split(" ")
chairWeightReq = int(splitted[0])
porridgeTempReq = int(splitted[1])
availableChairs = []
currentInput = input()
while len(currentInput) > 0:
@ThomPuiman
ThomPuiman / graph-search.cs
Created February 15, 2017 09:13
Graph search algorithm C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace GraphsTest
{
class Program
{
static void Main(string[] args)
{
from enum import Enum;
class DoorState(Enum):
CLOSING = 1
CLOSED = 2
STOPPED_WHILE_CLOSING = 3
OPEN = 4
OPENING = 5
STOPPED_WHILE_OPENING = 6
EMERGENCY_OPENING = 7