Wed, Feb 26, 2014

[Icon][Icon]Walled games

• Post categories: Omni, FOSS, Rant, Technology

This is a rant by somebody who's sick of the "walled garden" approach of many modern technologies. The "iTunes is only for the iPhone"/"Google maps is only for Android"/"Amazon is only for Kindle" nonsense.

There's only one reason that this doesn't annoy me very often. As was famously observed in a film from my youth, "the only winning move is not to play."

My music collection consists of MP3's & OGGs ripped from CDs. I don't subscribe to any movie-suppliers. I've never bough an ebook from Amazon, my Kindle has only DRM-free files from Project Gutenberg & O'Reilly. I have a dropbox account that I don't use: if I want to share files I use Git or SSH. When I want to watch movies on my tablet, I put them into a network-shared folder on my laptop.

The fact that I'm not aware of a single big player that doesn't try to lock you in via these mechanisms; the fact that I prefer to avoid services altogether rather than find one and be chained to it; this is one of the biggest failings of modern technology.

The Web demonstrates what an amazing, powerful thing an open platform is. Anyone can build a web browser, anyone can build a web site.

The fact that Apple, Google, Amazon, Microsoft, and God knows how many others, think that their only chance of keeping customers is to make it impossible for them to leave.. it's a pretty damning statement about their level of confidence in their own products.

And the only reason the average person isn't complaining about it is, the average person hasn't really wanted to switch platforms yet. Apple fanbois don't buy Android, Kindle owners buy their ebooks from Amazon.

Give it a few years. When a few more "latest and greatests" have come along and prompted people to want to make a switch, only to discover they're walled in.


I imagine it won't be pretty.

I'll try to be ready with the violin


Tue, Feb 25, 2014

[Icon][Icon]SSL certificate revoked

• Post categories: Omni, Rant, Technology, Helpful

Because "fuck you", that's why.

I'm testing Zabbix deployment via Puppet. To avoid screwing up our live system with my experimentation, I'm using a few VMs. Which suddenly stopped working: Puppet kept reporting that the puppet server's SSL certificate had been revoked.

Lots of people with similar problems found by Google, nothing that actually helped. I didn't want to get into certificate-generating, I wanted it to JFW.

The most common reason reported for SSL issues is the time being wrong. "date" seemed accurate, but on a hunch I figured it was worth rebooting the VM, which resets the clock. And it was: Suddenly, everything works again.

Only burned an hour fixing that.

So if you're having "certificate revoked" issues with VMs, my advice is to reboot the damn thing and see if the problem goes away. Probably not something you want to play with on a live server, though :)


Fri, Feb 21, 2014

[Icon][Icon]Virtual networking

• Post categories: Omni, Technology, Helpful

