Category: Tech

Git submodules in N easy steps

Git has something called submodule support. This allows you to specify one or more other git repositories within another – a bit like svn:externals (except trickier, but more powerful of course :).

The git user manual describes submodules but it took me a while to figure it out, so I’m hoping these examples will help others (and me again when I forget and find my own page when googling about it :)

These examples deal with your_project and the project you’ll be adding as a submodule, other_project

(more…)

UK Spam laws largely useless

I’m getting some spam from some UK companies to a personal email address. I called and spoke to one of them and they said it won’t happen again but it continues to do so. I looked into complaining officially, under the new regulations that make the EC’s Directive on Privacy and Electronic Communications law in the UK.

Under the new law, spammers can be fined £5,000 in a magistrates court or an unlimited penalty from a jury.

Yet it appears it is really up to me to pursue charges through the courts. The Information Commissioners Office, who enforce the new regulations, appear largely neutered (as predicted):

If my complaint is upheld, will the organisation be punished?

If we think the organisation has breached the regulations, we can ask them to put things right, but we cannot punish them for breaking the law.

If my complaint is upheld, will I be entitled to compensation?

We have no powers to award compensation . If you have suffered a loss because an organisation or individual has broken the law, you may be entitled to compensation, but you must claim this through the courts.

The right to compensation applies even if you don’t report the problem to us. You can make a claim to the court whether or not we have agreed that the law has been broken.

No doubt this will cost a lot of my time and money. We should build a simple kit, with some form letters and instructions on pursuing compensation.

Or just take enforcement into our own hands and report them to something like Spamhaus.

Hello world, Debian style


# apt-get install hello

# hello
Hello, world!

# hello --help
Usage: hello [OPTION]...
Print a friendly, customisable greeting.

  -h, --help display this help and exit
  -v, --version display version information and exit

  -t, --traditional       use traditional greeting format
  -n, --next-generation   use next-generation greeting format
  -g, --greeting=TEXT     use TEXT as the greeting message

£5/month for your digitial civil liberties

The Open Rights Group are a UK based organisation fighting for our civil liberties in the digital age. DRM, e-voting, copyright term extensions, FOI, net neutrality, privacy, RIPA, creative commons etc.etc.etc.etc.etc. They’re like an English EFF.

They have a tiny staff and many other volunteers who are extremely dedicated to the cause and are working very hard for our freedoms.  They are funded entirely by donations which pays for the staff, an office and expenses of running campaigns and pestering politicians.  They’re currently hoping to push their income up so things are more sustainable.

So, please sign up and give them some money every month. Anything from £5 upwards would be super. If you use computers for pretty much anything, it will make your life better – or at least prevent it getting any worse.

MoinMoin wiki on NGINX

Further to my post about getting the MoinMoin wiki system working with FastCGI and Lighttpd, here is how to do the same with NGINX. MoinMoin is configured in FastCGI mode and listening on port 9005

All the fastcgi_param lines up to PATH_INFO are pretty generic and I have them in a separate include file that I pull in for any Fastcgi stanza.



  if ($uri ~ ^/wiki(.*)?) {
    set $wiki_url $1;
  }
  location /wiki {
      fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
      fastcgi_param  SERVER_SOFTWARE    nginx;
      fastcgi_param  QUERY_STRING       $query_string;
      fastcgi_param  REQUEST_METHOD     $request_method;
      fastcgi_param  CONTENT_TYPE       $content_type;
      fastcgi_param  CONTENT_LENGTH     $content_length;
      fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
      fastcgi_param  REQUEST_URI        $request_uri;
      fastcgi_param  DOCUMENT_URI       $document_uri;
      fastcgi_param  DOCUMENT_ROOT      $document_root;
      fastcgi_param  SERVER_PROTOCOL    $server_protocol;
      fastcgi_param  REMOTE_ADDR        $remote_addr;
      fastcgi_param  REMOTE_PORT        $remote_port;
      fastcgi_param  SERVER_ADDR        $server_addr;
      fastcgi_param  SERVER_PORT        $server_port;
      fastcgi_param  SERVER_NAME        $server_name;

      fastcgi_param PATH_INFO $wiki_url;
      fastcgi_param SCRIPT_NAME /wiki;
      if (!-f $request_filename) {
        fastcgi_pass 127.0.0.1:9005;
      }
  }

Corrupted filesystem recovery dry-run with LVM snapshots

I have a corrupt Reiser filesystem that needs a tree rebuild on it, which can be a scary thing to do (and is only advised when you *really* do need to do it which, unfortunately, I do).

