Matthew Ames

Category: Uncategorized

Theme update

I have recently been working on updating the theme on this site so that it feels comfortable for me to use, as I’m the one most likely to dive in and re-read the articles I’ve put in. In doing so, I have managed to strip out Twitter Bootstrap entirely, and put in my own CSS as I’ve needed it. It’s certainly not a complete framework, like Bootstrap, but it serves my needs, and I’m sure it’ll be updated over time.

Further to the visual changes, I’ve also added Disqus commenting. This is for three reasons:

  1. You don’t need a log in for my site or wordess, meaning anyone can comment,
  2. It’s decentralised, meaning that if Disqus notice a spam attack, they will deal with it, rather than me, and
  3. Because I couldn’t be bothered to write the php, html and css for comments, when Disqus fits well already.

The site has been confirmed as working on the latest versions of Firefox and Chrome. I haven’t tried anything else, but I may give Edge a go later.

Republicizing a Jetpack post

If you find you need to republicize a blog post through Jetpack which for some reason couldn’t be sent the first time it was published, you can quickly fix it with some database tweaking.

First of all, you need to know the id of the post. Edit the post through the admin section, and the post id will be a number in the url bar, after “post=”. Next you set the status of the post to Draft, and update the post. This will make it disappear from the site for a second.

Now you need to goin database diving. With the post id at hand, you need to run a query like the below, raplceing the post_id with the one you found eariler.

MariaDB [database]> select * from wp_postmeta where post_id=144 and meta_key="_wpas_done_all";
| meta_id | post_id | meta_key                | meta_value   |
|     293 |     144 | _wpas_done_all          | 1            |
1 row in set (0.00 sec)

The next phase is to update the the value so that it reads a zero instead of 1, which will then allow you to republish the page. The mysql for this is as follows, only this time you have to set the correct meta_id to the one listed in the output you received. In my case, this is 293.

MariaDB [database]> update wp_postmeta set meta_value=0 where meta_id=293;

Finally, head back to the post editing page and publish the page again.

Revert tracking protection back to ON for all sites

Previously I discussed how to turn on Tracking Protection in Firefox, which has been a great boon to my browsing activity. The problem with this is that Firefox doesn’t have any way of letting you know what sites have had tracking protection disabled, so you can visit a site with tracking protaction turned off without realising it. Fortunately, Firefox stores a lot of it’s information in sqlite, which is an easily modifiable format.

The first thing you’ll need to do is find your Firefox profile path. You can do this by typing about:profiles in to your browser url bar. Look for the “root directory”, and that’ll be where you profile is stored. It is important that you now close firefox completely, otherwise the permissions will not take affect.

Now, with your favourite Sqlite3 editor, you simply need to open permissions.sqlite and run the following query:

select * from moz_perms where type = "trackingprotection" and permission=1;

This will list every site which has Tracking Protection switched off, and will look something like this:


To then turn protection back on, you simply need to delete those lines. A command to do so will look a little like the below, where I have put the id from the first column of the above list in to the query.

delete from moz_perms where id=3;

Once that’s complete, you can load your firefox, and you’ll see all of the tracking protection permissions set back to normal.


Back to the old familiar

If you check my site regularly (and why one earth wouldn’t you?), you may have noticed it has changed a little in the last few days. To confirm, I have ditched my own CMS, written using Python and Flask, and replaced with with WordPress. I imagine many hysterical shrieks as people ask how I could allow myself to use this security hole ridden piece of tripe.

Well, I’ve upheld for a long time that if you don’t install hundreds of plugins, WordPress is stable and extremely worthwhile, especially if you take simple security measures, such as blocking php execution from wp-content/uploads. I have also created a little cronjob which tells me every day if there are any WordPress updates to be installed, using the brilliant wp-cli tool. While it’s possible that someone can still compromise my site, I am happy that I am taking enough precautions.

Another reason for my switch came from trying to help Ilona with her own site. We wanted to create a portfolio site for her with very little administration. WordPress was good for this, as long as we could create our own theme with certain requirements. After a couple of days of tinkering in PHP, and learning a lot more about CSS media queries, I finally felt that I could create a site that looked the way I wanted it, while using WordPress. I was previously reliant on third party themes, which would never quite feel the way I wanted them too.

Finally, using wordpress at least means I don’t have to worry so much about maintaining my own extremely bad code. This is the biggest bonus!

Copyright © 2019 Matthew Ames

Theme by Anders NorenUp ↑