Skip to content

technical notes

Check and restart vpnc VPN on Ubuntu Linux

I run Ubuntu 16.04 Linux and use vpnc for my vpn (which runs at the command line, rather than through the network manager). This link tells you how to run vpnc at startup, but really I wanted to have the vpn monitored and automatically restarted if it drops. Here’s how I did that.

Following, James Coyle’s instructions, but changing the location of the script (because of this thread):

1. Make a script which checks vpn status and restarts it if necessary

1.1. Create file (at the terminal enter)
sudo nano /usr/local/sbin/checkvpn.sh
1.2. Copy and paste this into the file
#!/bin/bash
if ifconfig tun0 &> /dev/null; then echo "---VPN active---"; else sudo vpnc; fi
Save and exit. The first line marks the file as a script. The second does the work, which I stole from here
1.3. Make this file executable (at the terminal enter)
sudo chmod +x /usr/local/sbin/checkvpn.sh

2. Now create a cron job to run this script every minute
1.1. Open root cron jobs list (at the terminal enter)
sudo crontab -e
1.2. Add this line to the end
*/1 * * * * /usr/local/sbin/checkvpn.sh
Save and exit

And we’re done. You can also worry about where your crontab logs are, and how to check they are rotated daily (so don’t grow infinitely in size). This should be set up as default, so you don’t need to worry about it.

Permanent Zero

‘Email overload’ is one of those phrases everyone thinks they know the meaning of: “I get too many emails!”. Last autumn I met Steve Whittaker, who has a reasonable claim to have actually coined the phrase, way back in 1996. He explained to me that the point wasn’t to say that we get to much email, but that email is used for too many different things. We’re using it to send messages, receive messages, get notifications, schedule tasks, chat, delegate tasks, archive information and so on forever.

Shifting the focus from email as number of individual messages (too many!), to email as functions (still too many!) lets you see why the ‘Inbox Zero‘ idea doesn’t quite work. Inbox Zero appeals to my sense of being in control over my email, and it is better for me than not having a righteous scheduling system for my email, but it doesn’t split the multiple functions for which I use email.

Now, for you today, I’d like to share my newest strategy for managing my email, which is inspired by Whittaker’s ‘Email overload’ distinction.

The first thing to do is to separate off the single largest function of email – receiving messages – from the others. You need to stop emails arriving in your inbox, leaving you free to send and search without distraction. Create a filter and have all incoming mail moved to that folder. Now stare in satisfaction at “You have no new email!” in your inbox. Schedule a time to go to your received mail folder and kill as many emails as you can, using your favourite inbox zero strategies (protop: if you send emails at 4.30 you minimise the chances of someone replying that day). Now your workflow which only involves sending messages and dealing with old messages isn’t tangled up with the distraction of receiving new messages.

Next, separate off all email that isn’t personal correspondence. Set a second filter which removes all email without your email address in the ‘to’ or ‘cc’ fields. These are circulars. You can scan the titles and delete en mass.

If you are using gmail, you can import these filters (after editing to make relevant adjustments).
remove from inbox, unless sent to ‘exception’ address
remove all circulars
Right click to ‘save as’, they won’t show up in a browser. Note that my new folders begin with ‘A_’ so they are top of my alphabetised folder list.

Fasthosts are money-grabbing censorous bullies

I moved my hosting to positive internet” because my previous hosts, fasthosts, are money-grabbing, censorous bullies. There’s a long story to this, but the advice you need to know is this:

If you have a fasthosts contract, cancel it immediately. Of course, you can always renew it as the expiry date approaches, but if you don’t cancel then you risk stupid fines if — like me — you lose you credit card and forget to update you details with them

There’s details about this which I won’t bore you with. Basically, I got a reminder email a week before they were due to take a year’s payment for hosting, and it took me a week to get round to answering it. By then, it was too late and they’d charged me an additional 30 quid for being late to paying them for the privilage of another year’s hosting. 30 quid for a week delay after a single reminder email is too much, and I complained bitterly but just met an immoveable wall. So I posted about it on my blog , including the advice to cancel any existing contracts, and that’s where the second take home message comes in:

Fasthosts retain the right to take down your site without warning, and without appeal, if you post anything that they don’t like. With me they refused to discuss the matter, refused to show how what I’d posted was against their terms of service, refused to discuss what part of my complaint post against them was ‘unsuitable’. Conclusion: fasthosts have no respect for freedom of expression, especially when it comes to criticism of them and possibly on other topics too

