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
| $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 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
| #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 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
| # 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 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
| #Requires -Version 6.0 | |
| #Requires -PSEdition Core | |
| <# | |
| .SYNOPSIS | |
| Sets up Certificate Authority (CA) certificate bundles for various toolsets in Windows using PowerShell Core. | |
| .DESCRIPTION | |
| The Set-CaCertsBundles cmdlet is used to collect and set up CA certificates for various toolsets such as Python, AWS, Git, and NodeJs. It collects certificates from the local machine or current user store and configures environment variables for multiple toolsets to use these certificates. Optionally, it can create separate PEM files for NodeJs and import certificates into Windows Subsystem for Linux (WSL). | |
| .PARAMETER Target |
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
| Get-Module | Where-Object { $null -ne ($remoteVer = Find-Module -Name $_.Name -AllowPrerelease -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Version -ErrorAction SilentlyContinue) -and $_.Version -ne $remoteVer } | ForEach-Object { [pscustomobject]@{ Name = $_.Name; RemoteVer = $remoteVer; ThisVer = $_.Version } | Format-Table; Update-Module -Name $_.Name -AllowPrerelease -Verbose } |
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
| #Requires -Version 6.0 | |
| # Allocate a temporary directory for receiving the certificates | |
| $tmpCertsDir = New-Item -Path "$env:TEMP" -Name "Certs$(Get-Date -Format FileDateTimeUniversal)" -ItemType Directory -Force | |
| # Collect the certs from the local machine | |
| $certs = Get-ChildItem -Path Cert:\ -Recurse | Where-Object -FilterScript { $_.Thumbprint } | |
| # This will contain the paths to the resulting PEM files | |
| $pemPaths = [string[]]::new($certs.Count) |
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
| #Requires -Version 6.0 | |
| #Requires -RunAsAdministrator | |
| $jdkPaths = Get-Command -Name java -All | Where-Object -FilterScript { Test-Path -Path (Join-Path -Path ($_ | Split-Path -Parent) -ChildPath 'keytool.exe') } | Select-Object -ExpandProperty Path | Split-Path -Parent | Sort-Object -Unique | |
| [array]$jdkPaths += Resolve-Path -Path "c:\Users\B0649033\.vscode*\extensions\redhat.java-*\jre\*\bin" | Select-Object -ExpandProperty Path | |
| # Calculate existing certs first | |
| $certBag = [System.Collections.Concurrent.ConcurrentBag[PSCustomObject]]::new() | |
| $jdkPaths | ForEach-Object -Parallel { | |
| # Parallel work for each JDK, since their respective stores do not conflict | |
| $certBag = $using:certBag |
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
| #Requires -Version 5.1 | |
| function ConvertTo-ClassDefinition { | |
| param( | |
| [Parameter(Position = 0, Mandatory, ValueFromPipeline)] | |
| [object]$Object, | |
| [ValidateNotNullOrEmpty()] | |
| [string]$ClassName, |
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
| #Requires -Version 3.0 | |
| function Add-SymLinkPermissions { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
| [string] | |
| $UserAccount = $env:USERNAME | |
| ) | |
| Write-Host 'Checking SymLink permissions...' | |
| $sidstr = $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
| Add-Type -Assembly PresentationCore | |
| <# load ConvertTo-Slug from Gist #> Invoke-Expression (New-Object -TypeName System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/mavaddat/0bbed730a4c10a066d75894a7611d730/raw/4a37c2ec4f0d33ff2bbb1a224b0b901063dce871/slugify.ps1') # Imports Function ConvertTo-Slug | |
| # Copy files to the clipboard in Windows explorer.exe | |
| foreach ($crt in [System.Windows.Clipboard]::GetFileDropList()) | |
| { | |
| $crt = $crt | Get-Item | |
| $slug = $crt.Name | ConvertTo-Slug | |
| if (-not (.\keytool.exe -list -alias $slug -cacerts -storepass changeit 2>&1 | Out-String | Select-String -Pattern "keytool error: java.lang.Exception: Alias <$slug> does not exist" -SimpleMatch)) | |
| { | |
| .\keytool.exe -delete -cacerts -storepass changeit -alias $slug |