Skip to content

Instantly share code, notes, and snippets.

@JustinGrote
JustinGrote / Show-MagickProgress.ps1
Last active March 10, 2022 11:41
An Example of parsing command output text into Write-Progress from a Foreach -Parallel Pipeline
$commandOutput = @'
save image[D:\2D\Test\Just Flow Dark 03.png]: 50 of 4500, 20% complete
save image[D:\2D\Test\Just Flow Dark 03.png]: 100 of 4500, 40% complete
save image[D:\2D\Test\Just Flow Dark 03.png]: 150 of 4500, 60% complete
save image[D:\2D\Test\Just Flow Dark 05.png]: 50 of 4500, 20% complete
save image[D:\2D\Test\Just Flow Dark 03.png]: 200 of 4500, 80% complete
save image[D:\2D\Test\Just Flow Dark 03.png]: 250 of 4500, 90% complete
save image[D:\2D\Test\Just Flow Dark 05.png]: 100 of 4500, 40% complete
save image[D:\2D\Test\Just Flow Dark 05.png]: 150 of 4500, 60% complete
save image[D:\2D\Test\Just Flow Dark 05.png]: 200 of 4500, 80% complete
@michaellwest
michaellwest / .gitlab-ci.yml
Last active August 18, 2021 15:02
Example using GitLab to build a custom .net 5.0 SDK image using kaniko. We use kaniko to build the container in runtime this makes it so the building doesn’t require access to the docker daemon. This allows to utilize the normal runners and don’t have to enable privileged mode in docker.
stages:
- build:dotnet
default:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
.job_template:
script: &script_definition
@MartinMiles
MartinMiles / TestSitecorePowerShellRemoting.ps1
Last active February 10, 2021 15:46
SPE Remoting (1. Install Sitecore module; 2. Install remoting module into $PSHome\Modules; 3. Weaken security ie. ShieldsDown.config )
Set-ExecutionPolicy RemoteSigned
Import-Module -Name SPE
$session = New-ScriptSession -Username admin -Password b -ConnectionUri https://platform
Invoke-RemoteScript -ScriptBlock {
Get-Item -Path "master:\content\Home"
} -Session $session
@Francisco-Gamino
Francisco-Gamino / Create-PowerShell-7-functionApp
Last active July 25, 2022 12:45
Create a PowerShell 7 function app using Az.Functions
# Install the PowerShell 7. To do this, run the following:
iex "& { $(irm 'https://aka.ms/install-powershell.ps1')} -UseMSI"
# Open PowerShell 7 and install the latest version of Az which includes Az.Functions
# Link to Az.Functions docs -- https://docs.microsoft.com/en-us/powershell/module/az.functions/?view=azps-4.3.0#functions
Install-Module Az
# Sign in to Azure
Login-AzAccount
@jaapbrasser
jaapbrasser / DownloadIgniteSessions.ps1
Last active November 10, 2019 17:44
Download all Microsoft Ignite presentations
(irm 'https://api-myignite.techcommunity.microsoft.com/api/session/all') |
? title -match powershell |
% -Parallel {
iwr $($_.downloadVideoLink) -OutFile "C:\ignite\$($_.sessioncode).mp4"
}
# Originally tweeted by Anthony Allen
# https://twitter.com/PSAdm/status/1192909669947318272?s=19
@vtml
vtml / TdsGlobal.config
Created August 24, 2019 00:43
Hedgehog Team Development for Sitecore (TDS) v5.8 Review
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CompactSitecoreItemsInProjectFile>True</CompactSitecoreItemsInProjectFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<!--
In the default configuration of the global file, the values for a configuration in the global file supersede the values
in the project configuration. This behavior can be changed by specifying a condition on the property as follows:
@izharikov
izharikov / z.Dev.Config.config
Created August 5, 2019 16:00
Sitecore Local Env Speed-up
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<settings>
<setting name="EnableEventQueues">
<patch:attribute name="value">false</patch:attribute>
</setting>
<setting name="Counters.Enabled">
<patch:attribute name="value">false</patch:attribute>
</setting>
@jdhitsolutions
jdhitsolutions / Get-DockerContainer.ps1
Last active November 10, 2023 15:51
A PowerShell function to get docker containers as objects.
#requires -version 5.1
Function Get-DockerContainer {
[cmdletbinding(DefaultParameterSetName = "name")]
[alias("gdc")]
[OutputType("Get-DockerContainer.myDockerContainer")]
Param(
[Parameter(Position = 0, HelpMessage = "Enter a docker container name. The default is all running containers.", ParameterSetName = "name")]
[ValidateNotNullorEmpty()]
@SteveL-MSFT
SteveL-MSFT / base64.ps1
Last active October 14, 2022 14:28
PowerShell Base64 Encode/Decode test
# Base64 algorithm borrowed from https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64
function ConvertTo-Base64String ($string)
{
$base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
$result = [System.Text.StringBuilder]::new()
$pad = ""
$count = $string.Length % 3;
# string needs to be multiple of 3 characters
<#
.SYNOPSIS
Resize an image
.DESCRIPTION
Resize an image based on a new given height or width or a single dimension and a maintain ratio flag.
The execution of this CmdLet creates a new file named "OriginalName_resized" and maintains the original
file extension
.PARAMETER Width
The new width of the image. Can be given alone with the MaintainRatio flag
.PARAMETER Height