Archive

Archive for April, 2020

Downloading your SparkPost suppression list

One of the tools any bulk mailing service uses to maintain good list hygiene is a suppression list. This list contains bad email addresses, addresses that have repeatedly bounced or have other errors that if mail were allowed to be sent to those addresses, would bounce or classify the sender as a spammer.

Inside the SparkPost web console, you can search for individual email addresses to remove them from the suppression list. Unfortunately there isn’t a way to download a CSV file containing the entire list in the console. Thankfully you can download it via the command line, but help documentation only mentions curl – presumably the assumption being here that you are using macOS or Linux/BSD to manage things, or have access to the Unix tools. curl is available for Windows, but I wondered to myself if one could do the same thing in PowerShell. It took a while and a lot of mistakes, but I put together a script that does the same thing as the curl version and as a bonus converts the downloaded JSON formatted file into a nice CSV file for further analysis in a tool like Excel.

Copy and paste the following code into a text editor or the PowerShell ISE and save it with a .ps1 extension. You may need to change your script execution policy to bypass to run this script if you haven’t previously done so.

<#
NAME
SparkPost suppression list

AUTHOR
Craig Murray

SYNOPSIS
This script will download the SparkPost suppression list for your account in JSON format, then convert it to CSV format and delete the JSON file.

DESCRIPTION
I wrote this script because basically everything on SparkPost’s website and help documentation assume you are using macOS or a Linux distro with access to Unix tools.
It took a while but I managed to get this script up and running with a lot of reading up online.
The OS Version check is in place due to Windows 7 and 8 still supporting SSL in PowerShell, which will fail to connect to SparkPost’s site.
I am not experienced enough to understand why it doesn’t negotiate using TLS first, but the code below takes care of that. On Windows 10 out the box this isn’t an issue.

USAGE
Change the "XXY" text next to "Authorization" with your own valid API key for your account. You can also modify where the file ends up being saved though I find the
Desktop to be easiest and quickest place to save output file.

VERSION HISTORY
1.0 05 April 2020 – Initial release

LICENSE AND DISCLAIMER
You have a royalty-free right to use, modify, reproduce, and distribute this script file in any way you find useful, provided that you agree that the
author above has no warranty, obligations or liability for such use.

