Skip to content

Instantly share code, notes, and snippets.

@qlikq
qlikq / Get-DockerImageTag.ps1
Last active July 20, 2021 09:44
Obtain docker image tags list
function Get-DockerImageTag {
[CmdletBinding()]
param (
[string]$ImageName,
[switch]$OnlyActive
)
$FetchedRecords = New-Object System.Collections.ArrayList
try {
$fetchResult = (Invoke-WebRequest -Uri "https://registry.hub.docker.com/v2/repositories/library/$ImageName/tags/").Content | convertfrom-json
if ($fetchResult.count -gt 0) {
<#
In order to test it, you need to get vsphere SDK for webservices, as this is using the libraries from it.
new-webserviceproxy can't handle soap security headers. You also need PKCS#12 pfx certificate (in my example)
#>
#https://www.dorkbrain.com/docs/2017/09/02/gzip-in-powershell/
Function ConvertTo-GZipString () {
[CmdletBinding()]
Param(
[Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelinebyPropertyName = $True)]
@qlikq
qlikq / Get-IpsFromString.ps1
Created January 28, 2020 10:32
Select Ips from a string constrained by string length
Function Get-IPsFromString {
<#
.SYNOPSIS
Returns chunks of ips from given string limited to $MaxLength of characters from string
.DESCRIPTION
If we have 50 ips separated by commas, this function will retrieve as many batches of
ips as there can fit inside $maxlength of character from give string.
If you have to put in some form which is limited to 255 characters ips this function
will diving the ips between
By default is assumes tring limit of 255 characters and min of MaxLength-39 to handle