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.

DB Stats

I’ve been playing with phpMyAdmin and doing a bit of optimization of it. A few stats:

  • Since I upgraded the kernel, MySQL has been up for a little under 3 days and 11 hours.
  • The DB server has moved 841 MiB of traffic. This is 10 MiB an hour.
  • It’s processed 131,048 queries. This is about 1,580 an hour.
  • 132,000 inserted rows.
  • 96K queries served out of MySQL’s query cache.
  • 1,393 temporary tables created on disk to handle queries. This seems like a bottleneck, although it is only a tiny percentage.

I’ve just restarted MySQL to apply some configuration changes. (Actually, I could have changed them on the fly now that I think about it…) I tweaked the settings a bit: MySQL allows you to set limits on how much RAM it can use for various operations, and I tend to be very frugal. But I think I was shooting myself in the foot there: it was relying on disk a bit too much. It’s not like I’m running a load average of 25 and am moving gigs of traffic a day, where tuning is really vital, but it still bothers me that it’s not as efficient as it could be.

Focus

The other day my camera was in its “AF Hunt” mode, where it couldn’t seem to lock on focus. It’d focus past where it should be, and then turn around and focus back the other way, and just keep going. When you use the flash, it’s worse, because it’ll do a strobe flash to try to aid in focus, but it doesn’t help at all.

After a couple times of doing this, I finally got it focused, and just slid the switch on the lens from “AF” to “M,” disengaging automatic focus. It’d hold the focus that way, so it wouldn’t have to focus every time. (I was stationary, photographing something stationary, so there was no need to refocus every time.)

And then I put the camera down and bumped the lens, so the focus was off. So I just turned the focusing ring. And for the rest of the night, I left the camera in manual focus mode. I’ve found that I can do it just as quickly as the camera can focus the lens, and that’s when it works right: I don’t spin the focus back and forth ten times in a vain attempt to focus something.

Leaving it in manual focus also speeds up the shot: you press the shutter and it takes the picture instantly. There’s no waiting as it focuses.

So almost accidentally, I’ve become a fan of manual focus. Sometimes I’m lazy and want the camera to do it for me, but more often than not, I’m finding that I’d just as soon do it myself.

The Bible

I found a script that does that sort of Markov chains mentioned. I use it in PHP.

I needed a large body of text, though. Just using someone’s blog posts, for example, just results in a lot of repetitiveness. It’s no good. For bonus points, I wanted a large body of text that sounded kind of strange no matter how it was read.

So I found the Bible. It’s doubly good because the wording is pretty archaic, so you’re use to having to carefully analyze it to divine some meaning. While a guy on a forum saying he recently spent an evening with a grain of salt comes across as nonsense, in the context of the Bible you might try to read into it. This is perfect for this script!

Here’s the page. A lot of it’s sheer nonsense, but some of it’s incredibly good. In lieu of actual verse numbers, the script picks up on the numbers and very consistently plugs in two numbers in front of text.

Some recent highlights:

22 7 And David said unto Saul, I saw gods ascending out of the land to bury with the passengers those that remain upon the face of the earth, and upon every high mountain…

The zombies are coming? To kill the living?

5 11 Woe unto them! for their day is come, the time that David was escaped from Keilah; and he forbare to go forth. 23 14 And he went through the corn fields on the sabbath days. 4 32 And they were offended in him. But Jesus stooped down, and with his mouth, and began at the same scripture, and

This is one of those ones that almost tells a ‘coherent’ story about David escaping from Keilah, running through cornfields even on the Sabbath, which offended people. But Jesus stooped down to begin scripture. I’m fairly certain that no such verse appears in the Bible, though.

22 3 And David prepared iron in abundance for God had made them rejoice with great joy

That’s not much of a party….

Of course, sometimes it seems to get in a sort of loop… Anyone who’s read the Bible will recall that it, at various times, launches into really lengthy lists of people’s names and the relations between them. So I cringe whenever it begins doing that, because sometimes it just doesn’t stop. Here’s a good illustration of that:

