Skip to content

Instantly share code, notes, and snippets.

View vtml's full-sized avatar

Vincent Lui vtml

View GitHub Profile
@vtml
vtml / DockerFile
Created September 7, 2021 14:11
Sample Docker File that installs Certificates to the Root Store. Example of Solution Dockerfile from Sitecore's Docker Examples repo
# escape=`
ARG BASE_IMAGE
ARG BUILD_IMAGE
FROM ${BUILD_IMAGE} AS prep
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Gather only artifacts necessary for NuGet restore, retaining directory structure
COPY *.sln nuget.config Directory.Build.targets Packages.props \nuget\
@vtml
vtml / azure-pipelines.yml
Created August 17, 2021 12:58
Azure YAML Pipelines task to replace Docker Environment Variables
- task: qetza.replacetokens.replacetokens-task.replacetokens@3
displayName: 'Replace Docker Environment Variables'
inputs:
rootDirectory: '<Insert Path>'
targetFiles: '**/*.config'
encoding: 'auto'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
tokenPrefix: '$(env:'
@vtml
vtml / Build.ps1
Created May 20, 2021 13:17 — forked from cassidydotdk/Build.ps1
Complete Build and Publish Script. Will deploy all projects to publishing target, no HPP required.
param(
[Parameter()]
[switch]$NoBuild,
[Parameter()]
[switch]$NoSync,
[Parameter()]
[string]$CmHost="https://habitatstarterkit.local",
[Parameter()]
[string]$SolutionName="HabitatStarterKit.sln",
[Parameter()]
@vtml
vtml / ImportWizardFromCSV.ps1
Created May 5, 2021 07:42 — forked from michaellwest/ImportWizardFromCSV.ps1
Import content from a CSV using Sitecore PowerShell Extensions.
<#
.SYNOPSIS
Data Import Wizard provides a way to generate or update content from an external file.
.DESCRIPTION
The import file uses the properties "Name" and "Id" to help match existing items.
.NOTES
Requires Sitecore PowerShell Extensions 4.6 or newer.
@vtml
vtml / Update workflow and state on content items.ps1
Last active May 5, 2021 05:17 — forked from marcduiker/Update workflow and state on content items.ps1
Sitecore Powershell script to update the workflow and state on content items which do not have a workflow set on them.
<#
.SYNOPSIS
Updates the Workflow and Workflow state fields of content items with the given $workflowID and $workflowStateID values.
.DESCRIPTION
This script can be used when existing content is not assigned to a workflow and workflow state while it should be.
This scenario usually occurs when a workflow is assigned to a template but there is already content created based on a previous version of that template (where the workflow was not yet assigned).
@vtml
vtml / Docker-compose
Last active February 14, 2021 22:23
Traefik 20H2
services:
traefik:
image: traefik:v${TRAEFIK_VERSION}-nanoserver-${NANOSERVER_VERSION}
build:
context: .
args:
NANOSERVER_VERSION: ${NANOSERVER_VERSION}
TRAEFIK_VERSION: '${TRAEFIK_VERSION}'
...
@vtml
vtml / choco-packages-for-sitecore-docker-build.ps1
Last active March 10, 2021 09:35
A list of Chocolatey packages required to install on a Windows VM to build Sitecore Docker Containers
Set-ExecutionPolicy RemoteSigned -Force; Set-ExecutionPolicy Unrestricted -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install dotnetcore -y
choco install dotnetcore-sdk -y
choco install webdeploy -y
choco install dotnetfx -y
choco install netfx-4.8 -y
choco install powershell-core -y
choco install azure-cli -y
choco install git -y
choco install sourcetree -y
@vtml
vtml / Sitecore-ImageResizing-EdgeWorker
Last active April 30, 2020 02:40
CloudFlare Image Resizing Edge Worker for Sitecore
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Fetch and log a request
* @param {Request} request
*/
async function handleRequest(request) {
// Parse request URL to get access to query string