<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Scripting on James Montgomery</title>
    <link>https://gh-jamesmontgomery.github.io/pages-blog/categories/scripting/</link>
    <description>Recent content in Scripting on James Montgomery</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <lastBuildDate>Thu, 14 Oct 2021 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://gh-jamesmontgomery.github.io/pages-blog/categories/scripting/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Introducing Station Finder</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2021/10/introducing-station-finder/</link>
      <pubDate>Thu, 14 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2021/10/introducing-station-finder/</guid>
      <description>&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;h2 id=&#34;introducing-station-finder&#34;&gt;Introducing Station Finder&lt;/h2&gt;&#xA;&lt;p&gt;Station Finder is a single-page application. The goal was to provide a means to locate a fuel station.&lt;/p&gt;&#xA;&lt;p&gt;Initially, you select a postcode and choose from a dynamically populated list of station results.&lt;/p&gt;&#xA;&lt;p&gt;A station selection updates the objects on the page to reflect the station choice.&lt;/p&gt;</description>
    </item>
    <item>
      <title>API Diversions</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2021/01/api-diversions/</link>
      <pubDate>Wed, 13 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2021/01/api-diversions/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;Recently reinvigorated with my new &lt;a href=&#34;https://gh-jamesmontgomery.github.io/pages-blog/2020/12/new-ui-for-my-text-to-speech-player/&#34;&gt;UI work&lt;/a&gt;, I set myself to task with simplifying the front end player code. No matter how I looked at it, I&amp;rsquo;d needed to rewrite the back end API to support a front end rewrite. But what if I didn&amp;rsquo;t precisely need to do that? Enter stage left, Cloudflare Workers.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;    &#xA;&#xA;    &#xA;    &#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;    &#xA;  &#xA;&#xA;&#xA;    &#xA;&#xA;    &lt;div class=&#34;box alt&#34;&gt;&#xA;        &lt;div class=&#34;row uniform&#34;&gt;&#xA;        &#xA;        &#xA;        &#xA;            &#xA;                &lt;div class=&#34;1u&#34;&gt;&#xA;            &#xA;            &#xA;        &#xA;            &#xA;                &#xA;                    &#xA;                    &lt;span class=&#34;image fit&#34;&gt;&#xA;                &#xA;            &#xA;            &#xA;        &#xA;            &#xA;                &#xA;                        &lt;img src=&#39;https://gh-jamesmontgomery.github.io/pages-blog/img/2021/01/cfw-proxy-1.png&#39;&#xA;                            alt=&#34;Comparison of beta with the worker as proxy and handling query translation.&#34;&gt;&#xA;                    &lt;/span&gt;&lt;/div&gt;&#xA;                &#xA;                &#xA;            &#xA;            &#xA;        &#xA;        &lt;/div&gt;&#xA;    &lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Below I explain how I arrived at this. If you would like to view the Worker code, you can do so &lt;a href=&#34;https://github.com/gh-jamesmontgomery/cloudflare-workers/blob/main/api-proxy/tts-api-translate.js&#34;&gt;here&lt;/a&gt;. If you would like to view the sites (and compare), you may do so here:&lt;/p&gt;</description>
    </item>
    <item>
      <title>A Serverless text-to-speech player for jokes and quotes</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2020/03/a-serverless-text-to-speech-player-for-jokes-and-quotes/</link>
      <pubDate>Tue, 31 Mar 2020 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2020/03/a-serverless-text-to-speech-player-for-jokes-and-quotes/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://tts-ja.mesmontgomery.co.uk/&#34;&gt;https://tts-ja.mesmontgomery.co.uk/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can get a preview of the joke quality here:&lt;/p&gt;&#xA;&lt;!-- markdownlint-disable MD033 --&gt;&#xA;&lt;p&gt;&lt;audio controls&gt;&lt;source src=&#34;https://gh-jamesmontgomery.github.io/pages-blog/audio/AWS-TTS-20-four-engineers.mp3&#34; type=&#34;audio/mpeg&#34;&gt;Your browser does not support the audio element.&lt;/audio&gt;&lt;/p&gt;&#xA;&lt;!-- markdownlint-enable MD033 --&gt;&#xA;&lt;p&gt;Note: I can&amp;rsquo;t affect the humour quality 🤣.&lt;/p&gt;&#xA;&lt;h2 id=&#34;solution-overview&#34;&gt;Solution overview&lt;/h2&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Backup of Cloudflare DNS to AWS DynamoDB</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2020/02/backup-of-cloudflare-dns-to-aws-dynamodb/</link>
      <pubDate>Fri, 21 Feb 2020 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2020/02/backup-of-cloudflare-dns-to-aws-dynamodb/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;You can find all the associated code for this on my &lt;a href=&#34;https://github.com/gh-jamesmontgomery/cloudflare-dns&#34;&gt;GitHub page&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Detecting digit combinations in a number with PowerShell</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/12/detecting-digit-combinations-in-a-number-with-powershell/</link>
      <pubDate>Thu, 05 Dec 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/12/detecting-digit-combinations-in-a-number-with-powershell/</guid>
      <description>&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;How do you pass the time on a car journey? Most of us have memories of &amp;ldquo;I spy&amp;rdquo; or other game.&lt;/p&gt;&#xA;&lt;p&gt;Lately, I&amp;rsquo;ve been looking out for number combinations after a car I owned passed 123k miles - specifically 123456 miles. What&amp;rsquo;s more, the trip computer almost made it read 1234567890!&lt;/p&gt;&#xA;&lt;p&gt;As time passed, I was looking out for other odometer readings. 123465 miles was the next number of interest. The trip computer, however, didn&amp;rsquo;t complete the set.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Detecting Digits with PowerShell</title>
      <link>https://gh-jamesmontgomery.github.io/pages-blog/2019/10/detecting-digits-with-powershell/</link>
      <pubDate>Mon, 28 Oct 2019 00:00:00 +0000</pubDate>
      <guid>https://gh-jamesmontgomery.github.io/pages-blog/2019/10/detecting-digits-with-powershell/</guid>
      <description>&lt;h1 id=&#34;table-of-contents&#34;&gt;Table of contents&lt;/h1&gt;&#xA;&lt;div class=&#34;toc&#34;&gt;&#xA;    &lt;nav id=&#34;TableOfContents&#34;&gt;&#xA;  &lt;ul&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#tl-dr&#34;&gt;TL; DR&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#how-to-think-about-the-problem&#34;&gt;How to think about the problem&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#working-with-a-number-in-powershell&#34;&gt;Working with a number in PowerShell&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#systemmathdivrem&#34;&gt;[System.Math]::DivRem&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-divrem-to-detect-a-digit&#34;&gt;Using DivRem to detect a digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-divrem-to-detect-a-range-of-digits&#34;&gt;Using DivRem to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#contains&#34;&gt;Contains&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-contains-to-detect-a-digit&#34;&gt;Using .contains() to detect a digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-contains-to-detect-a-range-of-digits&#34;&gt;Using .contains() to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#match&#34;&gt;Match&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--match-to-detect-a-specific-digit&#34;&gt;Using -match to detect a specific digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--match-to-detect-a-range-of-digits&#34;&gt;Using -Match to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#split&#34;&gt;Split&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--split-to-detect-a-digit&#34;&gt;Using -split to detect a digit&lt;/a&gt;&lt;/li&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using--split-to-detect-a-range-of-digits&#34;&gt;Using -split to detect a range of digits&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#ascii-method&#34;&gt;ASCII Method&lt;/a&gt;&#xA;      &lt;ul&gt;&#xA;        &lt;li&gt;&lt;a href=&#34;#using-the-ascii-value-of-a-character-to-detect-unique-digits-in-a-number&#34;&gt;Using the ASCII value of a character to detect unique digits in a number&lt;/a&gt;&lt;/li&gt;&#xA;      &lt;/ul&gt;&#xA;    &lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#conclusion&#34;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;a href=&#34;#acknowledgements&#34;&gt;Acknowledgements&lt;/a&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/nav&gt;&#xA;  &lt;/div&gt;  &#xA;&lt;h2 id=&#34;tl-dr&#34;&gt;TL; DR&lt;/h2&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
