Sunday, January 11, 2009

Follow FreeBSD on Twitter and send tweets from FreeBSD command line

It just came to my attention that Eric Anderson setup a FreeBSD feed on twitter. There you can find updates from the FreeBSD website, from the blogs aggregated at FreeBSD Planet, and other FreeBSD related RSS feeds published as 140 character tweets with tinyurl links to the full posts. I've been using twitter for a while now for two quite separate purposes. Primarily, I enjoy following people like Tim O'Reilly to get an endless stream of interesting tech links, ideas, and thoughts throughout the day. The updates are 140 characters or less and I only click through to those that I have time for so I find it less of a time sink than logging into my feedreader (Google Reader) and really digging into the news I'm interested in. I also find it quite useful for arranging social engagements. I use it as an SMS broadcast medium to make plans and arrange to meetup with friends for dinner, drinks, movies, or whatever after work. For the latter purpose Twitter works best in conjunction with a GPS-enabled smartphone and something like Loopt.

Following Eric's lead I setup a couple of more specific FreeBSD related twitter accounts using Twitter Feed to automatically publish the updates from RSS. The first account freebsdannounce consists of all the RSS feeds from the main website (most of which I added almost exactly one year ago). The second account freebsdblogs consists of the FreeBSD Planet combined RSS feed. If you want everything subscribe to Eric's main FreeBSD feed, but if you want only a subset of that content subscribe to one of my two more specific feeds.

Finally, I couldn't find a way to make simple updates to twitter from the base FreeBSD system command line so I created a patch for very basic HTTP POST support for fetch. Apply this patch, rebuild and reinstall libfetch(3) and fetch(1) and then you can update twitter from the command line (or send a simple POST request to other web services) with :

$ fetch -x status='Experimenting with Twitter API.'

fetch(1) will then prompt you for the HTTP authentication credentials of your twitter account.

I'm not sure how useful other people find HTTP POST support in fetch. If you would find this useful let me know and maybe I'll clean up the patch above and send it out for review.


Eric Anderson said...

That would be a great addition to fetch! You should get it in the mainstream for review for sure.

m1ha5 said...

I agree, its needed functionality to help get off wget.

kace said...

Yes! I agree with above. Great to have that in by default.

Unknown said...

This would be most useful. Did you ever attempt to get this committed?

Apart from that: FetchPostURL does not seem to be used, or am I mistaken? What is it for?

Unknown said...

Did you ever get this committed? It would be most useful to avoid having to install wget or curl.

fetchPostURL does not seem to be wired in. Is that correct?

Murray said...

I've been pinged a few times over the years about this patch. Perhaps I should clean it up and send it back to Dag-Erling Smørgrav. The issues he (correctly) pointed out to me last time were :

1. there is no need for a new API function, fetchPutURL() was intended for this.

2. the mime-type should not be hardcoded, but unfortunately there's no easy way for the application to pass a mime-type with the current API, except perhaps by appending it to the flags parameter (e.g. ":image/png")

3. there should be an option to post the contents of a file; perhaps -x to post a command-line argument and -X to post the contents of a named file.

I'll try to take another look at this but time is often short. If I haven't gotten to this in a week maybe you could update this patch and send it my way?