#>
$UPD = "$($env:USERPROFILE)\Desktop"
$OSV = (Get-CimInstance Win32_OperatingSystem).version
If ($OSV -lt "10240.16405")
{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
iwr -Headers @{‘Authorization’ = ‘XXY’} https://api.sparkpost.com/api/v1/suppression-list/ -OutFile $UPD\supplist.json
((Get-Content -Path $UPD\supplist.json) | ConvertFrom-Json).results | Export-csv -Path $UPD\Supplist.csv -NoTypeInformation
Remove-Item $UPD\supplist.json

I’m still very much an absolute newbie to the power and possibilities of PowerShell, but I hope that this could help someone out there.

Saying goodbye to an old friend

1200px-Windows_7_RTM_FINNot in English, but courtesy of Wikimedia Commons.

The above screenshot should be familiar to many, many people. I cannot recall the number of times I have seen it over the years since Windows 7 launched in 2009. Windows 7 is in many ways going to be the next Windows XP, clinging to life beyond what it was meant for. When Windows 8 didn’t get the reception Microsoft was looking for, 7 became the safe haven and refuge of users, much like XP was during the worst of Vista’s lifespan. Yet for all the love 7 got and continues to get, it was in many ways Vista SP3 or how Vista could have been.

What helped 7 a lot was also the fact that hardware had become more powerful by the time of its launch and manufacturers had finally started putting out stable drivers. Compared to the horror show that was the early life of Vista, 7 had it a lot smoother. Better defined minimum OEM logo specifications meant that OEM’s weren’t putting out at many computers with 512MB of RAM and calling it capable of running the OS with full bells and whistles. Processing power had also increased compared to Vista’s time.

Unfortunately as with anything that is 10 years old, the aches and pains have been exposed now for the world to see. Using 7 feels painful compared to Windows 10 and architecture wise there have been so many improvements and changes that 7 just feels old now. Still beautiful in its own way, but no longer fresh and exciting.

On January 14th this year, Microsoft put 7 to bed for everyone except those who were willing to pay for updates – large corporations and governments basically. At my school, I had been working towards this date for some time and thanks to the WCED donation of the Lenovo SFF PC’s I mentioned here I was able to come very close to my goal of being 7 free by that date. I didn’t quite make it, but I was able to keep chipping away at the remaining 7 boxes until I am now left with just 3 PC’s running 7. Sadly all 3 of those are in our finance department, which makes upgrading them a little tricky – time constraints and unique software makes it a challenge. Still, it is my hope to have them migrated by the middle of this year.

Although Microsoft started moving towards the cumulative update model for Windows 7, it was never as easy as Windows 10 has it. 7 has had a much longer lifespan and unlike 10, it doesn’t come in different builds – it’s one steady product. Bringing 7 up to speed patch wise is painful to say the least, especially since there was never a Service Pack 2 – Microsoft moved away from that method of updating their software sadly. Whilst there were a couple of convenience rollups and other large patch sets, it still got longer and longer to get 7 patched fully.

That being said, I am going to miss 7’s stability. The interface never changed, almost everything ran on it and as it aged it became very stable. Drivers were very mature and you could basically rely on it to get the job done. Still, time moves on and 7 has now earned not only its place amongst the great operating systems but also a very well deserved rest. Thankfully it’s become a lot harder to run 7 on modern hardware and driver support has largely dried up for new hardware. There will always be diehards who will run the OS to the bitter end, but I would strongly suggest people move to 10 as soon as they can – not only is it still supported with security patches, all of Microsoft’s attention is on 10 and the future.

Windows 7, thank you for all the years of computing and a mostly stable experience. Sit back and enjoy your retirement, you have earned it.

Categories: Software Tags:

In praise of HEVC

If you take a moment to think back through the history of video file formats in the computing space, words and abbreviations like AVI, DivX, XVid, MOV, Indeo, Bink, VOB and WMV will be familiar. As computers have gotten more powerful over the years and internet connections faster, it became possible to playback and share higher and higher resolution and quality video files. Unfortunately like most things in computing, there was no one standard above all, so we had this competing mess of file formats.

It was pretty ugly, having to have multiple software applications installed to play different formats. Later on sanity prevailed with the rise of codec packs and “universal” player applications like VLC, but the situation was far from perfect. With the rise of Blu-ray video in the late 2000’s, AVC or H.264 video encoding rose to the top of the pile for convenience, support, space saving and compatibility with thousands of devices. Bar some legal issues around patents and so on which for a long time prevented FireFox from playing the format, AVC appeared just about everywhere.

Compared to what came before it, AVC was awesome. The space savings you could gain by transcoding your old videos into this format was a revelation for me. Sure it took lots of time, especially if you used software based encoding, but the space savings alone made it worth while. Not only that, but you would end up standardizing all your videos in one simple format, needing to worry less about codec packs or player compatibility.

However, as the years rolled on and CPU power increased again, software developers and computer scientists believed they could go even further to squeeze more than AVC does, at the trade off of higher encoding times. Enter the High Efficiency Video Codec – HEVC – also known as H.265.

HEVC hasn’t quite supplanted AVC the way AVC supplanted the other formats, mainly due to a messy legal situation regarding patents and confusing licensing options. Hardware support is also something that only recently started catching up in devices like phones, tablets and graphics cards. Hardware decode, especially in battery powered devices, is essential as the CPU burden otherwise would be a battery killer. HEVC is also about to go through a format war with the AV1 standard, who counts some of the biggest tech companies as backers due to far less legal complexities. Who will win remains to be seen.

There is also the matter of software support. HEVC is available now and has been mature for some time. Encoders and decoders are mature, well understood and highly tuned. AV1 is only now starting to settle down and software support is still scant compared to HEVC. Handbrake has just enabled decoding of AV1 files in their latest release but still doesn’t let you encode the files as yet – that will come in a future release when the devs think that the performance of the encoder is in a usable state.

On the flip side however, HEVC offers 2 advantages to AVC:

  1. Compress a video at the same quality settings as AVC, for roughly half the file size, sometimes even much more OR
  2. Have video content roughly twice the running time for the same file size as AVC, depending on encoding options.

I’ve been transcoding my video collection into HEVC from my existing sources, which ranges from AVC MP4 files to the letter soup of file types mentioned at the start of this post. Transcoding via Handbrake on my Ryzen 2700x CPU gives the processor a sweat, but the resulting file size improvements has been quite astonishing at times. With no quality loss that my eyes could see, there have been times when the output file is a THIRD of the size of the source file!

My closing point is this: transcode your videos into this format if you have the time and capability to do so. Whilst the format is patent encumbered, its technical merits are plain, the format is mature and you can enjoy the benefits right away. There really isn’t much reason to still be using the alphabet soup of old codecs anymore.

Categories: Software Tags: , ,