Now, this filesystem largely works, there is just a small part of it that causes problems when accessed. A rebuild could make things a lot worse, or it might just solve my problem (note: my problem appears NOT to be due to hardware failure. rebuilding the tree of a Reiser filesystem on hardware that has badsectors or whatever is VERY likely to make things worse. don’t do it).

So, I’m currently using the filesystem and avoiding the broken bit.  I need to know if one: how long a rebuild is going to take, so I can plan the downtime and two: will it complete sucessfully or will the world fall on my head.

LVM snapshots can help here and my filesystem in on a LVM logical volume.  The idea is to take a snapshot of the filesystem and run the rebuild on the snapshot.  Then you can decide whether you want to take the live filesystem down to rebuild that, or maybe you decide to update your backups best you can and start a new filesystem from scratch.

(more…)

Twitter relay rbot irc plugin

I wrote a little plugin for rbot that follows a user on Twitter and announces any twits of its friends on irc.

I registered a dedicated twitter account for our irc channel and had it follow everyone in the channel who has a Twitter account.  When they twit, we get an announcement within 90 seconds:

<chanbot> via twitter, johnleach is testing his rbot plugin a bit more (23 seconds ago via web)

The plugin is available here and is licensed under the terms of the GNU General Public License v2, just like rbot.

Just drop it in your .rbot/plugins dir, rescan, then configure twitter_relay.username and twitter_relay.channels and off you go.  It will check the rss feed every 5 minutes by default, but that can go as low as around 60 seconds if you set twitter_relay.sleep.

Only tested with the latest development snapshot of rbot, but it will probably work with older versions.

Graphical Git on GNU/Linux with Giggle

Check out (pun!) Giggle, a graphical frontend for the git distributed revision control system.  Cute name and much lovelier than gitk. It’s pretty new but already does a lot, and more is planned.  See the screeny.

Making a staging database with sed

Quick one – thought was was cute and useful.  I take a copy of live databases once in a while for use in the staging environments, but some apps have references to the live url in the there (WordPress does this and makes all its redirects using it, making it particularly difficult to test in staging).

This is a simple little way to change all the urls in the db as you clone it:

mysqldump -h live_db_host -u user -pmypass live_db | sed -e '{s/www.example.com/staging.example.com/g}' | mysql -h staging_db_host -u user -pmypass staging_db

Though depending on your MySQL table type you might want to dump to disk first, then pipe it through sed as your live tables might be locked (I’m not actually sure if mysqldump will block waiting for the other processes to catch up)

Speaking at the Manchester Free Software Meeting

I’m speaking next Tuesday (15th April 2008) at the Manchester Free Software about my geeky web comic, Everybody Loves Eric Raymond. Apparently people are still interested in it even though it hasn’t been updated since December! Hooray!

It’ll be a bit of a mix of the two talks I’ve done before on ELER, so some stuff about the history of the comic and how I make it, plus some ranting about free software, free markets and leaders.

I was asked by the then organiser (and my friend) Matt Lee who was then extraordinarily renditioned to North America with his new wife, leaving the new organisers to pick up the pieces. Luckily most of the pieces were found and it’s all go, though I do now appear to be talking about my new Rails hosting company too and my name is spelt differently. If there is time, I’ll talk about some of the stuff we’re doing at Brightbox with Free Software.

Talk starts at 7pm at the Manchester DDA. More details on the Manchester Free Software website.

6 year old Gnome bug picks up pace

This bug regarding the Nautilus image thumbnailer performance was reported almost 6 years ago.  It had input on it at the rate of around one message every two months, up until the end of 2003 – then nothing until 2006, where duplicate bug reports start coming in pretty regularly until the end of 2006.  All pretty quiet until then, kind of suddenly, Michael Chudobiak writes a patch that speeds up Nautilus almost 3400%

I used a test folder that had four 15000x400 tif images and four
15000x400 png images (solid colors). Without the patch, it took
Nautilus 4 minutes and 30 seconds to thumbnail the folder. With
the patch, it took 8 seconds.

I'm not clever enough to touch the actual pixop codebase. But
these numbers suggest there is enormous room for improvement!
This bug has been open for 6 years - nudge, nudge.

Because free software is forever we can just afford to get there in the end :)

Leeds Ruby Thing #2, Thursday 6th March

The Leeds offshoot of the North West Ruby User Group is meeting again this Thursday, 6th March, 7:00 PM – 11:00 PM.  This time at Mr. Foley’s
Cask Ale House
, on The Headrow (formerly Dr. Okells).

Expect unstructured discussion of Ruby, Ruby on Rails and other random stuff plus nice people, great beer and coffee and geeky tshirts.

The balcony back room of Mr Foley’s has been booked.  Announce that you’re coming on the upcoming page.

Oh, and we now have a website: http://leedsrubything.org/