are honest, whatsoever things are lovely, whatsoever things are honest, whatsoever things are just, whatsoever things are pure, whatsoever things are true, whatsoever things are honest, whatsoever things are honest, whatsoever things are honest, whatsoever things are true, whatsoever things are lovely, whatsoever things are honest, whatsoever things are just, whatsoever things are pure, whatsoever things are true, whatsoever things are lovely, whatsoever things are lovely, whatsoever things are just, whatsoever things are pure, whatsoever
29 2 And he placed forces in all the coasts thereof, from two years old was Jehoash when he began to reign, and he reigned eleven years in Jerusalem.

My biblical history isn’t so hot, but I’m fairly certain that rulers had to be at least three to begin their reign.

15 6 In the morning sow thy seed, and in the water

o_O

40 4 And the glory of their strength in the tabernacles of Ham
16 59 For thus saith the Lord GOD; Behold, I will stand upon my watch, and set me in dark places, as they that must give account, that they may lay hold on bow and spear; they are cruel, and have no child, and her husband were dead, she bowed herself and travailed; for her pains came upon her.

Say what?

33 25 Wherefore say unto them, My little finger shall be thicker than my father’s loins.

Is that an actual verse? It sounds like it may have been the equivalent of a your-mom insult from the biblical era?

Anyway, go see for yourself. Just don’t expect every verse to be good.

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.”

Defragging for the OCD

My Windows hard drive is a 60GB drive, and is always full-ish. With 8% free space (really good for this drive!), a defrag doesn’t get a lot accomplished. The small files are reassembled, but none of the big ones.  There’s not enough room to piece together the paging file.

So here’s how I, a definite OCD-sufferer, am cleaning up my Windows machine:

  • Create a desktop folder, “Crap,” and drag everything on the desktop into it, except for things that I know should definitely stay.
  • Plug in external 500GB hard drive.
  • Move the Crap folder to the external drive.
  • Move everything in My Documents to the external drive.
  • Empty the trash bin.
  • Run CCleaner.
  • Fire up your paid version of Diskeeper (it’s worth it, I promise: and I hate paying for software). Set up a boot-time defrag, and have it get the paging file and MFT as well.
  • Move everything back. Or, realize that you don’t need 3/4 of it and don’t move it back.

Warning: I’m somewhat concerned that some things might not take well to being moved around, like my iTunes Library. I’m posting this as I’m finishing up copying everything over, so it’s possible that this isn’t going to work out as I planned. We’ll see…

Deal of the Day

Lot of 10 machetes, currently 99 cents. Do mind the shipping ($19.99), though.

One may also wish to ask themselves, “Wait, what do I need ten machetes for?” (And, furthermore, “Is it legal to possess machetes on campus?,” which is a decided “Not at all” in my case.) But for those of you living where machetes are allowed, and who can come up with some reason for owning them, this is currently a steal!

Good Piano Songs

This is part of my admittedly bizarre “Lists” category that I seem to be using increasingly often.

Piano-containing songs that are so awesome that they make we want to learn to play the piano:

  • I Don’t Like Mondays, by The Boomtown Rats
  • I Miss You, by Blink-182, albeit mostly only for a small part of it
  • Let the Drummer Kick, by Citizen Cope
  • How to Save a Life, by The Fray
  • Look after You, by The Fray
  • Little House, Id.*
  • She Is,Id.
  • Today, Smashing Pumpkins
  • Sleep Alone, Moby
  • Where You End, Id.
  • Id. is used here in its proper form, but Ibidem or Ibid would be a pretty cool band name.

Jobs

I graduate in May. Here are some jobs that I’d like:

  • Doing soundtracks for movies. Not composing music, just spotting ideal music for songs. I have a whole playlist of songs that are crying out to be part of the soundtrack to a movie. I even resisted the urge to put every Moby song I own into the list. Also, Radiohead’s “Motion Picture Soundtrack” isn’t on the list.
  • Sports photographer. I’d like to go a Sox game some time, and I love taking pictures of things. So I’d basically be getting paid to do something I’d do anyway. And they’d provide me with the equipment. (I hope… Good lenses don’t come cheap.) Maybe just a photojournalist. I already have the press pass. 😉
  • Corporate CEO. It’s unclear where to submit my resume for this position. Maybe they’ll come to me when I get my degree?
  • Doing the soundtrack for Guitar Hero IV or whatever. I already have a list of songs that would be good.
  • President of the United States. No one’s political ideology is as closely aligned with my own as mine. I
  • President of my college. $750K/year. I’ve never even seen ours. I’d do it for half the pay and be twice as visible. And I’d fix the things that need fixing.
  • Police chief on-campus. We’re not solving an awful lot of crimes.

