Saturday, August 23, 2008

Autoscroll in Safari, Firefox

The Autoscroll Bookmarklet

Bookmarklets are actually a cool little concept – make a link that runs a JavaScript command and inject code into any web-page. Brilliant! Combine this with an obsessive computer nerd with some free time on a Saturday evening (for example, me), and you get following:

AutoscrollThe Bookmarklet

Works in Safari and Firefox. If you’re lucky it might work in Opera, Camino, and Konqueror. If you’re at least as lucky as this guy, it might work in IE.

Usage

Click the really big link above to activate auto-scroll (you may want to make your window small enough to have significant scroll space

Here’s the buttons to push:

0-9 : Set scroll speed, 0 being stand-still and 9 being skim-speed
: Decrease speed
= : Increase speed
shift + – : Decrease speed quickly
shift + = : Increase speed quickly
q : Quit

Installation:

If you’d like to pack this sweet action with you, drag the “Autoscroll” link to your bookmarks tool bar.

How to Daemonize Any Process

I’ve been passively looking for a tip like this for a while. Often times, I’ll need to run a command on a server that takes a good 30 minutes to run (like loading a database dump for example). Normally, I’ll run the command in the background, followed by this:

while true; do sleep 60; date; done

This has been my timeout prevention to keep commands from dying – yes it’s a pretty stinking lame solution.

Especially lame when the server drops the connection anyways.

nohup saves the day

If you need to run a REALLY long command remotely that won’t die with an SSH time out, then “nohup” is your friend.

nohup shields the commands from “HUP” signals – a signal that is sent to all child processes upon disconnecting from a terminal, that normally will stop your process (gracefully).

For example:

nohup cat the_entire_internet.sql.bz2 | bunzip2 | mysql the_internet_production &

And then, nohup will probably say something like "nohup: ignoring input and redirecting stderr to stdout", but it’s of little consequence. You’re safe to quit your terminal and your process will be safely fostered by /sbin/launchd after you take it’s parent away. Ya big mean lug.