Handling HTTP Redirection in Ruby

I have a Ruby project where I’m dumping a bunch of bookmarks from, then fetching each bookmarked page for analysis. One of the problems I encountered early on is that the some of the web pages bookmarked would redirect to some other location. Simply checking for HTTP response code 200 was insufficient. I needed to check for redirection as well. A quick Google search for “ruby follow http redirect” yields lots of results.
Read more

How to sudoedit non-interactively

Okay, this one’s a bit esoteric, but I think it’s pretty cool. How do you use ‘sudoedit’ non-interactively such as from a script? Just a brief background about sudo: sudo is an authentication mechanism in Unix & Linux that allows unprivileged users to run specific commands (as defined by the system administrator) with root privileges without having the root password. This has several advantages over logging in as root: Users can have specific, limited set of root privileges without having the entire set of root privileges.
Read more