Skip to content

Instantly share code, notes, and snippets.

:shipit:
127.0.0.1

Kam Figy kamsar

:shipit:
127.0.0.1
Block or report user

Report or block kamsar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kamsar
kamsar / anexample.ps1
Last active Nov 13, 2019
Generate trusted local SSL cert for Solr
View anexample.ps1
# Usage:
# This script is designed to be run after you have Solr running locally without SSL
# It will generate a trusted, self-signed certificate for LOCAL DEV (this must be modified for production)
# Notes: The keystore must be under server/etc on Solr root, and MUST be named solr-ssl.keystore.jks
# The cert will be added to locally trusted certs, so no security warnings in browsers
# You must still reconfigure Solr to use the keystore and restart it after running this script
#
# THIS SCRIPT REQUIRES WINDOWS 10 (for the SSL trust); without 10 remove the lines around trusting the cert.
@kamsar
kamsar / msbuild.ps1
Last active Jul 17, 2019
PowerShell to resolve MSBuild.exe on VS2017 or VS2015 (or with Build Tools 2015)
View msbuild.ps1
function Resolve-MsBuild {
$msb2017 = Resolve-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\*\*\MSBuild\*\bin\msbuild.exe" -ErrorAction SilentlyContinue
if($msb2017) {
Write-Host "Found MSBuild 2017 (or later)."
Write-Host $msb2017
return $msb2017
}
$msBuild2015 = "${env:ProgramFiles(x86)}\MSBuild\14.0\bin\msbuild.exe"
View install-new-computer-tools-n-stuff.md

This uses Chocolatey and Boxstarter to install a loadout for Sitecore/.NET development on a new computer. Click the link below to start a click-to-run that does all the things. It's that easy. Fork the gist and alter the link below to customize for your own usage!

Click here to start install

@kamsar
kamsar / BenchmarkHabitatBuild.cmd
Last active Jan 4, 2018
Benchmark script to test actions on Sitecore instances
View BenchmarkHabitatBuild.cmd
@echo off
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Clean /nr:false
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Build /nr:false
echo Take note of the timing above, this is the CLEAN BUILD time
pause
"%PROGRAMFILES(x86)%\MSBuild\14.0\bin\msbuild.exe" "Habitat.sln" /p:Configuration=Debug /m /t:Build /nr:false
@kamsar
kamsar / SwitchMasterToWeb.config
Created Dec 5, 2016
Sitecore 8.2 Update 1 SwitchMasterToWeb.config
View SwitchMasterToWeb.config
<?xml version="1.0" encoding="utf-8" ?>
<!--
Purpose: This include file simplifies the setup of Sitecore CD instances by removing any references to the Master database from Sitecore configuration files.
This include file should be used only on CD servers.
Important: Include files are applied in alphabetical order. The include files in root folder are applied before the include files in the subdirectories.
The subdirectories are applied in alphabetical order. Therefore this include file cannot remove any references to the Master database
that are defined in include files that are applied later. In this situation, you must rename this include file so that it is applied after
@kamsar
kamsar / ServiceCollectionExtensions.cs
Last active Jun 5, 2018
Automatically register controllers with Sitecore 8.2 IoC container
View ServiceCollectionExtensions.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Web.Mvc;
using Microsoft.Extensions.DependencyInjection;
@kamsar
kamsar / Install Solr.ps1
Last active Feb 26, 2019
Sitecore Solr Cannon
View Install Solr.ps1
# This script will set up (and install if needed) Apache Solr for a Sitecore instance.
# This does NOT configure Sitecore to use Solr,
# just the Solr server and cores for Sitecore to connect to once it is set up to use Solr.
# So, what does it do?
#
# * Installs SOLR, if needed, from the Bitnami SOLR stack: https://bitnami.com/stack/solr/installer
# * Creates a SOLR config set for the cores to share (shared schema)
# * Creates SOLR cores for all Sitecore indexes, including secondary cores to support online reindexing (Switch on Rebuild)
@kamsar
kamsar / SwitchMasterToWeb.config
Created Oct 29, 2015
Sitecore 8.1 SwitchMasterToWeb Patches
View SwitchMasterToWeb.config
<?xml version="1.0" encoding="utf-8" ?>
<!--
Purpose: This include file simplifies the setup of Sitecore CD instances by removing any references to the Master database from Sitecore configuration files.
This include file should be used only on CD servers.
Important: Include files are applied in alphabetical order. The include files in root folder are applied before the include files in the subdirectories.
The subdirectories are applied in alphabetical order. Therefore this include file cannot remove any references to the Master database
that are defined in include files that are applied later. In this situation, you must rename this include file so that it is applied after
@kamsar
kamsar / Performance.Dev.config
Last active Aug 16, 2019
SItecore 8.0/8.1/8.2 Performance Config
View Performance.Dev.config
<!--
A set of performance optimizations for development that vastly increase application startup time.
Should not be used in production, as they largely disable forensic diagnostics that you'd want there over fast startup time after a compile.
-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<hooks>
<hook type="Sitecore.Diagnostics.HealthMonitorHook, Sitecore.Kernel">
<patch:delete />
@kamsar
kamsar / Benchmark.cs
Created Jun 11, 2015
Synthesis mapping performance
View Benchmark.cs
var items = Sitecore.Context.Database.GetRootItem().Axes.GetDescendants();
Response.Write("<h1>{0} Items</h1>".FormatWith(items.Length));
var sw = new Stopwatch();
sw.Start();
var displayNamesScapi = items.Select(item => item[FieldIDs.DisplayName]).ToList();
sw.Stop();
You can’t perform that action at this time.