Site Index

a script for watching /tmp/

created: Wed Feb 22 11:00:00 2006
last mod: Wed Feb 22 11:00:00 2006

Here is a good server crontab command-line: ls /tmp/ |diff /root/ls_of_tmp - ; ls /tmp/ > /root/ls_of_tmp. What's hapening is that you're storing a list of whatever is in /tmp/ and notifying whoever gets the crontab email whenever it changes. You might want to modify this with a grep -v sess_* or a grep with a regular expression if you run PHP or Ruby on Rails and the session files get stored in /tmp/.

There are programs that will do the same thing, but this one's simpler. It's good to keep an eye on /tmp/ directories because it's where attackers will upload their attacking stuff, some times. You could also watch other places with the same script.

a script for watching /tmp/ is filed under computer (50) sysadmin (10) scripts (4) .

TiVo-like system for aggregated web-based compressed music

created: Fri Jul 16 11:11:11 2004
last mod: Tue Nov 15 23:46:11 2005

I've set up a script like Jeffrey Veen's wget mp3 blog script. On a slow, old computer in my place, this script runs every once in a while, downloading any mp3s linked to from various feeds I have selected. These feeds include the Blogdigger mp3 RSS feed, a webjay playlist that gets updated frequently, a couple music blogs, and a kinja digest. Any mp3s that get linked to get downloaded, stored for a while, and deleted, unless I specifically mark them to be saved.

The old computer in question is always on. It's got a Federal Express terminal 9" monochrome monitor attached to it, and a keyboard, but still, logging in and turning on the mp3 player is too much hassle. Like any home media entertainment appliance, this thing should just turn on and go. So, what I've done is written another script to continuously play the mp3s in this folder. Now, all I have to do is turn on the stereo, and some music will come out, or perhaps an audio blog post from a PR blog.

Immediacy is crucial.

(By the way, I'm aware of the potentially massive security holes in this scheme which, if you haven't noticed them already, I'm not going to point out.)

Some next steps here would be to use Gonze's cachem3u, or some other mechanism, to preserve a bit of data about the files I've collected. Right now, about two thirds of the downloaded files are named completely meaninglessly: SDO.mp3, IAB.mp3, track4.mp3, etc. This is not so terrible, as it corresponds to the frequency with which broadcast radio announces its song titles. Another future direction would be to use this system not just for audio files.

As an alternative, check out konspire, a piece of software that does something similar.

TiVo-like system for aggregated web-based compressed music is filed under blogging (21) music (37) scripts (4) .

gallery script

created: Sun Nov 7 19:36:29 2004
last mod: Wed Dec 15 13:28:24 2004

To generate this gallery, I wrote what I consider to be an inspiringly bad perl script. I hereby share it with the world.

#!/usr/bin/perl -w

# dir holding imgs:

opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) {
    # do something with "$dirname/$file"

### make index
"; $filetext=$filetext.""; $filetext=$filetext." "; open(OUT,">$dirname/index.html") || die "cannot create index.html: $!"; print OUT $filetext; close(OUT) || die "can't close index.html: $!"; $count=3; $arraylength=(@files); while($count<$arraylength){ open(OUT,">".$dirname."/".$files[$count].".html") || die "cannot create ".$files[$count].".html: $!"; print "creating ".$files[$count].".html "; $filetext=" "; $filetext=$filetext." "; $filetext=$filetext."previous | "; $filetext=$filetext."first"; unless($count==($arraylength-1)){ $filetext=$filetext." | next"; } $filetext=$filetext."

"; $filetext=$filetext." "; print OUT $filetext; close(OUT) || die "can't close index.html: $!"; $count++; }

Set $dirname to be wherever the images are, and this will make a bunch of html files for them. You can then do a vi *.html and work through them, adding comments.

I should start a web site for terrible software (not that this can really be considered software, but there are bigger disasters I haven't shared with anyone).

gallery script is filed under photos (4) computer (50) scripts (4) .