18:44:17 PDT - Thursday, December 30, 2010 in
Technology
I’ve had the idea for at least 5-6 years to have some of script that ran through a directory, returning the IMDB ratings for each film. Finally got round to it after I remember Google displays the rating of a film when it appears in search results.
Here ye go:
rating.sh
Usage:
chmod +x, cd to your film directory, run script
Example output:
Revenge of the Jedi - RT: 90 (91) - IMDB: 8.9 (4,075)
Name of film - RT: [Rotten tomatoes rating] ([number of critics]) - IMDB: [IMDB rating] ([number of users])
Caveats:
It’ll only work if your films are named nicely. Eg “Revenge of the Jedi”, not “Revenge.of.the.Jedi.1982.DVDRip.XviD-FIN”.
It is buggy in parts – it doesn’t handle things like “N/A” in the Rotten tomatoes rating.
It’s messy as fuck, there’s probably a much better way to do it.
It always takes the first result and presents it – if the film you’re actually looking for is the second or third one in the results, you’re out of luck.
Google doesn’t like you spamming its server, so I’m not sure how many requests can be made before it (temporarily) asks you to start CAPTCHA’ing. Ideally you shouldn’t be running it more than once anyway.
Things that would be nice:
Arguments to sort based on IMDB or RT rating (these’ll probably be based on the output file though, so you don’t have to run the whole thing every time)
Statistics on the highest/lowest rated, average rating, etc.
Making it work more generically.
Bug fixes.
Much further down the road:
Changing labels (colours) in OS X based on the rating.
Explanation:
for f in *
List files in current directory
f1=$(echo $f| sed 's/.avi//' | sed 's/.mp4//' | sed 's/.mkv//')
General formatting to clip off file extensions (probably should’ve used “..*”)
f2=$(echo $f1| sed 's/ /+/g')
Replace any spaces with + (for Google’s search)
f3=$(curl --silent -A Mozilla/5.0 http://www.google.com/search?q="$f2"+rotten | grep Rating | sed 's/Rating/PLACEHOLDERWAN/' | sed 's/.*PLACEHOLDERWAN/RT/' | sed 's/ reviews/RVWS/' | grep RVWS | sed 's/RVWS.*/)/' | sed 's/% - / (/')
Do a silent curl with useragent Mozilla/5.0 (for the ratings to appear, Google doesn’t like curl normally)
Clip out anything with rating, replace the first occurence of Rating with the placeholder, then replace placeholder and everything before it with RT, do the same with reviews, clip out other stuff.
f4=$(curl --silent -A Mozilla/5.0 http://www.google.com/search?q="$f2" | grep Rating | sed 's/Rating/PLACEHOLDERWAN/' | sed 's/.*PLACEHOLDERWAN/IMDB/' | sed 's//10 - from / (/' | sed 's/ users.*/)/')
Same thing as the RT one, essentially.
Enjoy!
December 30th, 2010 in
Technology
13:46:00 PDT - Saturday, November 6, 2010 in
Technology
What’s up with applications getting bigger and adding more whitespace? First the new Xbox.com, then Skype’s latest beta.

Hmm, y’know what that window needs? Loads, loads more whitespace. And don’t allow the user to collapse the window down or reduce the size of the names or fucking anything. I’ve not rescaled the image to show how fucking massive it is.
That’s the smallest I could make the window. Reverted back to previous version.
November 6th, 2010 in
Technology
22:38:17 PDT - Thursday, November 4, 2010 in
Technology
Must be some sort of record:

From Steam’s download window.
That’s 34 petabytes (a motherfucking thousand terabytes) a second. Probably enough for a mean lag-free Counter-Strike session.
(Not an actual speed of course, I assume it was recorded as it “downloaded” the Civlization V demo, which I had already copied to the steamapps folder)
November 4th, 2010 in
Technology
19:55:39 PDT - Friday, September 24, 2010 in
Games,
Technology
DAY ONE
———–
SELF
Oh sweet, Civilization V on Friday! I should install Boot Camp, see how the demo goes, maybe I’ll pick it up if I can get 30fps+.
SELF runs BOOTCAMP ASSISTANT to non-destructively partition the drive.
BOOTCAMP ASSISTANT FAILS with “Cannot move file” error.
DAY TWO
———–
SELF runs iDefrag
BOOTCAMP ASSISTANT FAILS with “Cannot move file” error.
DAY THREE
———–
SELF clones entire Mac HD to an external drive.
DAY FOUR
———–
SELF erases the internal drive and clones the entire thing back. This is SUCCESSFUL, though Little Snitch settings don’t appear to get saved, and Time Machine’s fucked up a bit.
BOOTCAMP ASSISTANT SUCCEEDS!
SELF burns a slipstreamed Windows XP ISO.
FRIEND AT WORK
Shouldn’t you use an untouched one?
SELF
It’ll be fine!
Windows XP install FAILS with “Disk Read Error”.
SELF
No problem, think I just have to reformat the BootCamp partition from within the Windows installer.
Slipstream CD does not provide reformat functionality. SELF tries deleting the partition and creating a new one from the XP Setup.
Windows XP install FAILS with “hal.dll missing”. OS X no longer recognises the partition exists.
SELF
Fuck this.
BOOTCAMP ASSISTANT recreates the partition!
SELF tries formatting the BootCamp partition as NTFS from OS X.
Windows XP install FAILS.
SELF tries formatting the BootCamp partition as HFS+, hoping it’ll force Windows setup to reformat.
Windows XP install FAILS.
SELF
Fuck this.
SELF runs to SHOP (at 22:30) to buy BLANK CD. SHOP has ONE LEFT. SELF burns Windows XP Untouched ISO.
Burn FAILS.
SELF
Fuck this.
SELF tries disc anyway.
Windows XP install FAILS.
SELF
Fuck. This.
DAY FIVE
———–
SELF goes to LOCAL HMV to buy F1 2010 (360), BLANK CDS and maybe CIVILIZATION V, despite not having a working XP install.
HMV GUY
Sorry, don’t have Civilization V.
SELF
FUCK. THIS.
SELF burns Untouched ISO using HOUSEMATE’S LAPTOP.
Windows XP install SUCCEEDS.
BootCamp drivers are contained on the Snow Leopard, which was stolen a few weeks ago. SELF downloads BootCamp drivers 3.1. It’s 370mb and takes about an hour on the shit connection.
BootCamp drivers install FAIL with “Must have BootCamp drivers 3.0 installed”.
SELF
FOR FUCK SAKE.
SELF downloads the full driver set, which is 770mb. Takes about three hours with the shit connection.
BootCamp drivers install SUCCEEDS.
Civilization V Demo install SUCCEEDS.
Civilization V Demo actually runs pretty well even on medium, surprisingly.
SELF pops out to FLAGSHIP HMV, where they do have Civilization V.
Civilization V install SUCCEEDS.
SELF
Thank. Fuck.
TLDR: It basically took me a week to install BootCamp on my Mac – problems with partitioning, then with the XP disc, then with BootCamp drivers meant it was a world of pain. But Civ V does run, and runs well.
September 24th, 2010 in
Games,
Technology
21:05:24 PDT - Friday, September 17, 2010 in
Technology
This isn’t quite a plugin for Geektool, but more a shell script you can add to it.
So the TFL (Transport for London) website is pretty great, gives you realtime information about delays and closures (for lots of transport, but Tube’s the main one). Unfortunately, there doesn’t seem to be a nicely-presented dashboard widget for OS X that displays such information. Randomly realised that some regex magic would work well with a curl. Took me a few hours (including reading up on sed, and a lot of messing), but I got it working nicely in the end:
curl --silent http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html | sed -n '/"lines"/,//ul/p' | grep -A 2 'ltn-name' | grep -B 2 'ltn-title' | grep -v div | sed 's/.*">//' | sed 's/<.*//' | sed 's/--//' | sed 's/amp;//'
I assume there’s a cleaner way to do it, but there’s a million ways to do something like this, even using the same commands (grep, sed).
When run, it’ll provide a list of the lines that currently aren’t “Good service”. This might be “Planned closure” or “Minor delays” or whatever. Very handy to stick on the desktop, so you can see at a glance if the lines you’re planning to use are up and running.

Doesn’t display any specific info (might add that in the future?), or any station info, but like I said, it’s perfect for a quick update.
Edit:
Here’s another little command, this one’ll get the reasons for the lack of a Good Service for a single line. Replace DLR with your Tube line (check the page source if you need to). Just hacked together before bed – sed doesn’t seem to like the one-or-more operator (+) – it won’t display anything if the line’s got a Good Service. Might tidy it up a little tomorrow.
curl --silent http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html | sed -n '/"lines"/,//ul/p' | grep -A 4 'DLR' | grep -v div | sed 's/t*.*">//' | sed 's/.*<p>//' | sed 's/</.*>//'
Edit2:
Turned out the above command didn’t work very well at all. This one seems to display the current line status correctly (Good Service if so, details if not). Messy, as usual:
curl --silent http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html | sed -n '/ltn-name">Central/,//li/p' | head -5 | grep -v '<div class="status pro' | grep -v '<div class="me' | sed 's/.*<.*">//' | sed 's/</.*>//' | sed 's/.*<p>//'
September 17th, 2010 in
Technology