This file contains 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 Add-Numbers($a, $b) { | |
return $a + $b | |
} | |
Describe "Add-Numbers" { | |
$testCases = @( | |
@{ a = 2; b = 3; expectedResult = 5 } | |
@{ a = -2; b = -2; expectedResult = -4 } | |
@{ a = -2; b = 2; expectedResult = 0 } | |
@{ a = 'two'; b = 'three'; expectedResult = 'twothree' } |
This file contains 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
def sumInRange(nums, queries) | |
sum = 0 | |
startIndices = {} | |
endIndices = {} | |
m = 1000000007 | |
queries.each do |q| | |
startIndices[q[0]].nil? ? startIndices[q[0]] = 1 : startIndices[q[0]] += 1 | |
endIndices[q[1]].nil? ? endIndices[q[1]] = 1 : endIndices[q[1]] += 1 | |
end |
This file contains 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
[System.IO.Path]::GetInvalidFileNameChars() | % {$text = $text.replace($_,'.')} |
This file contains 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
$shell = New-Object -ComObject Shell.Application | |
foreach ($font in $shell.Namespace($PSScriptRoot).Items()) { | |
if (($font.Path).ToLower() -like "*.ttf" -or ($font.Path).ToLower() -like "*.otf" -or ($font.Path).ToLower() -like "*.ttc") { | |
if (-not (Test-Path ($env:windir + "\Fonts\" + $font.Path.Split("\")[-1]) -ErrorAction SilentlyContinue)) { | |
$font.InvokeVerbEx("Install") | |
} | |
} | |
} |
This file contains 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
<# | |
.SYNOPSIS | |
Uninstall an application based on the exact name in Programs and Features | |
.DESCRIPTION | |
Will accept a DisplayNamee value that will be searched for in Programs and Features. | |
.PARAMETER DisplayName | |
The DisplayName as it found in Programs and Features | |
.PARAMETER LogPath | |
[Optional] Full path to the client logs folder | |
.PARAMETER LogName |
This file contains 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 Remove-ApplicationByDisplayName | |
{ | |
<# | |
.SYNOPSIS | |
Remove an application from Windows | |
.DESCRIPTION | |
Will accept a DisplayName value that will be searched for in Programs and Features and will | |
uninstall the applicationg. | |
.PARAMETER DisplayName | |
The DisplayName as it found in Programs and Features |
This file contains 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 Get-ArpPropertyByDisplayName { | |
<# | |
.SYNOPSIS | |
Get an application property from Programs and Features | |
.DESCRIPTION | |
Will accept a DisplayName value that will be searched for in Programs and Features and will | |
return the property. | |
.PARAMETER DisplayName | |
The DisplayName as it found in Programs and Features | |
.NOTES |
This file contains 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
class CommandString { | |
[String]$Command | |
CommandString([String]$Command) | |
{ | |
$this.Command = $Command | |
} | |
[String] ToUninstall() | |
{ |
This file contains 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
<# | |
.SYNOPSIS | |
Uninstall a package when the original source media is unavailable locally. | |
.DESCRIPTION | |
A new location will be added to SOURCELIST so that Windows Installer can locate the media. The script uses MSI files | |
located in the current directory or Path and will set an additional SOURCELIST for each before attempting to uninstall. | |
.PARAMETER Path | |
[Optional] This is the folder that will contain the Windows Installer source. |
OlderNewer