Skip to content

Instantly share code, notes, and snippets.

View PanosGreg's full-sized avatar

Panos Grigoriadis PanosGreg

  • Dublin, Ireland
View GitHub Profile
@PanosGreg
PanosGreg / Protocol Buffers in PowerShell (extended) - Serialization & Deserialization.ps1
Created June 9, 2026 14:36
A more real-world example on how to do ser/des with Google's Protobuf in PowerShell
## Protobuf Serialization & Deserialization
# This is the process to serialize and deserialize data into/from protobuf
# Protobuf is supposed to be much smaller than JSON or XML and that's its main advantage
# Date: 09-Jun-2026
# you will need to following thing:
# - nuget tool (ex. scoop install nuget)
@PanosGreg
PanosGreg / Protocol Buffers in PowerShell (simple) - Serialization & Deserialization.ps1
Last active June 9, 2026 14:27
Simple example on how to do ser/des with Google's Protobuf in PowerShell
## Protobuf Serialization & Deserialization
# This is the process to serialize and deserialize data into/from protobuf
# Protobuf is supposed to be much smaller than JSON or XML and that's its main advantage
# Date: 09-Jun-2026
# you will need to following thing:
# - nuget tool (ex. scoop install nuget)
@PanosGreg
PanosGreg / Get-SslCertificate.ps1
Created March 11, 2026 11:29
Get the certificate from an SSL-enabled service
function Get-SslCertificate {
<#
.EXAMPLE
Get-SslCertificate -Address devad2487dc3.ad.coupadev.net -Port 636
Check the Active Directory service on a domain controller to get the certificate we deployed for use by LDAPS
#>
[OutputType([System.Security.Cryptography.X509Certificates.X509Certificate2])] # <-- default output
[OutputType([System.Security.Cryptography.X509Certificates.X509Certificate])] # <-- fallback output
[CmdletBinding()] # if we can't convert it to X509Certificate2
@PanosGreg
PanosGreg / GitHubActions-Functions.ps1
Last active April 14, 2026 10:12
Functions for working with GitHub Actions
<#
.SYNOPSIS
Commands to work with GitHub Actions
This file contains these functions:
- Get-GhaApiVersion
- Get-GhaStep
- Get-Workflow
- Get-WorkflowJob
- Get-WorkflowLog
@PanosGreg
PanosGreg / Resolve-Error.ps1
Created March 5, 2026 14:51
Go through an Error Record recursively and get all exceptions and messages
function Resolve-Error {
[OutputType([object],[string])] # <-- by default [object], and [string] with AsString
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline, Mandatory)]
[ValidateNotNull()]
$ErrorRecord,
[switch]$AsString
)
@PanosGreg
PanosGreg / StepWrapper.ps1
Last active February 23, 2026 15:35
GitHub Actions Step Wrapper script for transparent data access between steps
<#
.SYNOPSIS
Step-Wrapper script for GitHub Actions Workflows
The main benefit is that it allows any variables defined in a step,
to be accessible to all subsequent steps. As if the code from all the steps
is running as a single script, without having to define the variables on each step.
.DESCRIPTION
This script wraps the user's command on each step.
@PanosGreg
PanosGreg / get_env_variables_jwts.yaml
Created January 30, 2026 14:10
GitHub Actions Workflow that shows JWTs and Env Variables
name: Get Environment Variables and JWTs
# This workflow was tested on a self-hosted windows runner (Windows Server 2025)
# On the VM, PowerShell v7.5.4 was installed and was used for this workflow as the shell
# The GitHub Actions Runner service version was v2.331.0.0 (Jan-2026)
on:
workflow_dispatch:
defaults:
@PanosGreg
PanosGreg / ConvertFrom-JwtToken.ps1
Created January 30, 2026 13:45
Convert JWT Blob to an object
function ConvertFrom-JwtToken {
<#
.DESCRIPTION
Decodes a JWT token. This was taken from link below. Thanks to Vasil Michev.
.LINK
https://www.michev.info/Blog/Post/2140/decode-jwt-access-and-id-tokens-via-powershell
#>
[OutputType([System.Collections.Specialized.OrderedDictionary])]
[cmdletbinding()]
param(
@PanosGreg
PanosGreg / DNSME-API.ps1
Last active November 27, 2025 17:24
DNS Made Easy helper functions. Might expand and write a proper module for this at some stage.
<#
.SYNOPSIS
DNS Made Easy helper functions
Context: I needed to do some bulk operations in DNS Made Easy at work,
I didn't find anything adequate online and so I wrote this.
.DESCRIPTION
This file exposes 3 functions, an enum and a class.
@PanosGreg
PanosGreg / ServiceCertificate.ps1
Created October 20, 2025 07:33
Functions to Get/Delete/Import a certificate from/on a windows service
# This file contains the following functions:
# Import-ServiceCertificate - Import a PFX certificate to a service cert store
# Get-ServiceCertificate - Get the certificates of a service
# Remove-ServiceCertificate - Delete a certificate from a service
#Requires -RunAsAdministrator
function Import-ServiceCertificate {