Hello!

I’m very busy! So here’s what I’ve been up to.

Spiny

Some years ago I wrote a VSTS Task that would update the version number of a module prior to it being published to PowerShell Gallery (and more on this site later.) I spent a lot of time on it and wrote a bunch of very awkward tests around the PowerShell, but had the test pipeline running on different agents to make sure the plugin would work on those agents. Or at least so I thought. Come to find out that tasks seem to be not as flexible as, say, writing a PowerShell module or a python library. It’s also much harder to package. And impossible to run locally. And really other than providing something pretty for a clicky clicky UI, which is now redundant thanks to yaml, I decided to archive the task and get all the actual useful code into a PowerShell module that can be run on any build agent and is much easier to test, run locally and package/publish.

The new module is called Spiny, because of the spiny shells in Mario, and it’s written in PowerShell. Tenuous name aside, it is now much easier to use, and it has Pester tests, and code coverage and test results. Owing to the fact that I need to use a PAT it is in a private project in Azure DevOps.

testrun

Given how small the module is I should be hitting 100%, but it is good enough for now.

testcoverage

And I even wrote a how-to in the readme. And in a truly bizarre, yet ultimate form of dog-fooding/doing the DevOps, the yaml template in the Spiny repo uses Spiny itself to publish Spiny!

- task: PowerShell@2
    condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
    displayName: "Publish to PowerShellGallery"
    inputs:
      targetType: "inline"
      script: |
        Install-Module Spiny -Scope CurrentUser -SkipPublisherCheck -Force -Verbose
        Import-Module Spiny -Force -Verbose
        $moduleNumber = Edit-SPModuleVersionNumber -ModuleVersionNumber $env:VERSIONNUMBER -psd1File $(Build.ArtifactStagingDirectory)/Spiny/Spiny/Spiny.psd1
        Publish-SPPackageToPowerShellGallery `
        -apiKey '$(apikey)' `
        -path $(Build.ArtifactStagingDirectory)/Spiny/Spiny
      pwsh: true

Parisienne

But hold off arranging that parade just yet, I have taken the plunge and also written a Visual Studio Code theme!

Let’s be honest, Night Owl is the best theme for VS Code. And at the risk of sounding like a hipster, I have used it since the early days of it being available.

However, a change is as good as a rest, so I started browsing around other themes. I like dark themes (and I suppose admitting that confirms my hipster status), and all of them are very pretty, but I thought a bit too similar to what I was already using. Then I came across Spectral Glow, that was both dark and yet minimal, with a single bold colour. And I started using it, and whilst I really like it, it was too minimal for my fussy tastes.

At this point I had two choices: customise the theme locally in settings, or create my own theme. The third choice I suppose would be to do nothing, but I wasn’t interested in that. And but so despite being somewhat busy, I decided to have a go at my own theme. Rather thoughtfully, the author of Night Owl has also written a how to create a vs code theme post. And because I have written my own VSTS Task (see above) I already havea publisher profile on VS Marketplace, so I was able to skip that step. Although I did have to update the PAT that is used, and I had to use the same PAT in the pipeline.

And in addition to the excellent write up on creating a VS Code Theme, the author of Spectral Glow also shared their code on GitHub. So in a very short space of time I had created a repo, generated the scaffolding, and copied the repo I had wanted to customise to create my own theme. Nice.

