Tech

A couple of small projects


I actually completed a couple of small projects this month! For someone who absolutely hates DIY I really enjoy it when I get the chance to physically make something. I think the pressure gets to me when it’s a DIY job, with any mistake immediately obvious to anyone else in the house and potentially very expensive to fix. But if I’m just making something creative for myself or as a gift then I can relax and enjoy it a bit more. It was with this in mind that I approached a gift for my wedding anniversary. 

The finished gift

After some extensive idea browsing I settled on a decorative mile marker signpost. I mulled it over for a few days and figured all it would need was a nice 3D frame to present in and some small cuts of balsa wood to make the sign post. The sign itself would have the towns where we’ve lived and a couple of important holiday locations (where we got engaged and where we spent our honeymoon), along with the distance in miles from our current home.

Unusually for one of my projects, it turned out to be as simple as I hoped and I was pretty pleased with the end result. A sharp knife cut the balsa into shape, a fine liner worked for the sign writing, and some wargaming texture grass for decorating figures added a bit of colour.

All was going really well until the week before our anniversary when my wife mentioned it was six years since our wedding, not the five I’d been certain it was. Which meant this year’s theme should have been iron, not wood. We laughed. Well, I laughed then had to explain what was so funny.

Thankfully despite my failure to count to six, the sentiment was very much appreciated and my wife loved the present in the end!

The second project I managed to finish used a completely different maker discipline, a bit more in my comfort zone. I’ve been playing with the Raspberry Pi computer for a year or two now and while I’ve had a lot of fun I haven’t finished a useful project for it yet. However a couple of weeks of frustrating poor service from Scotrail inspired me to finally put a Raspberry Pi Zero and a Pimoroni Inkyphat eInk screen to good use.

My plan was to have a small screen on my desk at work which would refresh periodically through the day with any service updates from the train operator, specifically for trains on my route home.

Sadly one of those trains was my way home

Scotrail operate a Journey Check website which lists all service updates in a fairly basic view. I could try and strip the data directly from there, but there is a better way. They also have the same page available as an RSS feed.  

I knocked up a short Python script using the Feedparser library to pull the RSS feed for my commuting route and then throw the page title, number of train updates, and the train details into some variables. These are then displayed together on the Inkyphat.  

The result is pretty good, though the limited screen estate of the Inkyphat means I lose some details off the edge. This is a fair trade for readability of the important train times though.  

Lastly I set a crontab to run the script every fifteen minutes and then placed it on my desk when I got to the office.  

Not to miss an opportunity, Scotrail duly cancelled various trains through the day including the one I had planned to take home. It was a bittersweet moment when I came back from lunch to see the screen had updated and my normal train was listed.

For those that might be interested in doing something similar, the code for the Python script is posted below.  

import inkyphat
from PIL import ImageFont
import feedparser

#Set font to use on the Inkyphat
font = ImageFont.truetype("/usr/lib/python3/dist-packages/inkyphat/fonts/Montserrat-Regular.ttf", 12)

#set the URL for the RSS feed - Scotrail's journey check between Aberdeen and Stonehaven in this case
scotrail_rss="http://rss.journeycheck.com/scotrail/route?action=search&from=ABD&to=STN&period=today&formTubeUpdateLocation=&formTubeUpdatePeriod=&savedRoute="

#parse the RSS feed with feedparser
f=feedparser.parse(scotrail_rss)

#pack variables with the feed tag data
head=f.feed.title
updates= str(len(f.entries)) + " updates"
service = ""
for train in f.entries:
  service=service + train.title + "\n"

last_update=str(f.feed.published)

#uncomment two lines below to print output to screen for debugging
#message = head+updates+service+last_update
#print message 

#prepare lines for inkyphat
inkyphat.text((1, 1), head, inkyphat.RED, font)
inkyphat.text((1,10), updates, inkyphat.RED, font)
inkyphat.text((1,20), service, inkyphat.BLACK, font)
inkyphat.text((1,80), last_update, inkyphat.RED, font)

#write to Inkyphat
inkyphat.show()


Advertisements
Health and fitness, Tech, Thoughts

Enjoying a Twitter break.


I’ve had a love/hate relationship with Twitter for a while now. Long gone are the days when it was a place of curiosity where we would marvel at celebrities tweeting while stuck in a lift or when the most serious tweets revolved around what to have for tea.

Now the site feels like a hotbed of trolls, racists, and racist trolls (or the US President as he’s commonly known).

I have a tendency to over-think things and get fixated on topics. Which makes it really easy for me to get sucked down rabbit-holes of Twitter hashtags full of abuse, conspiracy theories, and total fuckwits. I also developed a habit of just sitting on Twitter as my default position, either on my phone on the train or sat on the sofa at work. All that exposure to the extremes of human opinion is not good for my mental health.

Two weeks ago I deleted the app from my phone and got rid of any Twitter and Tweetdeck bookmarks in my browsers. I could still go to the site, but it means I have to type the address in manually. A small, but critical step in preventing me just auto-piloting on to Twitter when my brain goes into neutral. So far it’s worked. I can count on one hand the number of times I’ve dipped my toe back in and that was just for a few minutes or to read a specific tweet.

Has it helped? Has going cold turkey from Twitter improved my mood? Absolutely.

Aside from the obvious benefit, not being exposed to a whole lot of idiots and their opinions which make me feel angry, I’ve found myself making much more constructive use of my spare time at home. Picking up projects and hobbies I didn’t have time for recently and being a lot more available for interactions with the kids and my wife. In fact it’s not until doing an exercise like this that I realised just how bad I was for shutting everyone out while I sat idly scrolling through Twitter.

That’s not to say that quitting Twitter has cured me of any of my mental ailments, it hasn’t, but it does stop me from actively seeking out content online which is only going to make me sad, depressed, and angry. Which can only be self-destructive in the long-term.

Am I finished with Twitter completely? Well probably not. There are good people on Twitter and some genuinely good content to be found. At it’s very best it can be used to spread positive messages and wonderful frivolous fun moments. Lately though those pearls are much harder to find.

For now I’m staying clear but when I do return I’m going to have to do some heavy pruning of my followers list to change the kind of content I see on my feed. Until then I’m going to enjoy spending my time away from the gathering of the internet’s worst people and spend more time being creative, engaging with real people, and doing the things that actually make me happy.

I might even manage to start writing again.