I had a long and futile email correspondence with them about this. I didn’t make a big fuss about it, partly because they had all the cards, and partly because I was busy with more important things, which I wanted my website to be operational for. Now fasthosts weren’t a bad host, technically, as far as these things go, but their complete lack of respect for me as a customer, and for some of the values I think hosting should be about (freedom of speech), mean that I couldn’t risk keeping my hosting with them. I knew that when the next thing went wrong I would meet exactly the same response from them: “lump it and shut up.”

I moved to Positive mostly because they offered free hosting to badscience, but so far I have found their service reliable and their support excellent — both competant and friendly.

Comments off, tom off

Sorry folks, i’m turning off the comments on the site for a little while. There has been a massive increase in comment spam – a veritable whirling shitstorm and I’m going to batten down the hatches until the spam-catching software has caught up.

In other news, I’m in Bristol until sunday and the Oxford monday until wednesday, so drop me a line if you’re about or there’s anything you think I should see there.

Technical note WordPress plugin for turning off comments here

Update Comments back on now. Plugin appears to have fairly major flaw of preventing the user from accessing the blog at all, which was okay while I didn’t want to use it, and prevented me getting lots of comment spam, but isn’t a long-term solution

Reborn as wordpress

I have moved this blog from Moveabletype to WordPress. As well as being a world of open-source goodness, WordPress is far easier to use, at first impression, and I’m hoping that I’ll have more luck defending myself against comment spam.

How i did this:

After, as a precaution, exporting my Moveabletype MySQL database, using PHPmyadmin. I then enjoyed the Famous WordPress 5-Minute Install and it was easy. Thank’s to Mike for advice and encouragement.

Comments are now back open, so say hello, or let me know if any old posts were broken by the move and need fixing.

Delocator UK

Mike Dewar has got the Starbucks Delocator UK to beta and the database now needs populating – so if you know of any cool indepedent cafes, get yourself to www.delocator.org.uk and add them in.

In case you don’t know about the Delocator family (US, CA), the way it works is this: you put in a post code or a description (e.g. “Sheffield City Centre”) and the Delocator shows you were the indepedent cafes are, so you don’t have to visit starbucks and encourage that pestilence in your city.

Well done mike!

Update 20.3.06: I asked mike if the results could provide an emailable URL and he’s done it. Look – here’s the results for near where I work – how’s that for user-responsive development!

recovering thunderbird mail

I screwed up my email because, using Thunderbird, i didn’t compact my inbox folder regularly. Combined with an old version of TB which didn’t prompt me to do this, it was all a bit disasterous. Anyway, I wrote this Matlab script to take all the deleted but not removed mails from a mailbox file and make them undeleted/visible again. If this doesn’t make sense, either read about disappearing mail and recovering corrupted folders in Thunderbird or just be grateful that you don’t need to know

%use this at your own risk!
fid=fopen('In_box'); % In_box is my mailfile
fid2=fopen('In_box_new', 'wt'); % In_box_new is the new mailfile
key=['X-Mozilla-Status:'];
while feof(fid)==0
tline = fgetl(fid);
if ~ischar(tline), break, end
if isempty(regexp(tline,key))==0;
tline=['X-Mozilla-Status: 0011'];
end

tline=[tline '\n'];
fprintf(fid2,tline);
end
fclose(fid);
fclose(fid2);

Word bowl app

I’m looking for an app that will display random lines from from a .txt file in a pretty way – something like a screensaver, or a webpage which I can customise with my own text file. The text file will be around 20,000 lines long. I like to imagine the sentences swimming across the screen. Maybe the smaller ones float nearer the top, the longest ones crawling along the bottom. Or maybe not. I don’t really care as long as at any one time some of the lines are disappearing and some are appearing, so that you are visited with a cloud or swarm of a selection of all the possible lines at any one time.

I’m sure there must be such an app out there. I don’t really want to have to learn flash to getting it working and looking nice. Surely someone has done the work for me. Can anyone provide any pointers please?

Latex and Bibtex: (or “How i’m solving the filing problem”)

This is related to previous posts (one, two, three) if you are not interested in managing academic references or document preparation: turn back now

I’ve started using Latex, and although it hurt to get started, i think i’m now converted. The logic, and power, of it makes it infinitely preferable to Word if you’re doing things more complicated than a one page letter. It’s a mark-up language, so not What You See Is What You Get (like MS Word), but more What You See Is What You Want. I swore after the last paper I submitted that i would never use Word for longer documents again, and I think it’s a promise i’ll be able to keep.

