duncanlock.net
Flag of Brazil

I’ve recently been corresponding with Denny Dias, from Brazil, who’s converted his blog over to Pelican - and we’ve been helping each other out a bit with building themes and whatnot.

He’s written up his conversion & theme building process - and was generous enough to credit me after he borrowed some of my theme’s logic, from this blog’s GitHub repo.

As he’s such a nice guy - and as I’ve just borrowed his tagsort jinja filter for my blog’s tag page, I though I’d return the favour - cheers Deny! :)

Continue reading “Obrigado Deny!”

Continue reading “The smart guide to optimizing images for the web: Zero to Hero”

I’m going to build on Jamie Zawinski’s excellent advice about backups, which you should read first. This is basically that, but with some extra bits. If this seems too complex, then just do what he says.

The plan is to use Backupninja to backup everything to an external USB drive – and also to Amazon S3 or Dropbox, depending on what it is. Backupninja provides a centralized way to configure and schedule many different backup utilities, just by dropping a few simple configuration files into /etc/backup.d/.

I have a multiple hard disk setup for my desktop Linux box - my /home folders live on one disk and / lives on another one. I don’t want to backup everything from the system disk - I can re-install it in 10 mins, and I don’t really want to complicate this …

Continue reading “Comprehensive Linux Backups with etckeeper & backupninja”

I recently needed to convert some FLAC music files from the increasingly common 48 bit encoding, down to 16 bit at 44100 kHz, so that they’ll play on my Sonos. Here’s how to do it:

If you don’t already have sox installed, do this to install it:

$ sudo apt-get install sox

Then run this to do the conversion, in the folder with music in:

$ mkdir resampled
$ for flac in *.flac; do sox -S "${flac}" -r 44100 -b 16 ./resampled/"${flac}"; done

And that’s it - it will convert all the .flac files in that folder to 16 bit at 44100 kHz and put the result into the ./resampled subfolder, preserving the metadata.

Continue reading “How to convert FLAC files from 24/48 bit to 16 bit on Ubuntu Linux”

Interesting things I found

  • There’s a fair bit of ‘Testing, 1, 2, 3’ type posts, especially early on
  • Author names aren’t trimmed, so they can have leading and trailing white-space and embedded newlines in them.
  • None of the early articles have categories - I think this feature was added later.
  • There’s a really long warm up period - almost a year, until May 2013 when things really take off.
Continue reading “Building Seance - a peek inside Medium.com”

A trip report from our Canada Day 2013 long weekend kayak camping trip to Thormanby Islands, Smuggler Cove & Secret Cove, on the sunshine coast.

thormanby trip map
Figure 1. We started at Welcome Beach on Saturday afternoon, kayaked over to Thormanby for lunch, then up and round to Buccaneer Bay - stunning camp on the dunes, then over to Smugglers Cove on Sunday. Camped there Sunday night, with a trip to Secret Cove in the afternoon, then back to Welcome Beach on Monday morning. (Map screenshot courtesy and copyright Google Maps. Annotations added by me.)

Welcome Beach to Thormanby

On Saturday morning, we packed up our tent & got picked up by Erika from Talaysay Tours, who drove us, with the Kayak on the roof, to Welcome Beach, about 15 mins further up Highway 101, past Sechelt.

We unloaded the Kayak, took it down to …

Continue reading “Sunshine Coast: Thormanby Islands & Smuggler Cove Kayak Trip”

The Pelican quickstart site that we created in Part 1 used the default theme - which you will probably want to change or, at least, customize. In this post I break down the Pelican theme I created for this site and show you exactly how it’s built. I’ll be going through each part of the theme in depth, explaining why I did things that way and how each part works.

The theme for this site is professional grade - high quality, polished and responsive. It puts the focus on the reader, is 100% easy to read and works flawlessly at any screen size, including mobiles & tablets. It also takes into account best practices for both social media and Problematic, check error messages! : :abbr:`SEO (Search Engine Optimization)`, so that you can make the most of your writing.

Unknown interpreted text …

Continue reading “How I built this website, using Pelican: Part 2 - Themes”

Compressing Limited Colour PNG images

Most of the .PNG files on this site are the ‘blueprint’ style diagrams, like this one:

Blueprint style diagram showing an optical microscope. The sample inside is magnified in a bubble to 2500 times
Figure 1. This illustration is a large 5.6MB SVG file, mostly because of the very detailed paisley pattern that I used. Exported to PNG - and then compressed using the process below, you can get this down to 118.5kB.

I create these in Inkscape as vector .SVG files & export them to bitmap .PNG files. I then re-compress them, to ensure that the image files that are used on the live website are as small & quick to load as possible.

As these diagrams have a fairly limited colour palette, I can get lots of extra compression by reducing the colour depth of the final .PNG files from the default 32bit (millions of colours) to 8bit (256 colours) - without any …

Continue reading “How I compress PNG files on this website”

Thunar's icon

Thunar - XFCE & XUbuntu’s small but perfectly formed file manager - has a simple mechanism that allows you to easily add new commands to the right click menu of files and folders. These are called Custom Actions and are easy to create…​ here’s how to do it.

Click the Edit menu, then click ‘Configure custom actions…​‘. This will take you to the Custom Actions Manager, where you can create, edit or delete your custom actions.

You can enter anything into the command box, including complex bash scripts, names of scripts or executables on the PATH, or the full path and filename of the command you want to run.

thunar custom actions edit 1

On the ‘Appearance Conditions‘ tab, you tell Thunar when you want your item to appear in the right click menu:

thunar custom actions edit 3
Figure 1. Now, when I right click on a text file, I …
Continue reading “Useful Thunar Custom Actions”

This is a Pelican plugin to calculate various statistics about a post and store them in an article.stats dictionary. You can see this in action in the sidebar on the left of this site.

Nice touch from medium.com - now available in Pelican.

I wanted to implement the nice little “X min read” thing from Medium - and it turned out that it was easy to provide a few other interesting stats at the same time, for people to use in their templates.

The returned article.stats dictionary contains the following:

  • wc: how many words
  • read_mins: how many minutes would it take to read this article, based on 250 wpm
  • word_counts: frequency count of all the words in the article; can be used for tag/word clouds
  • fi: Flesch-kincaid Index/ Reading Ease
  • fk: Flesch-kincaid Grade Level

For example:

{
    'wc': 2760,
    'fi': '65.94',
    'fk': '7.65',
    'word …
Continue reading “Post Statistics Plugin for Pelican”