I chose Paris Green as my main colour if only because I like it (#50c878 for you colour nerds), and using the internet I was able to find a shade of orange that complimented it. I made some slight alterations to the main dark shade used in the theme to be a bit more green, got the line numbers showing up a bit better, and bosh it is published.

vs code marketplace

Again there is a pipeline, and happily I am able to specify a version number when publishing so I don’t have to do anything awkward with the version number stored in the package.json. One thing that is noteworthy is that in the vsce publish command there is an option to set a githubBranch. And this is important because by default new repos are created with a main instead of a master. And when the vsce package command is run, a copy of the readme is used to create the Overview/Details tabs.

plugins vscode

The publish command uses the package.json to figure out where your repo is, and by default sets the branch to master to help reference any objects in your readme, like an image for example. In fact if you use an image or have other items in other branches you can even use one of these two options to set their branch. This was something that had me stuck for a bit until I took a look at the code of vsce on GitHub and unzipped the vsix myself to see what was occuring. I also have to thank Gavin Campbell for helping me out on this one as TypeScript is not something I am familiar with.

I have the repo open and am making minor changes as I open new file types and see things I don’t like. The fact that I made an Azure DevOps pipeline again means that chagnes are easier to push as I don’t have to keep remembering to increment the version number by one and the PAT is stored in a private repo so I won’t lose it.

Pi Hole

Some time last year, I splashed out and bought a decent router. I didn’t buy it because it looked like a space ship, but neither was that a negative. I bought it to replace the standard BT router, which although perfectly decent, it did not have the capabilities from a router management perspective. Basically, I wanted to use Pi-Hole for the whole network, and rather than having to configure every single devices DNS, I wanted to do it on the router, which I now have done. And Pi-Hole is amazing. It’s running on a Raspberry Pi from 2014, and it is still amazing.

pihole

But I also wanted to take this to the next level and set up a VPN on a Raspberry Pi and route my phone and Sy’s through the Pi-Hole whilst we’re out and about, because I don’t trust free wifi (nothing is free in the fiscal sense, unlike my code which is free in the “libero” sense) and I like the idea of being able to SSH into the Pi-Hole even if I’m not on my network. And my new router has the capability to set a Static IP address, which the BT router could not do, so I could set it up.

As far as the VPN software was concerned, I chose PiVPN and enabled WireGuard, and have the WG app installed on my phone. What is so amazing about PiVPN is that you can create a profile on the Pi and then generate a QR code to make it easy to set up on a phone. The one thing I had to do was set up port forwarding to the Raspberry Pi that runs PiVPN, but again the router can do that quite easily.

Overall I’m really impressed with the router and how well a Pi that cost £30 brand new and is 6 years old is supporting the network. I’d definitely recommend all of these things to anyone, just so long as they don’t expect me to set it up and manage it for them!

Speaking of things that I am really impressed with; the same cannot be said with PowerShell Gallery. It has bascially been pretty rubbish for some time now. The banner about stats beging broken has been up there for so long I forgot a time when it was not there. It has had major outages through most of October, and I think that although it has settled down it is because they have undone the change they were trying to make to “fix the stats”, which no well-adjusted person whould care about anyway.

holy smokes

And I’m cross about it because if you use PS Gallery as a place to store packages, and you rely on the availability of said remote package repo for your builds/releases/ to work, then it is a bit galling to see it have such performance issues because, quite frankly, clients don’t care enough to want to understand that it is not the fault of people who are using it. Until that, is, it is using it that becomes the problem. For me PSGallery has now got a lousy reputation, and it’s difficult to trust in using it. I used to publish to Nuget as well, and I might start doing that and use that as a backup in all my builds, which is hardly ideal.

R-Pi 400

One day back in the summer I turned my laptop on and went to make a tea, and when I got back I realised it had loaded into the Ubuntu image. And rather than log off and boot into Windows I decided to see how far I could get in my day using Ubuntu. Fast forward some 4/5 months and I’m still using Ubuntu, and I’m really happy with it. I’ve used linux for years, but never as my “main”, to coin a phrase the kids use. It wouldn’t have been feasible 10 years ago, being that most clients I work with are Microsoft workshops. But now with Microsoft “loving” Open Source it is, and it’s still going really well.

And so the recently when I bought myself an R-Pi 400, I was interested to see if it could work as a) my daily machine or b) a thin client for me to RDP into either my desktpo or maybe a VM in Azure. It’s a neat looking little thing as well, which coincidentally the blurb says.

raspberry pi 400

2 weeks into the experiement and I fear that it might be slightly too thin for it to be used in this way. And as far as a daily machine goes the main issue is that online meetings require more grunt than it can offer, which is a shame. Plus ARM-based software is a step behind that of x86/x64 right now (we’ll see how true a statement this is in 3 years.) So I’m back on my laptop. However I do have it in a draw next to my desk and during my Christmas break I intend to get it out and see what fun I can have with it.

There’s loads of other things I haven’t spoken about, not least how over the year we have landscaped our garden on a budget of whatever I can find down the back of the sofa cushions, but seeing as that’s nottech-related I might leave that for another day. But I’m also working on another ASCII Art generator, and need a place to host an image, so the end of this post is as good as any!

raspberry pi 400