Blog

A dumping ground for my thoughts, code explanations, and rants.

OctoPrint with the Prusa MK3S / MK3S+ and the MMU2S
Sun, 27 December 2020

Getting OctoPrint to work with the MMU2S took a bit of investigation. I was having errors saying that T0 tool did not exist. Turns out you have to tell OctoPrint that there are 5 extuders, but it's also a shared nozzle.To get to this, click settings at the top of OctoPrint, go to Printer Profiles on... read more

My .gitconfig and .gitignore files
Mon, 30 March 2020

My .gitconfig file.[user]   name = Roger Thomas   email = <my>@example.com [core]   excludesfile = /Users/me/.gitignore   editor = nano   whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol [push]   default = current [status]   branch = 0   short = 0 [alias]   comit = commit ... read more

git
Extract tar or just a gzipped file on Linux
Mon, 23 March 2020

Quite simply, compressing and decompressing files on Linux is incredibly easy, albeit that developers and sysadmins seem to be forever searching the web for the commands.To decompress (untar) a tar.gz archive:$ tar -xzf archive.tar.gz If you've got a gz (gzipped) file, the command would be:$ gunzip... read more

Show the octal file permissions from Linux command line and Mac terminal
Mon, 23 March 2020

It's helpful to have an understanding of file permissions on a unix system. I've seen all too regularly someone just wildly issue a 777 of an entire directory.Performing just a list of files, for example with `ls -la` or for those of us who use aliases, `ll`.Thankfully, there's a much easier way. It... read more

Mounting Google Cloud Storage as a local path on Mac
Mon, 04 February 2019

There's a rather nifty project from Google to allow mounting of a Google Cloud Storage bucket on Mac. This is incredibly useful for quickly browsing or transferring files between your local machine and the bucket.The entire setup takes around 10 minutes (from fresh install), but it's worth the time.... read more

mac
Google Cloud Functions with Python 3.7
Thu, 26 July 2018

Google's just brought out beta support for Python 3 in their Cloud Functions offering. Getting started is easy.First, make sure you've got your requirements.txt file with the following:requests==2.19.0 numpy flask Then, your main.py file should look like this:from flask import Flask app = Flask(... read more

Fixed: urllib2 Google App Engine - HTTPException: Invalid and/or missing SSL certificate for URL
Thu, 12 July 2018

Using urllib2 on App Engine generates an exception locally using dev_appserver.py when connecting to SOME SSL enabled URL's.The exception looks like this:Traceback (most recent call last):  File "my_py_file.py", line 20, in example_method   response_data = urllib2.urlopen(request, timeout=30, cont... read more

ssl
Writing a Windows 10 ISO to USB on Mac
Fri, 10 November 2017

I recently needed to write a Windows 10 image to USB using Mac. And found this handy answer on StackExchange - https://apple.stackexchange.com/questions/103874/creating-a-bootable-usb-of-windows-8-1-on-os-xYou'll notice that these instructions are for Window 8.1, but I've confirmed they still work f... read more

usb
Validate file size in Javascript / jQuery
Fri, 03 November 2017

Sometimes you need some rather basic validation of file size. I had to write this for a project recently, where I needed to check the file size prior to upload.After doing some digging around I came up with a cross browser solution (Safri, IE, Chrome, Firefox) that works quite well. In my example, I... read more

Automatically convert line endings on commit in git (and save yourself when you've already made a mistake!)
Wed, 27 September 2017

We've all been there. Used a piece of code and discovered some funky line endings. You should really always use \n for a new line. Unfortunately, this isn't as widespread as we'd all like, and furthermore isn't enforced.So you go to do a git diff and you see something like this:Rogers-MacBook-Pro:co... read more

git
mac