Create an Alfred Workflow: the super simple URL shortener

Setup the basic Alfred workflow If you don’t have Powerpack for Alfred you might want to get it before you start, as none of this will work without it. Open Alfred Preferences, go to Workflows and hit the + button at the bottom of the list: For this workflow, we can start with an “Essentials” […]

Flask basics – setting environment variables

Lots of Flask tutorials recommend setting environment variables to protect any private information stored in the settings of the app. This is good advice, it only takes a moment of inattention to commit sensitive information to your GIT repo and then push it to a public place such as GitHub. If you’re using a virtualenv […]

Adding a shutdown button to your Raspberry Pi Flask App

If you’re running a Flask App on your Raspberry Pi in Kiosk mode you may find that you want to add a shutdown button to the ensemble so that you can switch the Pi off safely without having to SSH into it and manually issue the shutdown command. Based on Adding a Shutdown Button to […]

Flask basics: dynamically adding form elements

Sometimes you want to dynamically add elements to forms if certain information pre-exists. In this instance I wanted to add an option change the information displayed but I didn’t want the form fields to be there all the time and it was neater to simply not render them than remove them using JavaScript. Also, the […]

Silly strings: passwords in Python

I’ve been playing with Flask a lot in the last few days. If you’re going to do anything with sessions in Flask you first need to generate a secret key which you use to cryptographically sign the session. I got a tad bored of mashing the keyboard to generate them so I wrote a short script to […]

Python battleship

For the lovely ladies on my short Introduction to Programming course here is an answer to the code challenges at the end of the course, this is not the only answer, nor is it necessarily the best answer but it does work and has been thoroughly tested. The challenges were to add the following functionality to your […]