I've been using Virtualbox more and more lately. One thing that's bugged me is that if you reinitialise the MAC address of a VM (which you often want to do if you've cloned a VM and want the new machine to have a different IP) it has an annoying tendency to break networking: your ethernet interface just isn't there any more.

On the offchance that other people are bothered by this too, I thought it might be helpful to post the fix for it: Delete /etc/udev/rules.d/70-persistent-net.rules

This file is auto-generated (hey, it's udev!) and contains the MAC address. If you change the MAC address, this file needs to be updated: Networking won't work whilst the wrong MAC address is in here.

I suppose you could manually fix it, but why bother? Delete it, reboot the VM, the file will be re-created with the new MAC. Job done.


Mon, Feb 17, 2014

[Icon][Icon]Level up

• Post categories: Omni, FOSS, Technology, My Life, Programming, Helpful

I've been a big user of GNU Screen for.. erm... hang on, let me count.. OMG, it's been very near to two decades now. Holy *&^%!

(I've looked at tmux a few times but never found any compelling reason to switch)

I first started running it at University because the servers weren't the fastest, and I didn't want to hang around for ages waiting for my email client to start up & load all the messages just so I could tell if I had any new ones. Also, I was on a few MUDs and things, which I also didn't want to have to keep re-joining. So I would just leave myself logged in via Screen and re-attach to it as and when. Quite a time-saver.

I started using it for work purposes a couple of jobs ago because it was the most convenient way to share a screen to work with somebody else: You can grant other users permission to acccess your session via 'acladd'

That worked great when I was doing all work on one remote machine, but then at my last job, I was working on multiple servers & VMs. I really needed one Screen running on each box, but that then meant I needed too many windows. So I started a new trend: A container Screen that all my other Screen sessions could live within. So long as the container used a different escape key to the usual Ctrl-a this was no problem.

And now in my current workplace I again feel the need for multiple screens, because I again need to be on multiple machines at once, and also I have multiple scripts & utilities running in the background whenever I'm logged in.

Ordinarily, I just set them up manually and got on with it, because I reboot so rarely. But we've had a few power cuts lately, so I finally decided to automate it all.

So now I have a script that starts up three screen sessions for me, via the format:

  • screen -dm -S <name> -c .screen/<name>

The -S switch gives the session a name, which is vital when running multiple screens: You can attach via screen -x name instead of having to know/guess the right ID number.

Each session has its own config file, because: the container needs to have a unique escape key (I use X in the place of A); Some screens I want to have a visible toolbar, others I don't; and I want to run different startup commands for each.

And then in the config files, I have entries in the format:

  • screen -t <name> <number> <command>

So I can define the name of the individual screens within each session; what number they start on; and what command they run on startup.

This means a single command run on startup gives me easily-navigable screens connected to multiple machines, bring up IRC&IM, load utilities like my dynamic wallpaper (Xplanet), and set up some ssh tunnels.

Very convenient.

It feels like I just levelled up the the next level of geekiness, and it's hard to say whether that should engender pride or shame :)


Wed, Jan 15, 2014

[Icon][Icon]Letting vim take the strain

• Post categories: Omni, FOSS, Technology, Programming, Helpful

I recently embarked on a project at work to begin trying to replace Subversion with Git. Unfortunately, svn is not only used by people checking in code: It's also called by the code itself. So I need to find all instances in the code where either 'svn' is called, or where a 'Subversion' module is used.

I figured the best way to do this was grep all the files, dump the output to file, manually filter out the ones that I could ignore, and so end up with a list of files I need to look at.

I used my editor of choice, vim, for handling the grep output. I thought it might work as a good example of some of the slightly less well-known ways vim can make your life easier. So, here's what I did:

Firstly, filter out warnings/errors. Grep will tell you about things like binary files that it can't output, but I wasn't interested in binaries, only text.

The format grep outputs for matches I was interested in is:

(filename):(matching line)

So nice & simple, I can presumably filter out all lines that don't have a colon. Firstly, I like to verify my assumptions by doing a search for the regex I propose to filter with. In this case, that was:


Broken down:

  • / = Search for the following regex
  • ^ = begin of line (in this context)
  • [] = character class - define a set of characters to match
  • ^ = not any of the following characters (in this context)
  • [^:] = any character that's not a colon
  • * = any number of the preceeding character
  • $ = end of line

so ^[^:]*$ = find all lines that are made up entirely of non-colons

Because I have search highlighting turned on, this lit up every match of my regex in the current screen of text. A quick scan told me that this was indeed DTRT - no false matches, etc. So now I want to check the entire file with this regex. This calls for grep. Or rather, g/re/p - Globally search for a REgex and Print matching lines.

So the ex command I want is of course:


However, I don't need to type all that, nor C&P the regex. No, because I know that when typing out ex commands, hitting 'ctrl-r' followed by the '/' key will insert the current search term into the command. So I instead type

:g/'ctrl-r /'/p

and now I get shown every matching line in the file. Again, all looks good. So I want to delete all these lines. Again, I can shortcut this: Pressing the up-arrow in ex mode takes me to the previous command, so


get me back to my grep, and then replacing the trailing 'p' with a 'd' sets the line to delete rather than print matching lines.

Just like that, I have filtered out the first bunch of unwanted results.

Next, I want to set up highlighting to make filenames and the matching 'svn/Subversion' terms easier to see, so I can identify false positives as easily as possible. So, define a couple of syntax terms with the relevant regexes:

:syntax match filename "^[^:]\+:" (Use "ctrl-R /" again)
:highlight filename ctermfg=magenta

:syntax match svn "svn\|Subversion"
:highlight svn ctermfg=red

And now filenames are magenta and uses of 'svn' or the 'Subversion' module are highlighted red.

Now that it's all visually marked, there's not much else I can do beyond wade through it all and try to whittle it down.

Once that's done, I want to get from my list of matching lines to a list of filenames. This is two steps: First, whittle down each line to the filename:


This is basically the same regex as I used at the start, but the escaped parentheses capture what's inside them, which is everything up to the first colon. It then replaces the entire line with just the captured text, which in this case is the filename.

(I much prefer Perl regexes where you don't have to escape quite so many special characters, but c'est la vie)

Lastly, any file that had more than one mention of subversion will be duplicated. This can be fixed by dumping to the standard 'uniq' command:


The % indicates "entire document", the ! indicates that the command should be executed via the shell. So this command says "Run the 'uniq' command on the entire document" and now we're down to every unique filename that I need to look at.

Now I just need to go through all of them and mark the ones I actually care about. Don't think vim can save me from this one...


:: Next >>

[Links][icon] My links

[Icon][Icon]About Me

[Icon][Icon]About this blog

[Icon][Icon]My /. profile

[Icon][Icon]My Wishlist


[FSF Associate Member]

April 2014
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        


User tools

XML Feeds

eXTReMe Tracker

Valid XHTML 1.0 Transitional

Valid CSS!

[Valid RSS feed]

powered by b2evolution free blog software