PowerShell

Detecting digit combinations in a number with PowerShell

How we can inspect a number like 143256789 and determine it contains the digits 1-9

James Montgomery

5 minute read

TL; DR How do you pass the time on a car journey? Most of us have memories of “I spy” or other game. Lately, I’ve been looking out for number combinations after a car I owned passed 123k miles - specifically 123456 miles. What’s more, the trip computer almost made it read 1234567890! As time passed, I was looking out for other odometer readings. 123465 miles was the next number of interest.

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?

Producing live visuals from a PowerShell REST API

Using vis.js and PowerShell Universal Dashboard

James Montgomery

3 minute read

TL; DR In this post, I’d like to share an example of bringing to life the data returned by an API. One PowerShell example takes the output of Get-NetTCPConnection and Get-Process to create a JSON representation of process IDs and their network connections. Universal Dashboard provides the means to expose this via REST API. Lastly, the vis.js network module creates a visual representation of this data. Here is an example video:

Visualising your DNS cache with PSGraph

Exploring how to create a visual with Powershell

James Montgomery

5 minute read

TL; DR In this post, I’d like to introduce you to how I’ve used PSGraph to create visuals from code. I’ll show you how to represent the Windows DNS cache graphically. Here is an example output (click for a full size image): Below I cover how to arrive at that outcome. You can find all scripts used at my GitHub page. Why DNS The hierarchical nature of DNS (subdomain.topleveldomain.rootdomain) lends itself to graphing.

A punnet of raspberries with a side of visuals

Pi-hole and DNS over DNSCrypt with a PowerShell dashboard.

James Montgomery

5 minute read

TL; DR I finally dusted off that Raspberry Pi in the corner. Initially, I was putting Pi-hole through its paces. One thing led to another as a new rabbit hole emerged in the form of adding encrypted transport to forwarded queries (a subject I visited in the past). I purchased another Pi for resiliency. I then explored how I might visualise the performance of the solution. Lastly, a first for me, I have shared this code on my GitHub page.

TTS project update 1 - adding texture to my generated speech

Introducing a pool of voices and choices in rate of speech, pitch and volume gain.

2 minute read

TL; DR In this post, I’d like to share an update on work to address some of the limitations in my text to speech project for Elite Dangerous.. Namely: Single voice is used for the synthesis; and Pitch, tone and emphasis are unchanged from defaults. If you’d like to see the result of the work so far, here is a brief overview video, I’ll describe how we got here below: