Skip to content

Instantly share code, notes, and snippets.

View dsolovay's full-sized avatar

Dan Solovay dsolovay

View GitHub Profile
@dsolovay
dsolovay / Make_IdentityServer.ps1
Last active September 14, 2021 19:02
SIF for creating a duplicate ID server (for dev testing, plugin development, etc.)
# A subset of XP0_SingleDeveloper.ps1 for creating duplicate ID servers for plugin development.
# Note values marked "UPDATE FROM EXISTING" should be updated based on a working starting point ID server (installed using SIF or the
# graphical installer).
# The Prefix that will be used on SOLR, Website and Database instances.
$Prefix = "UPDATE FROM EXISTING"
# The root folder with the license file and WDP files.
$SCInstallRoot = "C:\ResourceFiles"
@dsolovay
dsolovay / ExtractGuids.ps1
Last active October 27, 2021 18:57
Get IDs from Sitecore 10.1 Upgrade scripts
Param(
# Input file
[Parameter()]
[String]
$InputFile,
[Parameter()]
[Switch]
$FormatForSql
)
$output = Get-Content $InputFile | % {[Regex]::match($_, "^.{36}(.{36})").Groups[1].Value}
@dsolovay
dsolovay / ContactInfo.aspx
Created November 13, 2020 20:08
Get xConnect Contact ID (for use in Experience Profile, etc.)
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Session Info</title>
</head>
<body>
<h1>Session Info</h1>
@dsolovay
dsolovay / Dockerfile
Last active April 30, 2020 01:08
Add Braintree settings to Commerce Engine image
ARG BASE_IMAGE
FROM $BASE_IMAGE
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
ARG BRAINTREE_ENVIRONMENT
ARG BRAINTREE_MERCHANT_ID
ARG BRAINTREE_PUBLIC_KEY
ARG BRAINTREE_PRIVATE_KEY
RUN $json = Get-Content "C:\inetpub\wwwroot\wwwroot\data\Environments\PlugIn.Payments.Braintree.PolicySet-1.0.0.json" | ConvertFrom-Json; \
$json.Policies.'$values'[0].Environment = $env:BRAINTREE_ENVIRONMENT; \
@dsolovay
dsolovay / WriteShowConfigToLog.config
Last active March 28, 2023 16:21
Write ShowConfig to log
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="Sitecore.SharedSource.Pipelines.WriteShowConfigToLog.Processor, Sitecore.SharedSource.WritreShowConfig" patch:before="processor[1]"/>
</initialize>
</pipelines>
</sitecore>
</configuration>
@dsolovay
dsolovay / ComparePackagesAndProjects.ps1
Last active August 16, 2017 14:38
Getting CodeGenData items
$csprojdirs = gci . -recurse -filter "*.csproj" | %{[System.IO.Path]::GetDirectoryName($_.FullName)} |sort|unique
$packagedirs = gci . -recurse -filter "packages.config" | %{[System.IO.Path]::GetDirectoryName($_.FullName)} |sort|unique
compare-object -referenceobject $csprojdirs -differenceobject $packagedirs
@dsolovay
dsolovay / DeleteSolrCores.ps1
Created November 5, 2016 02:48
Powershell script to delete solr cores that start with a prefix
param ($prefix = $(throw "-prefix is required"))
$client = (New-Object System.Net.WebClient)
[xml]$coresXML = $client.DownloadString("http://localhost:8983/solr/admin/cores")
$cores = $coresXML.response.lst[2].lst | % {$_.name}
$success = 0
$error = 0
foreach ($core in $cores) {
@dsolovay
dsolovay / HomeControllerTests.cs
Created August 8, 2016 19:09
Demo of adding functionality to MVC controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using FluentAssertions;
@dsolovay
dsolovay / ShardTest.ps1
Last active February 15, 2024 21:25
Create MongoDB replica sets, shards, and test data
# Powershell Script for creating a 3x5 shard cluster
# Based on Mongo University M101 lecture, "Building a Shared Environemnt" https://youtu.be/dn45G2yw20A
$rootpath = "/temp/mongoshards/"
new-module -scriptblock {function report($text) {
write-output $("-" * $text.length)
write-output $text
write-output $("-" * $text.length)
write-output ""
// Demonstration code for StackOverflow question: http://stackoverflow.com/questions/33301106/query-lucene-index-against-ienumerable-field
// Shows that a field can be ignored from mapping and used in a linq query.
// Paste code into /sitecore/admin/linqscratchpad.aspx
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;