Linux self-education links.

Python-Fu: Rename a file to match a caption

This script renames a directory full of XCF files so that the filename is derived from the first line of a layer named "caption".

I wrote this to enhance the file names for Koya Hand Crafts.

Vagrant with WordPress, Provisioned by Ansible

This is a small project that helps you set up a development environment for WordPress, and it's done with Vagrant and Ansible. Vagrant sets up the virtual machine, and Ansible provisions WordPress and its dependencies. It also brings in a theme, and a child theme that has a development environment.


It's based on http://www.hongkiat.com/blog/install-wordpress-locally-vagrant/.

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

ERROR 1698 (28000): Access denied for user 'root'@'localhost' started showing up with the system upgrade to Ubuntu 15 and MariaDB.

Fixes are described at



However, there's a way to preserve the additiona

failed with not authorized on admin to execute command { replSetHeartbeat

I got the above error while trying to build a replica set in MongoDB.

If you have security:

  authorization: enabled

Then you need to set up Internal Authentication. This is a kind of password that nodes will use to authenticate that they are part of a network, and can access each other.

Here's the document that explains setting up Internal Authentication.

Learning to Install MongoDB

Learning MongoDB

I'm a beginner to MongoDB, but having just gone through the process, I hope that these notes may help other beginners get through the process of spinning up a MongoDB instance.

The Platform

We're going to be installing MongoDB on Ubuntu Server 14.04. We'll install on a virtual machine (VM) provisioned with VirtualBox. I won't get into the details in this tutorial, but there are VirtualBox tutorials everywhere, and I'll link to some notes about my specific setup.

Compiling PHP... :(

It's been a few years since I compiled PHP from sources... and "ouch", it's a lot of work. It makes me want to give up, port all the sites to a new OS stack, and deploy that.

Adding SSL to the Proxy in Front of devpi

I was getting a bunch of annoying warnings with the devpi index, so I decided to add SSL.

I don't think it was worth it, because the config is a lot harder. Also, I've migrated the entire provisioning to Ansible, so this is just a fragment to add on. You will need to find another howto that explains setting up an HTTPS server.

local-npm with daemontools

Following the advice from Addy Osmani I set up local-npm on the caching proxy server. (So far, we're caching apt, pypi and now npm.)

These examples have URLs to a machine named 'donettes'. That is the cache. Adjust to your own network.

After setting up DNS, you need to install local-npm. The Ubuntu repo version of node is out of date, mainly because node is in flux, and the packages change. So download node from nodejs.org.

Rebuilding a Virtual Machine After Deleting It

This is a note to remind myself how to set up a new VM for development. This is a mess, not a tutorial.

This works on a target environment with this uname -a:

Linux marinela 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

My host system is set up to run a bunch of VirtualBox VMs. I have a VM network setup, and want to be able to throw away the VMs and start fresh, reconstructing them with an Ansible playbook.

devpi on Apache, with daemontools / supervise

I finally started putting my code into Python packages, and quickly found I needed a private repository. A little searching found devpi, a great caching proxy that's also a private repository.

My problem was that the configuration presented used nginx and supervised.

A Small Web Dev Network

This is a quick description of my current web dev network that includes a caching proxy server for Debian and Ubuntu packages, and Ansible.

Due to general annoyance with Ubuntu, I started using Debian again, but when I started learning Ansible to set up a staging server, I had to switch back, because Ansible plays nice with Ubuntu. It works with Debian but you need to build from sources.

So, start out by firing up VirtualBox and creating two machines (512M to 1G RAM, 8G disk). Into one, I loaded Debian, but any distro is fine. Debian is just smaller.

Docker on VirtualBox installation commands

This is a short howto about setting up VirtualBox with a Docker environment in it.

Set up a clean Debian VM with the regular install, a 10G disk, and nothing but the SSH server packages. (I have started to just use the Vagrant setup, which uses the username vagrant and password vagrant, in case I want to convert it to a Vagrant image.) Download the VirtualBox Guest Additions CD and, as root, do these things to prep the virtual box to install the drivers.

Run the following.

End the Chaos, Get with the Program: Python Logging to Syslog, and Filtering with RSyslog

This article describes how to use Python's logging library to send logs to syslog. Then, using rsyslog, a fancier syslog, we produce a log of pre-filtered output.

I have a process that runs a few times an hour, and it spits out results to STDOUT, which cron dutifully emails to me.

Deleting Many Files (Somewhat) Quickly

I had to delete a bunch of files across multiple directories. What works quickly?

The first option I found online was:

find . -type f -exec rm {} \;

There's a faster way that deletes directly.

find . -type f -delete

That works well, unless there are a lot of files in each directory. Then, you might want to go into each directory and run the command. You don't want to run too many at once, though.

There's another way that turns out to be faster:

ls | xargs -L1 rm 
Syndicate content