One nice thing with Latex is that if there’s anything you can think of doing with a document then someone else has already thought of it and written an add-in to let you do just like that. Like psfrag which lets you modify the labels (content and font etc) of figures from within latex, so your figures always look compatible with the rest of your document.

Although one idiosyncrasy of the programme, which i wish I’d been told earlier, was that you need to compile your document a couple of times before you get a good output. This is to do with Latex needing a couple of passes through to pick up all the cross-references, page boundaries etc (or something). In practice it means that you have a look at the end result and it doesn’t seem to take account of your changes, but if you just had another look (ie ran latex on your document for a second time) it would work. I learnt this here

Latex does automatic inclusion of citations (ie in line mentions) and references (ie the compiled list at the end) with bibtex. Although bibtex is powerful and comes with lots of tools (one, two) available, I can’t find a nice front end with which to manage my references. So although i’m going to use it (have to use it) to put references in Latex documents, I’m going to keep using endnote to manage my references. I was using biblioscape which is nicer in lots of ways, but a bit flaky when talking to MS Word (and that’s something i’m going to keep having to do, if only because not all the people i work with are going to start using Latex).

So, problem: using Endnote with Latex (one, two). All I need to do is when I start on a document, is to move the references I want from Endnote to Bibtex. How hard can it be to get Endnote to export properly? Answer: harder than you think. Currently the easiest way I can see to do it is to export references from Endnote to Biblioscape (Biblioscape 6 and Endnote 8 talk to each other fine, I couldn’t get earlier version to be compatible) and then export from biblioscape to bibtex format. Not very elegant. Can anyone suggest a better way? (and yes, i have tried the Endnote bibtex export style. It’s broken).

Commenting

I have turned on anonymous commenting on the site, so you can comment without leaving an email address. Ideally i’d have it so you leave an email address, but it doesn’t get displayed on the site – but i haven’t worked out how to do that yet (if anyone who knows MT can provide clues i’d be grateful).

Previously it only displayed your email if you didn’t put in a website, but since not everyone has a website this isn’t ideal.

Update: Aha! I’ve fixed it. I’ve turned anonymous commenting off, but now if you only leave your email address it isn’t visible on the website (although i should get to see it so i can reply to you personally if need be).

Here’s how i did it had to edit the ‘Comment Listing’ template (through the web interface) so that

<$MTEntryAuthorLink show_email="0"$>

Before it was set to spam_protect=”1″ but it evidently wasn’t working.

Thanks to Matt for advice and to the MT support forums (here and here) for getting me started

finding hosting

So how do you go about finding a good host for your website? A google search turns up a million people and i’ve no real way of choosing between them. I want lots of space (250 MB +), Unix hosting (with PHP, Phython, MySQL) and preferably the ability to run at least 2 domains…And decent technical support would be nice too. Can anyone recommend a company in the UK who could do this for me please?

Comment Spammers 2 – Tom 0

I’ve further restricted commenting on the site. You can now only post comments on entries which are less than 2 days old. (And I am feeling a variety of very negative emotions towards the people who design bots to spam my site).

Comment Spammers 1 – Tom 0

As of now it is harder to comment on my site. If the post is from more than 7 days ago and no one has been commenting on it then you won’t be able to add any comments. You’ll have to email me instead. Sorry folks, but the comment spam is getting too annoying.

article links

Just updated my cuttings page to include some scans of two articles I wrote for the ecologist last year, something on Greenmaps and a scan of my article about social influence/milgram. There’s also my article about tv addiction, but it’s too annoying to read really.

Speaking of self-publicising, there’s an article I wrote about the Sheffield Social Forum on sheffieldbase.com Democracy is not a spectator sport.

The Greenmap Atlas e-book has just been published and, gosh, who is that eminently sensible young man quoted on page 3 of the introduction…?

how i did this

In a cold technical sense, this weblog was brought to you by…

Moveabletype, for the blogging software and Low Cost Names for the hosting and for selling me the domain name.

Notetab Light is the king of text editors, and for FTP i used Leech (although normally i use Terrapin, but i couldn’t find a obvious way to set file security attributes).

I’m using Webmonkey and The Web Design Group for on-going guidance on web-authoring. This and this (via) inspired me to learn about CSS. Wondering what CSS is? Look here for something brief and useful from the WDG.

I didn’t use OpenOffice much to design the site – apart from some spell checking – but i still think it’s fantastic that you can get for free a word processing, spreadsheet, presentation, etc office software suite – which is fully compatible with Microsoft products but approximately ?200 cheaper than MS Office – so i’m going to link to them as much as possible.