I'm Marnanel, and this is my blog. Well, sort of. It isn't timely like a blog, and I don't expect you to subscribe to the feed (though I won't complain if you do). Rather, treat it as a quick trot around my mind, a chat over a pint in the pub, assuming you'd be caught dead talking about software in the pub. You should start here.

Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Sunday, June 03, 2007

wget for protected files

wget is a hugely useful program. You give it a URL and it goes and fetches it and saves it to disk. There's a ton of other options (spider a whole site, pretend to be a different browser, fetch all the URLs in a list in a file, delay fetches a certain or random number of seconds, etc) but that's the basic idea.

Anyway, I just needed to retrieve a file which was protected. It was a phone post on a friend's LiveJournal, which was friends-locked-- so, if you simply attempt to wget the URL you get a "forbidden" error, because it doesn't know who you are. Assuming you use Firefox, and you're logged into LJ, this is how to tell it:

wget --load-cookies ~/.mozilla/firefox/some-weird-string.default/cookies.txt http://username.livejournal.com/data/phonepost/xyz.ogg

some-weird-string will be different for everyone, but always the same for you. ls ~/.mozilla/firefox to find out what it is.

I was amused that this resulted in a redirection to a URL ending ...Thanks+for+ signing+in+ /+LiveJournal+loves+you +a+lot+/ +Here+have+a+cookie.

Saturday, May 26, 2007

Writing a Facebook application in Perl

This post has moved to marnanel.org; please click the title above to go there.

Friday, May 25, 2007

Tips: How to get function names in svn diff

There used to be a -p switch to cvs diff which would print the names of functions which had changed between your working copy and the repository. svn doesn't have the switch (why on earth not?) but you can make it spawn an external diff process and do -p that way thus:

alias svndiff="svn diff --diff-cmd diff --extensions \"-u -p\""

Put that in your .bashrc so that you can type svndiff wherever you go. Note that we use -u for unified diffs, because anything else is evil.

h/t: the KDE people.