Prevention

Tonight I interviewed a sergeant with the campus police department. He’s starting a community policing division, and some of what he had to say was neat. When he first started doing it years ago, his supervisors thought he was slacking off. He’d spend hours in the residence halls, chatting with students. At first, he told me, students were suspicious. Why were the police asking them about the football game? What were the police really there for? Soon, they got to realize that there was no hidden motive. His job was to patrol the campus and keep a presence in the dorms, and, as long as he was doing that, he figured he might as well make sure people knew his name and that people knew he wasn’t out to get them.

After a while, his supervisors realized that the officer that seemed to waste his shifts chatting with students was one of their top officers. He was solving crimes no one else could, until soon there really weren’t many crimes for him to solve. The crime in the buildings he patrolled dropped sharply. And the reason, he told me, is pretty simple: people knew he was there all the time, so they thought twice about doing anything stupid. And when people observed someone else doing something that affected them, they felt comfortable reporting it to him, whereas they might not want to call the police ordinarily.

But this reminds me a lot of the “Broken Windows Theory.” For those not familiar, some researchers somewhere watched an abandoned building for a while. Nothing much happened. One day, the researchers smashed out one of the windows, and kept watch. In a matter of days, people smashed in all the other windows. The reason put forward is that, when people see things in disrepair or decay, they don’t see as much of a problem with making the problem worse. As a very minute example, consider a trashcan in the bathroom. Would you ever throw your paper towel on the floor? If you’re the least bit civilized, no, it’d never cross your mind. But what if the trashcan was overflowing? You could probably fit your paper towel in. But you just throw it on the floor, partially because you have no choice and partially because you’re dismayed at the level of disrepair. And extrapolate that feeling to the people who would go around committing more egregious acts. I think it’s the exact same thought process.

At work, I probably drove the maintenance people nuts. I considered it a complete disaster if a light in the bathroom was out for more than a day, for example. There were nine bulbs in each bathroom, but a single flickering bulb is all it takes to make the bathroom seem like a run-down place. Pretty soon, I’d tell my coworkers, we’d have graffiti and people breaking the mirrors. We never did find out if I was right, because we never let the chance present itself. (I won’t lie: OCD was another factor that I insisted that burned-out bulbs be replaced ASAP.)

Sometimes we’d be insanely busy. And it felt like the building would be nice and clean for hours and hours, and all of a sudden, the floors were a mess. People would drop crumbs, and, as long as there were crumbs on the floor, why bother picking up the napkin you dropped? And when the people at the next table saw napkins on the floor, why should they bother picking up the plate they dropped? And when the kids a few tables down finished their soda and knocked the bottle over, why not leave it on the floor?

As Malcolm Gladwell would say, there’s a tipping point. Things would be nice and clean for hours on end, until all of a sudden there’s a subconscious signal that it’s no longer necessary to be tidy. And I’m not sure how many of my coworkers understood it on a scientific level, but I think most them intuitively got it. Even though we were really busy, we’d try to find an employee who could spare 15 minutes to go around and pick up. Not only did this have the positive effect of solving the “broken windows” problem, but I think it even went the other way: they saw that, not only were the windows not broken, but we were actively addressing the issue. And every once in a while, you’d get someone who would pick up the trash under their table when you got near them. You’d basically reversed the problem.

Our toilet in our dorm room was getting really gross. In addition to the predictable filth, the top of the toilet had become really dusty, and there were probably about five cardboard rolls from finished-off rolls of toilet paper. The other day, I couldn’t take it any more, so I cleaned the toilet bowl and the seat. I didn’t really have the energy to do the whole thing, so only half the toilet got cleaned. There was still considerable room for improvement, but you were no longer afraid to use it. Today, our toilet is sparkling clean. I don’t know who did it. I never asked anyone to, and I didn’t do it. But I take partial credit. I think I sent a subconscious signal by cleaning half the toilet. All of a sudden, the other part of the toilet was thrown into contrast, and the message was sent that we don’t like our things to be filthy. Someone else picked up on that, and finished the job. And I think the toilet’s going to stay clean for a while.

And now that I’ve talked about sending subconscious messages with my toilet, I think it’s time I acknowledged that I’m up way too late and went to bed.