If you’ve read any kind of tech news in the last few days, you might’ve noticed that Mac OS X 10.7 Lion is out. I wasn’t going to upgrade for a while, but then it launched and I did. So I’ve been using Lion for a few days now, and I thought I’d join the endless ranks of people on the Internet talking about Apple’s latest big cat. I’m not really going to be much competition for the real tech writers, so if you want to learn nearly everything about Lion, I recommend making a pot of tea and sitting down to John Siracusa’s latest tome. Otherwise, read on to see what I think of the new features.
Rawr, Lion
n+1 years
One year ago tomorrow, I graduated from college. As my younger friends graduated today (thanks for the quasi-livestream, Skye), I actually realized this fact: it’s been a year. A year as one of the dead. A year in the real world. It’s bloody strange. On some level, it’s unbelievable that I’ve been out for a whole year. Graduation was just a couple of weeks ago, wasn’t it? I can still remember lectures good and bad, evenings in the muddhole, nights working in Platt, as though it were all just yesterday. On another level, though, it almost feels like I’ve been out forever. I have a life, and it fits me sort of like a glove. I sit in my apartment and I feel like I’m home, and I really don’t know when that started. I can remember the details of life in college, but it no longer feels like I’m on a particularly protracted vacation.
Looking back with an iota of distance, Mudd was a really transformative place. I can look back on things I wrote a few years ago (hello first post), and it seems really weird. Mudd is a place that tears you down and builds you up in a shape that it finds amusing. Five years ago, about to graduate from high school, I wouldn’t've been able to imagine pulling an academic all-nighter. Nor would I be able to understand the camaraderie of a research team, the bond of dorm-mates, or, well, you get the idea. By the time I crossed the stage last year, it would’ve been strange to me to go to bed on the same day I woke up.
And now? Things certainly have changed in the last year. Some for better, some for worse. I still have a lot of friends, which is nice. Some of them are even people who didn’t go to Mudd with me. But gods know that nothing compares to having everybody you know or want to know living within a few hundred yards of you. Now I have roughly as much money as I could reasonably spend, which I suppose is a good thing. No more problem sets, which is both a blessing and a curse. Yes, I still have that dream sometimes where I’m in the exam for a class and I realize that I’ve never done any of the homework or the reading, and have no idea what the material is about. I know, it’s clichéd.
My gods, dear reader, books! Mudd spent four years drilling into my head that books are those dense and mysterious things that you’ve got to read until you can’t read any more just to keep on top of your classes. I’ve been working hard to get past that — nearly up to 100 books read since graduation, most of which are so light and irrelevant that you couldn’t teach a class with them if you tried. That’s a pretty wonderful part of the real world.
Then, of course, there’s the specifics of my situation. Working at Yelp is pretty good. It certainly has its moments of fun. And it provides me with plenty to do, although when I try to work sane hours, everybody says I’m working too much and should go home. Which is not necessarily wrong, but still rankles a bit. Living alone in the city, that’s a more nuanced thing. I love my apartment, and my neighborhood is pretty cool, but there’s no getting around the fact that it’s pretty weird to live by yourself in the real world. You have to remember to vacuum. And no matter how delicious the food you cook is, there’s always dishes afterward. And you have to work a bit to keep the antisocial factor from turning you into a caricature of yourself. On the other hand, there are no other people to bother you. Nobody complains if you play bad music, sleep weird hours, or let the windowsills get dusty. My view (right) certainly is a lot different than my view a few years ago.
The last year has had a lot of crazy things happen in it. It’s also had a lot of perfectly humdrum things. It’s life. Normal, plain, vanilla life. Who’d've thought?
This isn’t a blog post that has a conclusion or a point. It isn’t a guide or a manual. It’s just an expression of how profoundly strange it is to be an adult, one year in.
Good night, reader.
*nix Tip of the Day: Unix Time
As the unix-savvy among you probably know, there is One True Way to tell the time: the number of seconds elapsed since midnight on January 1, 1970 +0000. It’s an extremely convenient way for computers to represent the time, since it’s just an integer that goes up. There’s no parsing to be done, and arithmetic is just regular math. If you want a brain-numbingly-detailed overview, Wikipedia’s article on unix time is, as usual, sufficient.
However, what I’d like to talk about here is converting back and forth between unix time and meatware time. I imagine that when your beard gets long and grey enough, you are actually able to think in unix timestamps. However, for those of us who have not yet reached that level, there’s the traditional unix command date. (Forewarning: some of the examples I will give here may only be applicable for the date that is part of GNU Coreutils. Mea culpa.)
The simplest thing you might want to do is find out what the current time is as a unix timestamp:
% date '+%s'
1299476266
As you can see, we haven’t run out of 32-bit integer space yet.
However, what about going the other way? Sure, you could write a C/perl/python/etc. program that uses some variant on `ctime(time(NULL))`, but that’s cheating. There must be a builtin? Maybe something that’s not really documented? Lo, there is!
% date -d @1299476266
Sun Mar 6 21:37:46 PST 2011
It’s not in the man or info pages, but there it is. The trusty @-sign solves your problem.
Cheers!
sietchtabr reboot
I have a VM slice that I use to run DNS, a bzflag server, and a few other incidental things. This is what I see on it right now:
% uptime 12:05:13 up 450 days, 15:17, 5 users, load average: 1.93, 1.35, 0.60
It’s currently running Debian lenny, but I decided that I wanted to get with the times and upgrade it to squeeze. As expected the upgrade was fairly painless (took me a bit to figure out that booting by label was broken and I needed to boot by disk UUID), but it’s kind of disheartening to see this:
% uptime 12:48:44 up 3 min, 1 user, load average: 0.30, 0.27, 0.11
Linix Tip of the Day: SystemTap
The other day, one of my co-workers, Evan, presented an interesting problem to me. Every day, at some point, a file named ] gets created in his home directory. He assumes that it is being created by a script with a typo in it… somewhere. But how to find out? It’s a hard thing to grep for.
My initial solution was to use inotify (which you might remember from a previous post) combined with libnotify to alert him if it happens while he was at his computer. It looked like the following:
$ inotifywait -t 0 --exclude='.*[^]]$' $HOME && notify-send "something just created ]"
This is an okay solution (especially in that it took almost no time to write), but it doesn’t actually give any useful information unless you’re sitting at the computer and can do some manual debugging (to try and find what processes are in cron for that time, maybe do an lsof). I could add those things to the script, but there’s still enough of a race condition inherent in shell programming that it’s unlikely they’d be successful. How to solve this problem?
Enter SystemTap. SystemTap is like Solaris’s DTrace: a tool for monitoring and acting on events a the kernel level, without the added bulk of a debugger. Except SystemTap is cooler. It uses the really neat kprobes functionality to tap into the kernel (which I encourage any of you familiar with systems-level programming to read up on, because they’re a lovely hack), it has a clean and typesafe compiled language, and it has a decent standard library.
Installation of SystemTap varies based on distribution, but it’s described in pretty good detail on the SystemTap wiki. Generally, you install debugging symbols for your kernel and the userspace systemtap compiler and runtime. Once you have it installed, you can probably add yourself to a group in order to be able to run stap scripts, or just do it as root. Either way.
So, what did my solution look like in SystemTap? Behold:
probe syscall.open {
if ((filename == "]") || (filename == "/home/evan/]")) printf("%s by %s (pid %d), parent %s (ppid %d)\n", filename, execname(), pid(), pexecname(), ppid())
}
Run that under stap and you get a nice summary of the what is creating the files. Straightforward, and without crippling overhead (just two strcmps per open call). Cool beans!
Of course, this is just the tip of what you can do with SystemTap. For example, Debian Developer/Mozilla Contributor Mike Hommey wrote up a good summary on tracking disk I/O with SystemTap. And SystemTap provides a good base of example scripts for your tracing pleasure.
Feel free to let me know if y’all find any other cool ways to use this technology.





