Scripting

Introducing Station Finder

A Cloudflare hosted single page application.

James Montgomery

4 minute read

After migrating my blog to Cloudflare Pages, I wanted to run an application exclusively using Cloudflare products. Inspiration struck on a journey where I was low on fuel in the car.

Introducing Station Finder

Station Finder is a single-page application. The goal was to provide a means to locate a fuel station.

Initially, you select a postcode and choose from a dynamically populated list of station results.

A station selection updates the objects on the page to reflect the station choice.

API Diversions

Experimenting with a new API via Cloudflare workers.

James Montgomery

5 minute read

TL; DR

Recently reinvigorated with my new UI work, I set myself to task with simplifying the front end player code. No matter how I looked at it, I’d needed to rewrite the back end API to support a front end rewrite. But what if I didn’t precisely need to do that? Enter stage left, Cloudflare Workers.

Comparison of beta with the worker as proxy and handling query translation.

Below I explain how I arrived at this. If you would like to view the Worker code, you can do so here. If you would like to view the sites (and compare), you may do so here:

A Serverless text-to-speech player for jokes and quotes

Using AWS components, Cloudflare, and public APIs.

James Montgomery

2 minute read

TL; DR

I decided to dust off my text-to-speech list, implementing a serverless solution delivering random jokes and quotes. You may visit it at this address:

https://tts-ja.mesmontgomery.co.uk/

You can get a preview of the joke quality here:

Note: I can’t affect the humour quality 🤣.

Solution overview

Upon visiting the page, an event triggers calls to the API routes for their relative jokes and quotes. Contained in the API response is the source audio for the HTML5 audio controls.

Backup of Cloudflare DNS to AWS DynamoDB

Using AWS Lambda to copy records into DynamoDB via the Libcloud library

James Montgomery

5 minute read

TL; DR

After a short break, I decided to take an item off the project list. DNS is a rich source of inspiration for me - and so I elected for a quick win in the form of serverless DNS records backup. The goal of which is to backup my DNS zone contents, via functions as a service (FaaS) and storage as a service (object or database).

You can find all the associated code for this on my GitHub page.

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. The trip computer, however, didn’t complete the set.

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

Have you ever wondered, how many unique digits are in a number? Alternatively, how many times does a given digit appear in a number? Using PowerShell, I explore these questions in a variety of means and examples.