- Disclaimer #1: I'm stupid.
- Disclaimer #2: I barely know how to code or script. If your computer and/or handheld manage to explode because of me, tough shit. I warned you.
I use a Pocket PC (namely, a Jornada 525), I mainly use GNU/Linux, and I like Everything. So I thought, "how can I put a bit of everything on my handheld using Linux?" Obviously, the Evil Empire won't let me just link my Jornada and download an E2 web page. Then I realized: Why don't I just use a CompactFlash card to transfer files between my Jornada and CF reader-equipped PC? I did, and it worked. And then I thought: Why don't I make a nice script that can find a random node from E2 and automatically transfer it to the card, so I can read it with my Jornada? Lo and behold, comes my newest pathetic invention:
The Unofficial E2 Random Node Gathering and Transfer Script
To use this, you'll need:
In my example, I have my Jornada, my aforementioned reader, and Redhat
7.3 which easily fulfills the last 6 requirements.
The script, basically, gets a Lynx HTML dump from E2's Random Nodes XML ticker, formats it using grep and sed to get the node id, and gets that node.
Save this file as rnode (or, for that matter, any other name):
echo "Getting random node..."
lynx -source "http://everything2.com/index.pl?node=Random%20Nodes%20XML%20Ticker&lastnode_id=1252991"|
grep "node_id=" | sed q | sed 's/.*node_id=\"//' | sed 's/\".*//' |
perl -e '$nodeid = <>; print `lynx -source "http://www.everything2.com?node_id=$nodeid" > node.html`;'
echo "Mounting disk..."
mount -t vfat /dev/sda1 /mnt/flash
echo "Transferring node..."
cp node.html /mnt/flash
echo "Unmounting disk..."
echo "Cleaning up..."
Put these the bash script into any directory (you can make rnode executable (chmod +x rnnode) and put it in /usr/bin if you desire).
After you're finished, put a disk into your reader, run rnode (bash rnode, or if you made rnode executable and put it into a directory in your PATH, just rnode) With luck, it should work. Put the card back into your handheld and in its root directory there should be a file called node.html.
- You need root permission to run this.
- Since the USB reader is emulated as a SCSI device, by default the device is /dev/sda. However, if you have any SCSI disks, this will be changed into the next unused drive. For example, if you have two SCSI disks, your CF reader's path will most likely be /dev/sdc.
- Thanks to flamingweasel, the whole thing is now shorened down to one bash script using sed and grep. Much more elegant than my previous C/Bash implementation.
- You can do many things with the script if you toy with it; for example, you can change the device name and copy the HTML file to a different place, for example a floppy disk or a NFS-mounted laptop. You can probably also change the script to work with PalmOS; I think there is a program in pilot-tools that lets you upload a text file to your PalmOS device.
- Again, /msg or e-mail me about anything related to this node (advice, needed advice, hate mail, a few pointers, confirmation that this works on your machine, bad formatting, etc.) Sorry if I'm being a bit too repetitive.
- Remember, you're getting a random node from deep within the bowels of Everything; don't be surprised if you don't get what you want. Webster 1913 entries, nodeshells, dark fetishes that you really don't care about and GTKY nodes are all fair game. Some days you're lucky, some days you're not.The random nodes nodelet is updated every 10 min, so that's how often you can update your random node.