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
@( Get-Project -All | ? { $_.ProjectName } | % { Get-Package -ProjectName $_.ProjectName } ) | %{ $_ | Add-Member -MemberType "NoteProperty" -Value "$($_.Id)@$($_.Version)" -Name "Key"; $_ } | Sort -Property "Key" -Unique | %{ Uninstall-Package -Id $_.Id -ProjectName $_.ProjectName -Force -RemoveDependencies -ErrorAction Ignore } |
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
$lic = New-Item -ItemType Directory -Name "lic" -Force -ErrorAction "Stop"; | |
$projects = @( Get-Project -All | ? { $_.ProjectName } | % { Get-Package -ProjectName $_.ProjectName } ); | |
$deps = $projects | %{ $_ | Add-Member -MemberType "NoteProperty" -Value "$($_.Id)@$($_.Version)" -Name "Key"; $_ } | Sort -Property "Key" -Unique; | |
$deps | %{ $pkg = $_; if($null -eq $pkg.LicenseUrl) { Set-Content -Path ($lic.FullName + "\no_license_" + $pkg.Id + ".txt") -Value "NO-LICENCE" } } | |
$loaded = $deps | %{ $pkg = $_; if($null -ne $pkg.LicenseUrl) { Try { $extMatch = [regex]::Match($pkg.LicenseUrl, '^.*?(\.html?|\.txt)$'); if($extMatch.Success){$ext = $extMatch.Groups[1].Value;} else {$ext = ".html"} $cnt = (New-Object System.Net.WebClient).DownloadString($pkg.LicenseUrl); Write-Host "$($pkg.LicenseUrl) downloaded for $($pkg.Id)."; @{ PKg = $pkg; Content = $cnt; } | Write-Output } Catch [system.exception] { Write-Host "Could not download license for $($pkg.Id) -> '$($pkg.LicenseUrl)'" } } } | |
$loaded | %{ $pkg = $_["Pkg"]; |
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
#requires -version 5 | |
Set-StrictMode -Version Latest | |
function Get-WindowsCredentialManagerPSCredential { | |
[CmdletBinding()] | |
param( | |
[Parameter(Position = 0, Mandatory = $true)] | |
[Alias("Name")] | |
[ValidateNotNullOrEmpty()] | |
[string]$Url |
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
[DefaultProperty("ViewPropertyBindings")] | |
[ContentProperty("ViewPropertyBindings")] | |
internal class InjectedView : FrameworkElement | |
{ | |
private readonly IKernel kernel; | |
private FrameworkElement visual; | |
private ObservableCollection<ViewPropertyBinding> viewPropertyBindings; |
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-FileEncoding { | |
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$Path | |
) | |
[byte[]]$byte = get-content -Encoding byte -ReadCount 4 -TotalCount 4 -Path $Path | |
$encoding = 'utf8'; | |
if ( $byte[0] -eq 0xef -and $byte[1] -eq 0xbb -and $byte[2] -eq 0xbf ) | |
{ $encoding = 'utf8-with-bom'; } | |
elseif (($byte[0] -eq 0xfe -and $byte[1] -eq 0xff) <#big endian#>) |
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
#requires -version 5 | |
Set-StrictMode -Version Latest | |
Function Add-StartupCommand { | |
[OutputType("ScheduledCommand")] | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=0)] | |
[String]$TaskName, | |
[Parameter(Mandatory=$true,Position=1)] |
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
#requires -version 5 | |
Set-StrictMode -Version Latest | |
Function Invoke-ScheduledCommand { | |
[Diagnostics.CodeAnalysis.SuppressMessage("PSUseDeclaredVarsMoreThanAssignments", "", Justification = "This re-establishes the global environment preferences. They can be used all over child scripts.")] | |
[OutputType("ScheduledCommandResult[]")] | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=0)] | |
[String]$TaskName, |
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-EnvironmentPath { | |
<# | |
.SYNOPSIS | |
Adds a path to the PATH environment variable at give scope. | |
.DESCRIPTION | |
Adds a Path to the PATH environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine. | |
In addition to that the command sorts the paths and removes duplicates. | |
.PARAMETER Path |
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
#requires -version 5 | |
Set-StrictMode -Version Latest | |
Function Read-Input { | |
[Diagnostics.CodeAnalysis.SuppressMessage("PSAvoidUsingWriteHost", "", Justification = "This is an interface cmdlet that should be seen in its host.")] | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true, Position=1)] | |
[string]$Message, | |
[Parameter(Mandatory=$false, Position=2)] |
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 Robot { | |
$overallIndex = 0; | |
$cx = $Host.UI.RawUI.CursorPosition.X; | |
$cy = $Host.UI.RawUI.CursorPosition.Y; | |
$left = 0; | |
$right = $Host.UI.RawUI.BufferSize.Width; | |
$sIdx = 0; | |
$uIdx = 0; | |
$stg = "walk"; |