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
$queries = 0..25 | |
Set-Variable -Name SecondsPerQuery -Value 11 -Option ReadOnly -Force | |
Set-Variable -Name Variability -Value 0.07 -Option ReadOnly -Force | |
$queries | ForEach-Object -Begin { | |
$averageSecondsPerQuery = $SecondsPerQuery # Average seconds per query will be used to predict the time per iteration | |
} -Process { | |
$index = $_ | |
$timing = [timespan]::FromSeconds((Get-Random -Minimum ((1.00 - $Variability) * $SecondsPerQuery) -Maximum ((1.00 + $Variability) * $SecondsPerQuery))) | |
$averageSecondsPerQuery = $averageSecondsPerQuery * ($index / $queries.Length) + $timing.TotalSeconds * ($queries.Length - $index) / $queries.Length | |
[pscustomobject]@{ |
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 Move-AzStorageBlob { | |
#Requires -Modules Az.Storage | |
[CmdletBinding(ConfirmImpact = 'High', SupportsShouldProcess)] | |
param ( | |
[Parameter(Mandatory)] | |
[System.Object] | |
$SrcBlob, | |
[Parameter(Mandatory)] | |
[string] | |
$SrcContainer, |
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
$sqlclDownload = Invoke-RestMethod -Uri "https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/download/" | |
$sqlclDownloadHash = ($sqlclDownload | Select-String -Pattern "SHA256: (?<sha256>[^<]+)" | Select-Object -ExpandProperty Matches).Groups['sha256'].Value | |
$sqlclDownloadUri = ($sqlclDownload | Select-String -Pattern "https:.*\.zip" | Select-Object -ExpandProperty Matches).Value | |
Invoke-WebRequest -Uri $sqlclDownloadUri -OutFile $env:TEMP\sqlcl.zip | |
if(Get-FileHash -Path $env:TEMP\sqlcl.zip | ForEach-Object { $_.Hash -ieq $sqlclDownloadHash }){ | |
Expand-Archive -Path $env:TEMP\sqlcl.zip -DestinationPath $env:LOCALAPPDATA\Programs\ -Force | |
} |
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 ConvertTo-TnsnamesOra | |
{ | |
[CmdletBinding(DefaultParameterSetName = 'PipelineStringArray')] | |
param | |
( | |
[Parameter(ParameterSetName = 'ConnectionsJsonPath')] | |
[String]$ConnectionsJsonPath = "$env:APPDATA\SQL Developer\system*\o.jdeveloper.db.connection\connections.json", | |
[Parameter(ParameterSetName = 'PipelineStringArray', ValueFromPipeline, ValueFromPipelineByPropertyName = $true)] | |
[ValidateScript({ $null -ne $_ -and $null -ne ($_ | ConvertFrom-Json -Depth 99) }, ErrorMessage = 'The input string is not valid JSON.')] | |
[string[]]$ConnectionsJsonStrArray, |
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 Move-AzStorageBlob { | |
#Requires -Modules Az.Storage, Az.Accounts | |
[CmdletBinding()] | |
param ( | |
$SrcBlob, | |
$SrcContainer, | |
$DestContainer, | |
$DestBlob, | |
$Context | |
) |
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-DecryptedPassword { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipelineByPropertyName)] | |
[securestring] | |
$EncryptedPassword = (Get-Content -Path 'C:\Users\B0649033\AppData\Roaming\SQL Developer\system*\o.jdeveloper.db.connection\connections.json' | ConvertFrom-Json | ForEach-Object { $_.connections.info } | Out-ConsoleGridView -Title "Choose connection" -OutputMode Single | ConvertTo-SecureString -AsPlainText -Force ), | |
[Parameter(ValueFromPipelineByPropertyName)] | |
[string] | |
$DbSystemId = (([xml]$(Get-Content -Path "$env:APPDATA\SQL Developer\system*\o.sqldeveloper\product-preferences.xml")) | ForEach-Object { $_.preferences.value } | Where-Object -FilterScript { $_.n -eq 'db.system.id' } | Select-Object -ExpandProperty v -Unique -First 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
$md = <# PATH TO MARKDOWN FILE #> | |
$images = Select-String -Pattern "(?<=!\[[^\(]+\()[^\)]+(?=\))" -Path $md | ForEach-Object { $_.Matches.Value } | |
$html = <# PATH TO HTML FILE #> | |
$images = Select-String -Pattern "(?<=src=`")[^`"]+(?=\))" -Path $html | ForEach-Object { $_.Matches.Value } | |
$imagesBase64 = [string[]]::new($images.Count) | |
foreach($image in $images){ | |
try { | |
# $filehandle = [System.IO.File]::Open((Join-Path -Path (Split-Path -Path $md -Parent) -ChildPath $image),[System.IO.FileMode]::Open) | |
$filehandle = [System.IO.File]::Open($image,[System.IO.FileMode]::Open) | |
$bytes = [byte[]]::new($filehandle.Length) |
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 -RunAsAdministrator | |
$zones = "onedrive.com", "*.onedrive.com", "onedrive.live.com", "login.live.com", "g.live.com", "spoprod-a.akamaihd.net", "*.mesh.com", "p.sfx.ms", "oneclient.sfx.ms", "*.microsoft.com", "fabric.io", "*.crashlytics.com", "vortex.data.microsoft.com", "posarprodcssservice.accesscontrol.windows.net", "redemptionservices.accesscontrol.windows.net", "token.cp.microsoft.com/", "tokensit.cp.microsoft-tst.com/", "*.office.com", "*.officeapps.live.com", "*.aria.microsoft.com", "*.mobileengagement.windows.net", "*.branch.io", "*.adjust.com", "*.servicebus.windows.net", "vas.samsungapps.com", "odc.officeapps.live.com", "login.windows.net", "login.microsoftonline.com", "*.files.1drv.com", "*.onedrive.live.com", "*.*.onedrive.live.com", "storage.live.com", "*.storage.live.com", "*.*.storage.live.com", "*.groups.office.live.com", "*.groups.photos.live.com", "*.groups.skydrive.live.com", "favorites.live.com", "oauth.live.com", "photos.live.com", "skydrive.live.com", "api.live.net", "apis.live. |
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 a list of the environment variables sorted by length | |
$envs = Get-ChildItem -Path Env:\ | ForEach-Object { | |
[pscustomobject]@{ | |
Length = $_.Value.Length | |
Name = $_.Name | |
Value = $_.Value | |
} | |
} | Sort-Object -Descending -Property Length | |
# Replace the environment variables in the user path with the variable name | |
$userPath = [System.Environment]::GetEnvironmentVariable('PATH',[System.EnvironmentVariableTarget]::User) -split [System.IO.Path]::PathSeparator |
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 Set-CaCertsBundles | |
{ | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] | |
param( | |
[Parameter(HelpMessage = 'Environment variable target')] | |
[ValidateScript({ $_ -ne [System.EnvironmentVariableTarget]::Machine -or [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent().IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) }, ErrorMessage = 'Cannot set machine environment variables without admin privileges')] | |
[ArgumentCompleter({ [System.Enum]::GetNames([System.EnvironmentVariableTarget]) })] | |
[System.EnvironmentVariableTarget] | |
$Target = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) ? [System.EnvironmentVariableTarget]::Machine : [System.EnvironmentVariableTarget]::User, | |
[Parameter(HelpMessage = 'Output file path')] |
NewerOlder