bash: get http response codes for a list of URLs

I had a file with a list of URLs, and I wanted to grab the HTTP response codes for each of them. I’m sure this quick bash script isn’t the best way to do it, but it works, and I’ll probably want to do this again someday, so here it is!

#!/bin/bash

while read line    
do    
    echo $(curl --write-out %{http_code} --silent --output /dev/null $line)
done <$1 

A quick twitter bot, @bc_l

Several months ago, on a whim inspired by an off-hand comment from Chris, I created a bot to bring the wonders of the Unix bc language to twitter.

bc is a command-line calculator that’s fast and has the capacity to do some fairly complex math.

Try it out on the command line:

echo '100 / 10' | bc -l

…Or by sending a direct message to bc_l (if you follow bc_l it will follow you back within a few hours).

I released the code under GPL, and it’s available on github: http://github.com/hmason/tweetbc.

John Cook mentions the bot and makes some great observations in his post three surprises with bc.


Twitter: A greasemonkey script to show who follows you

A couple of days ago I saw @skap5′s comment:

“Dear Twitter Is it too much to ask to add a follower marker so I can know if someone is following me and not just if I am following them?”

I think that Twitter could benefit from displaying more information on the home page, and this idea was easy enough to code up. It should save some time and make the Twitter homepage that much more useful.

twitter_showfollowers_screenshotThe script displays a tiny icon on top of the portrait of people who are following you back on your Twitter home page. It leaves your non-followers alone, though it would be easy enough to develop a version that puts silly mustaches on them.

This is only a first version, and I welcome your comments and suggestions.

If you already have Greasemonkey installed, get the script here, or install it from here as a Firefox extension thanks to the script compiler.

The icon is a free icon courtesy of famfamfam.

Updated February 5, 2009: The script has been updated to work with Twitter’s recent UI changes.

Updated March 31, 2009: The script has been updated to account for Twitter’s recent UI changes and the addition of AJAX updates.


LSL: Notecard Selector

One of my friendly librarian colleagues in SL asked if I had a script to generate dialogs and allow users to select notecards handy. I didn’t, so I coded it up. It seems like it could be useful to others, so here you go:

This script is in LSL, for Second Life. Just copy and paste it into a script, throw a few notecards into the object, and you’ll be ready to go!

//  Notecard Selector
//  by Ann Enigma
//  This script presents users with a list of notecards in a dialog box, and allows them to select one
//  Note: The names of the notecards must be less than 24 characters long

// This script is licenced under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
// http://creativecommons.org/licenses/by-nc-sa/3.0/us/

// configurable options
string message = "Which notecard would you like to read?"; // the message on the dialog box
integer command_channel = 616; // the channel on which to listen for commands (you probably won't need to change this)

// the script
list notecards;

default
{
     state_entry() {
          integer i = 0;

          // read the title of each notecard into a list
          for(i=0;i