Posts for: #Tech

A second look at Arch Linux

This is a followup to an earlier post about Arch Linux.

I’ve since spent a little more time working with Arch, and these are the things I like:

  • The base system is very small and has a very short boot time. I replaced Ubuntu on my old Eee PC with Arch and suddenly the boot time is reasonable (< 10 seconds to a text prompt, < 30 seconds to a full GUI login).

[read more]

Parsing Libvirt XML with xmllint

I’ve been playing around with the LXC support in libvirt recently, and I’m trying to use a model where each LXC instance is backed by a dedicated LVM volume. This means that the process of starting an instance is:

  • mount the instance root filesystem if necessary
  • start the instance

It’s annoying to have to do this by hand. I could simply add all the LXC filesystems to /etc/fstab, but this would mean and extra step when creating and deleting each instance.

[read more]

Getting the IP address of a libvirt domain

If you are starting virtual machines via libvirt, and you have attached them to the default network, there is a very simple method you can use to determine the address assigned to your running instance:

  • Libvirt runs dnsmasq for the default network, and saves leases in a local file (/var/lib/libvirt/dnsmasq/default.leases under RHEL).
  • You can get the MAC address assigned to a virtual machine by querying the domain XML description.

Putting this together gets us something along the lines of:

[read more]

A first look at Arch Linux

I decided to take a look at Arch Linux this evening. It’s an interesting idea, but has a long way to go:

  • The installer configured the wrong root= command line into my syslinux configuration, resulting in a system that wouldn’t boot.

    Update: As far as I can tell, the syslinux-install_update command doesn’t actually make any attempt to configure syslinux.cfg at all.

  • I tried to install libvirt and lxc, but there are unresolved library dependencies…the virsh command apparently requires libX11.so.6, but the package is missing the appropriate dependencies to pull in the necessary packages automatically.

[read more]

Service discovery in the cloud using Avahi

I’m been writing a provisioning tool for OpenStack recently, and I’ve put together a demo configuration that installs a simple cluster consisting of three backend nodes and a front-end http proxy. I needed a way for the backend servers to discover the ip address of the frontend server. Since in my target environment everything would be on the same layer-2 network segment, service discovery with multicast DNS (mDNS) seemed like the way to go.

[read more]

Using Oracle JDK under CentOS

I needed to replace the native OpenJDK based Java VM with the Oracle Java distribution on one of our CentOS servers. In order to do it cleanly I wanted to set up the alternatives system to handle it, but it took a while to figure out the exact syntax.

For the record (and because I will probably forget):

alternatives --install /usr/bin/java java /usr/java/latest/bin/java 2000 \
  --slave /usr/bin/keytool keytool /usr/java/latest/bin/keytool \
  --slave /usr/bin/rmiregistry rmiregistry /usr/java/latest/bin/rmiregistry
[read more]

Document classification with POPFile

I recently embarked upon a quest to categorize a year’s worth of trouble tickets (around 15000 documents total). We wanted to see what sort of things are generating the most work for our helpdesk staff so that we can identify areas in which improvements would have the biggest impact. One of my colleagues took a first pass at the data by manually categorizing the tickets based on their subject. This resulted in some useful data, but in the end just over 40% of the tickets are still uncategorized.

[read more]

Converting HTML to Markdown

In order to import posts from Blogger into Scriptogr.am I needed to convert all the HTML formatting into Markdown. Thankfully there are a number of tools out there that can help with this task.

  • MarkdownRules. This is an online service build around Markdownify. It’s a slick site with a nice API, but the backend wasn’t able to correctly render <pre> blocks. Since I’m often writing about code, my posts are filled with things like embedded XML and #include <stdio.h>, so this was a problem.

[read more]

Relocating from Blogger

I’m in the process of porting over content from Blogger. This may lead to odd formatting or broken links here and there. If you spot something, please let me know.

If you came here from Google and found a broken link, try starting at the archive and see if you can spot what you were looking for.

[read more]

Posting to Scriptogr.am using the API

Scriptogr.am has a very simple api that allows one to POST and DELETE articles. POSTing an article will place it in the appropriate Dropbox directory and make it available on your blog all in one step.

Here is how you could use this API via Curl:

curl \
       -d app_key=$APP_KEY \
       -d user_id=$USER_ID \
       -d name="${title:-$1}" \
       --data-urlencode text@$tmpfile \
       \
       http://scriptogr.am/api/article/post/

This assumes that you’ve registered for an application key and that you have configured the value into $APP_KEY and your Scriptogr.am user id into $USER_ID.

[read more]