This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$getFirstLine = $true;get-childItem "*.csv" | foreach {$filePath = $_;$lines = $lines = Get-Content $filePath;$linesToWrite = switch($getFirstLine) {$true {$lines}; $false {$lines | Select -Skip 1}};$getFirstLine = $false;Add-Content "combined.csv" $linesToWrite;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Compress-Subfolders | |
{ | |
param | |
( | |
[Parameter(Mandatory = $true)][string] $InputFolder, | |
[Parameter(Mandatory = $true)][string] $OutputFolder | |
) | |
if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"} | |
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE MarkerTechV2CMS | |
GO | |
WITH Fields | |
AS | |
( | |
SELECT | |
pd.ProductDefinitionId [ChildDefinitionID] | |
, pd.ProductDefinitionId | |
, pd.Name AS [ProductDefinitionName] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Calculates number of business days, taking into account: | |
/// - weekends (Saturdays and Sundays) | |
/// - bank holidays in the middle of the week | |
/// </summary> | |
/// <param name="firstDay">First day in the time interval</param> | |
/// <param name="lastDay">Last day in the time interval</param> | |
/// <param name="bankHolidays">List of bank holidays excluding weekends</param> | |
/// <returns>Number of business days during the 'span'</returns> | |
public static int BusinessDaysUntil(this DateTime firstDay, DateTime lastDay, params DateTime[] bankHolidays) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
@RowsToDelete INT = 100 | |
, @rows INT = 1 | |
, @batch INT = 1 | |
, @batchestorun INT = 2000 | |
, @message nvarchar(max) | |
, @keepOldVersionsCount int | |
, @keepNewerThanDate DATETIME | |
SET @keepOldVersionsCount = 0 /* 0 Keeps published and newest only. */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!QAZ1qaz | |
!QAZ2wsx | |
!Qaz2wsx | |
!QAZxsw2 | |
!QAZzaq1 | |
#EDC4rfv | |
123qweASD | |
12qw!@QW | |
1941.Salembbb.41 | |
1qaz!QAZ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN TRAN | |
SELECT TOP 100 | |
* | |
FROM | |
uCommerce_Product p | |
LEFT JOIN uCommerce_PriceGroupPrice pgp ON p.ProductId = pgp.ProductId | |
LEFT JOIN uCommerce_Product pp ON p.ParentProductId = pp.ProductId | |
WHERE | |
p.ParentProductId IS NOT NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN TRAN | |
-- Activate variants | |
UPDATE uCommerce_Product SET DisplayOnSite = 1, AllowOrdering = 1 where ParentProductId IS NOT NULL | |
-- Insert the price group prices | |
INSERT into uCommerce_PriceGroupPrice (ProductId, Price, PriceGroupId) | |
SELECT p.ProductId, NULL, pg.PriceGroupId | |
FROM uCommerce_Product p LEFT JOIN uCommerce_PriceGroupPrice pgp ON p.ProductId = pgp.ProductId, uCommerce_PriceGroup pg | |
WHERE pgp.ProductId IS NULL AND pg.Deleted = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ago = 7; | |
$now = Get-Date; | |
$limit = $now.AddDays($ago * -1) | |
$filename = "UmbracoTraceLog.txt.*" | |
$path = "D:\Websites\" | |
# Delete files older than the $limit. | |
Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.LastwriteTime -lt $limit -and $_.name -like $filename } | Remove-Item -WhatIf | |
# Delete any empty directories left behind after deleting the old files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE Master | |
GO | |
CREATE DATABASE DATABASENAMECMS | |
GO | |
DECLARE @DatabaseName nvarchar(255), @Username nvarchar(255), @Password nvarchar(255), @AddToASPNet bit, @IsUmbracoInstall bit | |
SET @DatabaseName = 'DATABASENAMECMS' -- NOTE this must also match the CREATE value above and below the "Creating Users" script | |
SET @Username = 'DATABASENAMEUser' | |
SET @Password = '' |