The Time…

I’m pretty OCD and thus run an NTP server on this server. (It should respond to any hostname on this box.) Despite the server being in Texas, I keep the timezone set to EST.

So here’s a page displaying the time. Granted, having a clock that’s accurate down to a fraction of a second (synced to the atomic clock) is no longer that impressive. But tell me you’ve never wished for an easy way to find the correct time… Now you know.

The Problem with Wikipedia

No, not that one.

I consider myself a talented writer. And I’m obsessive-compulsive about things being well-written. So giving me access to edit things is a recipe for awesome.

So I was doing some research for class. My research into Lynch v. Donnelly made me realize that the page was pitiful. So I cleaned it up to get it to its current state. (Which still needs a lot of work.) The Nautilus, Inc. page also got some updates after another class project on the subject.

You should get extra credit in class when you become the top contributor to the Wikipedia page on the subject.

The Spare Box

I don’t blame the OS directly, but life in Windows-land always involves me sitting around twiddling my thumbs.

So I brought back an ancient laptop with me. 512MB RAM (I think–it might be 256), a slow processor, a tiny hard drive, and a battery that doesn’t hold a charge. It’s running Ubuntu, and its two duties are as a web browsing machine and an IM machine.

So now while the system is unusable, I can get stuff done over here.

(Psst: Steam, when your game is so hard to start that I lose interest before it’s launched, you’ve failed miserably. Go get stuck in a lift. A burning lift.)

MiniAjax — An Awesome Site

Web developers, check it out. My one complaint is that this is an awkward assortment of things ranging from little JavaScript snippets to free (GPL) apps to proprietary, expensive applications. But there are some very cool ones in there. (Psst! Heatmap is running on this site! It’s going to take a while to build up enough data worth sharing, but I’ll let you know when the time comes.) Some of the other ones are going to make their way into some projects I’m working on.

Police Logs

Last night I was in the police station getting data for the police logs. As I sat there in the lobby perusing the logs, some girl came in and approached the dispatch desk.

“Hi, I don’t know what to do… This has never happened before. I think my car was towed.”

A few minutes go by, and the dispatcher concludes, “Ma’am, we didn’t tow your car.”

She told him exactly where she’d parked, so he pulled it up on the camera and zoomed in. (The zoom on those cameras is ridiculous!) “I was right next to that Jeep,” she said. Sure enough, her car wasn’t there.

She called to get information on activating Lo-jack in her car.  The dispatcher called local tow yards to confirm that no one had towed the car without telling him. One  by one, they came back negative.

I was sitting there, intrigued. Part of me didn’t believe that a car had just been stolen on campus. But the other part of me was irritated that the dispatcher was was lallygagging around instead of putting out a BOLO for the recently-stolen car.

Finally, he radioed to one of the officers who was patrolling the parking lot, and asked him to look for the car. About ten seconds later, he radioed back. “I’m sitting right in front of it.” He turned on his lights so they could see where he was on camera.

He was maybe four cars down from where she said she’d parked.

I tried to refrain from cracking up. And as I soon realized that it’s exactly what everyone else in the station was trying to do.

(As an added bonus, she freely admitted that she was illegally parked in a handicapped spot and had no parking permit, although they seemed to distracted with the hunt for her lost car to issue her a citation.)

Malus Fide

I’ve always like the idea of rewarding douchebaggery with more douchebaggery. And one bit of douchebaggery that really bugs me is that, running a webserver, it’s always getting requests for pages that have never existed. What’s going on is that people are probing for common vulnerabilities. I don’t have a /phpmyadmin, but I get multiple requests a day for it. (I do have PHPMyAdmin, but it’s up to date, secure, and at an obscure URL.) Same goes for awstats.

What I’ve always wanted to do is respond to these requests with complete garbage. Unending garbage. My long-time dream was to link a page to /dev/random, a “file” in Linux that’s just, well, random. (It’s actually a device, a software random number generator.) The problem is that linking it is full of problems, and, when you finally get it working, you’ll realize that it’s smart enough to view it as a device and not a file.

So I took the lazy route and just created a 500MB file. You use dd to copy data from a disk, with /dev/urandom as the input and a file with a .html extension as output. I had it read 500 “blocks” of 1MB. Granted, this is a total waste of disk space, but right now I have some spare space.

Of course, I was left with a few resources I was concerned about: namely, RAM, CPU time, and network activity. I use thttpd for this idiotic venture, which lets me throttle network activity. I’ve got it at 16 KB/sec right now. (Which is an effective 128 kbps.) This ensures that if it gets hit a lot it won’t put me over my (1,000 GB!) bandwidth allocation.

Apparently, though, this throttling solves the problem: at first glance, it looks like it’s smart enough to just read 16KB chunks of the file and send them out, as opposed to trying to read it into memory, which would kill me on CPU time and RAM. So the net result is relatively minimal resource utilization.

Currently, it’s just sitting there at an obscure URL. But my eventual plan is to setup a /awstats and a /phpmyadmin and a /admin and a /drupal and have them all throw a redirect to this file.

The other bonus is that, at 16KB/sec, if a human gets there, they can just hit “stop” in their browser long before a crash is imminent. But, if it works as intended, infected systems looking to spread their worms/viruses won’t be smart enough to think, “This is complete gibberish and I’ve been downloading it for 30 minutes now” and will derail their attempts at propagating.

It’s not in motion yet, though… But I’ll keep you posted.

