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
using namespace System; | |
using namespace System.Net; | |
using namespace System.Net.Http; | |
## handler to bypass invalid certificate | |
$handler = [HttpClientHandler]::new() | |
# $handler.AllowAutoRedirect = $false | |
$handler.ServerCertificateCustomValidationCallback = [HttpClientHandler]::DangerousAcceptAnyServerCertificateValidator ## System.Net.Http. | |
$location = [Uri]::New("https://some_invalid_cert_server") |
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
using MauiApp1.Data; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Maui.LifecycleEvents; | |
using Microsoft.Maui.Platform; | |
using System.Runtime.InteropServices; | |
using MauiApp1.Shared; | |
namespace MauiApp1 | |
{ | |
public static class MauiProgram |
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
CREATE FUNCTION dbo.RepetitiveReplace_fn | |
( | |
@P_String VARCHAR(MAX), | |
@P_Pattern VARCHAR(MAX), | |
@P_ReplaceString VARCHAR(MAX), | |
@P_ReplaceLength INT = 1 | |
) | |
RETURNS VARCHAR(MAX) | |
BEGIN | |
DECLARE @Index INT; |
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
## Use PowerShell Engine Event (OnIdle) to Update the PowerShell | |
## Console Window's Title to have the current path and last command executed. | |
## For this to work Nicely add it to your PowerShell Profile. | |
## Subscribe to PowerShell.OnIdle Event | |
## Out to null to hide Register-EngineEvent output | |
$null = Register-EngineEvent PowerShell.OnIdle -Action { | |
## Get Last Command ran from history | |
$LastCommand = Get-History | Sort-Object -Property Id -Descending | Select-Object -First 1 -exp CommandLine | |
## Updated the console window's title to have the path and command. |
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 Invoke-URLInDefaultBrowser | |
{ | |
<# | |
.SYNOPSIS | |
Cmdlet to open a URL in the User's default browser. | |
.DESCRIPTION | |
Cmdlet to open a URL in the User's default browser. | |
.PARAMETER URL | |
Specify the URL to be Opened. | |
.EXAMPLE |
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
#Build Job Name to be unique | |
$JobName = "ExampleJob" | |
$JobNameCount = (get-job | Where-Object Name -like $JobName*).Count | |
$JobName = "$($JobName)_$($JobNameCount)" | |
#Define and Start job | |
$Job = Start-Job -Name $JobName -ScriptBlock { Start-Sleep 60 } | |
#Create Event to clean up job after complete | |
Register-ObjectEvent -InputObject $Job -EventName "StateChanged" -Action { |
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
$ErrorActionPreference = "Stop" | |
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString() | |
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null | |
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01) | |
#Convert to .NET type for XML manipuration | |
$toastXml = [xml] $template.GetXml() | |
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null |