I’ve been hunting around for a shell script to download the XKCD archives, but pretty much everything I’ve found has either done loads of redundant downloads, required too much interaction, broken on the missing comic #404 or some other issue.

In the end I decided it would be quicker to write something myself. I normally post my shell stuff on http://www.shell-fu.org/, but this is a bit long to go there really, so incase it’s useful to anyone else, I’m posting it here:

View/download yaxkcdds.sh

To use the script, just change the directory at the top and run. You can re-run the script later on and it will fetch any new comics you’ve not already got (for example it can be run as a weekly cron job).

Any bugs, please let me know in the comments.

Quite a few of the tips that get submitted on shell-fu.org aren’t that useful if you need to remember them, but are just the thing to put in your bashrc as aliases or functions. With that in mind I decided to put together a full .bashrc using the best submissions:

View/download shell-fu.org .bashrc

Feel free to use this however you like, though I’d recommend reading through it to get some idea of what each alias/function does before you use it.

I’ve tested this on my Debian system and all worked well but if you have issues on another platform, please let me know.

Only 6 months after everyone else, I noticed Nat Friedman’s Tweetable Script Challenge, and inspired by his bubble-sort I thought I’d try for a bash quicksort in under 140 characters.

So now I present, probably the most pointless code I’ve ever written (okay, that’s definitely not true, but still ):

s=`shuf -i1-9`;q(){ l=;g=;[ $# -lt 2 ]&&echo $@||(for n in ${@:2};do [ $n -gt $1 ]&&g=”$g$n “||l=”$l$n “;done;echo `q $l` $1 `q $g`;)};q $s

(You’ll need to remove line breaks for it to (hopefully) work)

As someone kindly pointed out, “It prints out the numbers 1 to 9, er, wow!”.

I’m currently learning Python, and as I’ve always found the best way to learn a new language is to use it, I decided to write a small script to give me a menu for hosts that I commonly SSH to.

I was roughly aiming to replicate a similar setup I have at work using FMLI on Solaris. My script is nowhere near as useful as FMLI, but might be useful to anyone trying to do similar (particularly as I found a real lack of Python/Curses documentation.)

Read more…

Shell-fu:

Shell-fu is a place for all those
little command line goodies that you come across and then can never find again when you need them. Hopefully we’ll end up with a comprehensive and easily usable resource for anyone working with the shell.

http://www.shell-fu.org/

Having had a few false starts getting Mutt working with the new Gmail IMAP I thought I’d share my setup incase it is of any help.

Firstly to use Mutt in OSX you’ll need to install MacPorts if you don’t have it. Once that’s setup you can proceed to install Mutt:

$ sudo port install mutt-devel +headercache +imap +ssl

mutt-devel gives the latest version, +imap and +ssl are needed to use the IMAP service and +headercache stops Mutt needing to download the headers from the server every time it is run.

Having installed Mutt you’ll need to configure for using Gmail IMAP, this is done by adding the following to your ~/.muttrc

set imap_user = 'yourmail@gmail.com'
set imap_pass = 'yourpass'
set spoolfile = imaps://imap.gmail.com:993/INBOX
set folder = imaps://imap.gmail.com:993
set record="imaps://imap.gmail.com/[Google Mail]/Sent Mail"
set postponed="imaps://imap.gmail.com/[Google Mail]/Drafts"
set header_cache="~/.mutt/cache/headers"
set message_cachedir="~/.mutt/cache/bodies"
set certificate_file=~/.mutt/certificates 

Of course you’ll need to change the values in the top two lines. I’ve also used [Google Mail] here as I’m in the UK, but in most other places you’ll need to replace that with [Gmail]. If you’re not sure, don’t worry you can use either to start with and you’ll be able to see the correct value in the Mutt folder list.

You should now be able to run Mutt and see all your mail and folders.

While I was sorting some of my email at work today I came up with quite a useful idea for an Outlook based to-do list based on a search folder.

The setup:

  1. Create a new search folder (File > New > Search Folder)
  2. Scroll down to “Create a Custom Search folder”
  3. Give it a name, and click “Criteria”
  4. Got to the advanced tab, select Field > Frequently Used Fields > Follow up flag and set this to match “is not empty”
  5. (Optional) You can also set other options here to narrow the list
  6. With your search folder created open it and right click on the headings at the top of the message list, select “Field Chooser”
  7. Select “All Mail Fields” > “Due By”
  8. Click the due by heading to sort into date due

There you have it, a quick to-do list. To extend this a bit you could send yourself emails for other tasks and set the follow up date to when they need to be done by.

(I’ve only had chance to test this in Outlook 2003 (I think) as I use Thunderbird at home, but the same principal may hold for other versions).

I’m very happy to announce the (re)release of my first icon set, titled “Microns”. The full set, which I released a preview selection for some time ago, comprises 72 high quality icons that have a vast range of uses, both online and in applications.

The icons are all 16×16 GIFs on a transparent background and are useful in a wide range of circumstances.

Enjoy (Microns free stock web icon set)

I’m in the process of adding a projects page to the site to give details on a few bits and pieces I’ve worked on in the past. In the meantime, I noticed that he Argumentation Research Group at Dundee University School of Computing have included my MSc project “MAgtALO” on their site.

Read more…

« Previous Page