Tutorial

Detecting Digits with PowerShell

A person can look at a number and determine which digits are present. How would a script achieve this?

James Montgomery

13 minute read

Table of contents TL; DR How to think about the problem Working with a number in PowerShell [System.Math]::DivRem Using DivRem to detect a digit Using DivRem to detect a range of digits Contains Using .contains() to detect a digit Using .contains() to detect a range of digits Match Using -match to detect a specific digit Using -Match to detect a range of digits Split Using -split to detect a digit Using -split to detect a range of digits ASCII Method Using the ASCII value of a character to detect unique digits in a number Conclusion Acknowledgements TL; DR Have you ever wondered, how many unique digits are in a number?

Google Cloud Text-to-Speech with PowerShell

A guide for using PowerShell with the Google Cloud Text-to-Speech API.

6 minute read

TL; DR In this post, I’ll walk through the basics of using PowerShell to interact with the Google Cloud Text-to-Speech API. Partly a documentation exercise and somewhat a guide I’d like to have been able to read when I started on my Elite Dangerous Google Cloud Text-to-Speech project. As such, we’ll start with a basic script to produce an audio file and explain how that works. Later I’ll walk through some parameters of interest to affect the response.

How to base64 decode on Windows 10 without base64.exe

Converting the base64 audio content response from the Google Cloud Text-to-Speech API into a playable file on windows using PowerShell.

2 minute read

TL;DR You can call certutil from PowerShell to produce the required file. Introduction There is a moment in life where you get stuck in a quick start guide - we’ve all been there. At the start of my Google Cloud text-to-speech project it arrived quickly and unexpectedly at step two of this two-step quick start guide. I had successfully returned my first base64 encoded speech audio, onward to the last step: