Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kamsar's full-sized avatar
:shipit:
127.0.0.1

Kam Figy kamsar

:shipit:
127.0.0.1
View GitHub Profile
@kamsar
kamsar / msbuild.ps1
Last active April 11, 2024 02:14
PowerShell to resolve MSBuild.exe on VS2017 or VS2015 (or with Build Tools 2015)
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"
@kamsar
kamsar / anexample.ps1
Last active October 18, 2023 14:27
Generate trusted local SSL cert for Solr
# 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 / async.cs
Created October 29, 2013 02:02
Demonstration of using async to grab a bunch of Sitecore queries in parallel Performance on a dual-core machine appeared to be 30-100% faster than iterative.
using System.Linq;
using Isite.Sitecore.UI.WebControls;
using Isite.Extensions;
using System.Web.UI;
using System.Threading.Tasks;
using Sitecore.Data.Items;
using System.Collections.Generic;
using System.Threading;
using Sitecore.Caching;
using System.Diagnostics;
#
# MongoDB (as a windows service)
#
$mongoDbPath = "$env:SystemDrive\MongoDB"
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg"
$url = "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-3.2.7.zip"
$zipFile = "$mongoDbPath\mongo.zip"
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-3.2.7"
if ((Test-Path -path $mongoDbPath) -eq $false)
@kamsar
kamsar / MultiRootTreeList.cs
Created May 5, 2015 23:43
Multi-Root TreeList
using System;
using System.Linq;
using Sitecore.Diagnostics;
using Sitecore.Globalization;
using Sitecore.Shell.Applications.ContentEditor;
using Sitecore.Text;
using Sitecore.Web;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.WebControls;
@kamsar
kamsar / gist:6407742
Created September 1, 2013 22:29
This class provides a method to 'upgrade' the hash algorithm used by the SqlMembershipProvider without resetting all existing passwords. Users can effectively then be authenticated using either legacy or modern hashes, and any time a hash gets touched it will be upgraded automatically.
using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web.Security;
@kamsar
kamsar / Performance.Dev.config
Last active August 17, 2021 16:04
SItecore 8.0/8.1/8.2 Performance 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 />

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 / ServiceCollectionExtensions.cs
Last active January 12, 2020 14:24
Automatically register controllers with Sitecore 8.2 IoC container
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 February 26, 2019 14:30
Sitecore Solr Cannon
# 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)