Speeding up MySQL with tmpfs?

I’m still getting a decent percent of files being created on disk in queries, even though my tmp_table_size is an astonishing 128MB. (The whole blogs database uses about 6MB of disk.)

The problem is described here: TEXT and BLOB queries apparently don’t like being in memory. This page explains it further.

The problem is that… These are blogs. Aside from some trivial cross-table type stuff, every single query uses TEXT queries. Interestingly, the solution everyone proposes is using a ramdisk. I was somewhat concerned about using a ramdisk, though: for one, the procedure for creating it looked somewhat arcane, and one place talking about it mentioned that his 16MB of ramdisk was almost as big as his 20MB hard drive. I think of my old 20GB hard drive as ridiculously old. The other reason, though, is that ramdisk is scary: it’s a finite size. I’d love something like a 1GB ramdisk for /tmp, but I don’t even have a gig of RAM, much less a gig to allocate for file storage.

Enter tmpfs. In a nutshell, it’s like tmpfs, but the size can be dynamic, and it can swap, which means I don’t have to worry about my 16MB tmpfs partition trying to store 17MB of data and blowing up. Creation was eerily easy:

# Make a directory to use as a mountpoint, and give it a misleading name
mkdir /tmp/ramdisk

# Mount it as type tmpfs
mount -t tmpfs tmpfs /tmp/ramdisk -o size=16M,mode=1777

In my.cnf, it’s as easy as changing tmpdir=/tmp/ to tmpdir=/tmp/ramdisk/.

And now, we let it run for a while and see how performance feels.

No, No You Don’t

I periodically peruse access_log and error_log, Apache’s logfiles. There’s always weird crap. Here’s todays (odd linebreaks to make it fit):

[Thu Nov 22 07:59:15 2007] [error] [client 80.32.3.251] File does not exist: /var/www/ardentdawn.org/htdocs/drupal, referer: http://72.36.178.236/drupal/?_menu[callbacks][1][callback]=drupal_eval &_menu[items][][type]=-1&-312030023=1
&q=1/<?passthru(%22echo%20IROCKTHEWORLD%22);

There’s also some inept script kiddie later on who tried requesting the same non-existent page 112 times in a row… o_O

Undoing bad tar files

Proper ‘etiquette’ for packaging a tar file is to package it so that it extracts to a directory. But sometimes, the files are packaged by an idiot, and, when extracted, just extract the files right to whatever directory it’s in. (Which is fine, if you expect it.)

tar takes a “t” option (“t” for “list”–get it? I don’t…) to list (list?) the files in a directory. You can use it two ways:

  • Pre-emptively: tar ft file.tar will show you how it’d extract.
  • Retroactively: rm `tar ft file.tar` will list the files, and pass them as an argument to rm, deleting the mess it just made.

There Goes My Hero

Watch him as he goes! It was the usual “wasting time on Wikipedia” path — I started reading about nuclear fission, and then read about Los Alamos, and then read about the supercomputers, one of which ran Plan 9, so I read about Plan 9, and then its GUI, and then the guy who wrote the GUI. And there was an allusion to someone else, Mark V. Shaney. So I read about him.

In a nutshell, it was a script a few of the Plan 9 guys wrote that would process a lengthy body of text and do some statistical analysis, and use that to spit out writing. It was AI, in a sort, but “schizophrenic” is the best way I’ve seen it described. You read it and it’s one of those things where, for a minute, it makes sense, but then it radically shifts topics or draws some sort of completely irrelevant conclusion. Kind of like a lot of people on the Internet, actually.

They had some fun with textbooks. Here‘s an example, in which the code was fed a basic arithmetic textbook:

Why do we count things in groups of five. When people learned how to count many things, they matched them against their fingers. First they counted out enough things to match the fingers of both hands. Then they put these things aside in one quart. A giant-size bottle that will hold four quarts is a three-digit number….

It starts of making good sense, but suddenly they go from counting on your fingers to putting “these things” in a quart, and is pretty incomprehensible from there.

Here’s another really funny one. You read it, and can kind of comprehend it. But the first reply summarizes it well: it suddenly shifts from constipation to understanding the 19th century, with no logical shift. I think that commenter may have been aware of what was going on. The second guy accurately nails what’s going on.

Finnegan’s Wake? This one cracks me up a lot. But you read this, and doesn’t it exactly sum up what’s wrong with Internet forums? The people just seem totally bonkers, and like they’re ranting but not really sure what they’re ranting about. He manages to talk about being good in bed and using the latest version of BSD in the same sentence. The reply is hilarious, because it’s exactly what you’d think if you didn’t know what was going on: that the “guy” posting was on some serious drugs.

This one, though, is my all-time favorite. It starts off as some religious rant, but clearly not a coherent one. But the fifth paragraph is the best paragraph ever written:

When I meet someone on a professional basis, I want them to shave their
arms. While at a conference a few weeks back, I spent an interesting
evening with a grain of salt. I wouldn’t take them seriously!

I’m fairly certain there are AI ‘bots’ out there that do this same thing, maybe in more coherent forms. I want to acquire one. Badly. I’ve always been interested in the ‘bounds’ of nonsense—when something kind of makes sense, you work with it. We “understand” people shaving their arms in professional settings, and we can visualize someone spending an evening with a grain of salt, and I surely wouldn’t take them seriously afterwards. But we’re making ‘sense’ out of sheer nonsense generated by a computer. How far will it go before we think, “This is complete nonsense.”