What I do with my Shell

Lifehacker suggests the following command to list your most frequently used commands:

history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r

The idea is to identify your frequent commands and then perhaps alias them to something shorter. Unix being what it is, of course, you’re unlikely to save many keystrokes unless you’re aliasing not just the command but also its arguments. Anyway, on my Mac, I get the following top 10 list:

  • ls: what’s here?
  • cd: go somewhere else.
  • open: Mac-specific; spawns a Finder window if the argument is a directory or spawns the appropriate viewer/editor for a graphics file, Word document, PDF file, etc. I love this command.
  • ssh: connect to another machine (sorry, elysium!).
  • mv: move something to a better place.
  • latex: there can be only one typesetter.
  • less: less is more. No, wait, less isn’t more. Never mind; just display the contents of a text file.
  • df: how much disk space is left? (I was getting close to the limit of my 100 GB!)
  • convert: magical utility that turns any graphics format into any other one.

On my linux machine at work, the same exercise turned up slightly different patterns:

  • ls: or maybe it was the same pattern.
  • cd: like I said…
  • jobs: oh good, something different! I run a lot of jobs on pavonis and often need help remembering what’s still running in which shell.
  • fg: foreground a job, leaving the others to languish in the darkness.
  • screen: oh, the joys of a detachable screen! I want to learn to wield this magic even more.
  • less: less is still more! Or maybe it isn’t.
  • cut: I love cutting and pasting in the shell.
  • bg: dismiss this job into the background wastelands, where it may toil in obscurity!
  • nice: try not to crowd out other users on the same machine.
  • top: find out who is crowding me out on my own machine.

I don’t see myself aliasing any of these in the near future, but it’s a fun self-data-mining exercise. How do you use your shell?

Watch that Quake!

Today I discovered that the USGS provides KML feeds for Google Earth that will show you, in real-time, the latest earthquakes that have been detected. (Well, with a 5-minute delay.) This came in super handy at work just after the 5.4-magnitude earthquake hit Chino Hills and rolled through the ground under our office building. I’m on the fourth floor. At about 11:45 a.m., I noticed a sort of rocking feeling, and then the blinds started to smack into the windows, and then I headed for the interior doorframe. My grad student intern dove under her desk. Our administrative assistant joined me in the doorway and remarked, “It’s too late in the day for an earthquake! Usually they wake you up in the morning.” We all marveled and held our breaths until the shifting and rattling stopped. One co-worker was in the restroom when it happened and said that the sound of all the water sloshing around in the pipes was pretty “unusual.” Overall, though, nothing broken and no injuries. It was the strongest earthquake I’ve felt since moving here in late 2003.

Once things had stopped, everyone jumped on their computers to look up where it had happened and what the magnitude was. Chino Hills is about 30 miles away. I guess for people closer to the epicenter, things actually fell off shelves. But from a purely geeky perspective, it was lots of fun watching all of the aftershocks being reported in Google Earth. We couldn’t feel any of them (ranged from magnitude 1.2 to 3.4), but they just kept rolling in. The Earth is a mighty sleeping giant… and even a tiny twitch amid all that slumber serves as a firm reminder.

Arise, Fair Sun, and Kill the Envious Moon

There will be a total solar eclipse this Friday, August 1, and if you aren’t fortunate enough to be in a good viewing location (Canada-Greenland-Mongolia-Russia-China), you can watch the event on NASA TV remotely. The broadcast goes from 6 to 10 a.m. EDT, and totality will occur from 7:08 to 7:10 a.m. EDT. That’s a bit early for us West Coasters, but maybe some of you further east can catch it. If you don’t have NASA TV on your TV, you can watch it on the web.

Artificial Intelligence (not for fruit flies)

I recently attended the annual Conference on Artificial Intelligence, held this year in Chicago, IL. I took away several new ideas and thoughts. Here are some highlights:

  • Alyosha Efros gave his invited talk on a variety of cool things you can do with a single image–from inferring 3D geometry to automatically filling in occluded parts to estimating the location where the image was taken, all of his work is exciting even if you’re not a computer vision researcher. (Bonus: how to digitally “shave”)
  • Stuart Russell noted that the graduate Machine Learning course at Berkeley has the largest enrollment of any grad course in the entire university; enrollment has reached as high as 140 students. In his invited talk, he issued a call to arms motivating AI researchers to tackle bigger research problems. “Fruit flies can recognize digits!” he noted. He urged the development of agents with probabilistic first-order logic, that track their internal state, and have the ability to abstract both behavior and their lookahead abilities. Ambitious, of course!
  • Two presentations discussed methods for training a learning algorithm with zero data. No, really! Both pointed out problems in which the class labels or identities themselves can be represented in feature space, so you don’t really need to further train on real data. This is pretty obvious–effectively, it’s for problems where you already have a class prototype or representative, which is one way to represent a learned model anyway–but I think the papers are still useful in that they cause us to stop and think about what we can leverage a priori, instead of just hunting for more and more training data.
  • Explicit Semantic Analysis (ESA) is an interesting text analysis technique that is useful when analyzing short text snippets, like keywords or web search queries. There isn’t much content in a two-word phrase, but ESA can remedy that by searching for the phrase in wikipedia and then expanding the “semantic content” (or representation) of the phrase using the titles of all wikipedia articles that contain it. Pretty clever!

I also co-chaired the Colloquium on AI Education, which was very well attended, energizing, and fun. I may even talk myself into doing some teaching again this year. :)

Detecting Meteors on a Cloudy Day

Watching for meteors is a fun pastime on warm summer nights out in the dark desert; you lie back on a blanket and wait for the sky to present its fireworks. The American Meteor Society (AMS) can help you plan your observing times, with this year’s meteor shower calendar and a weekly meteor outlook. But it turns out that you don’t need dark skies, or even night at all. You can observe meteors via radio instead of by sight.

I learned about this technique from an excellent book I am reading titled “The Sky is Your Laboratory: Advanced Astronomy Projects for Amateurs.” The first chapter is devoted to meteor observations, and I was interested to learn that you can record your observations (such as number of meteors observed per hour during a given event) and contribute them to the AMS, which uses this information in the aggregate to characterize meteor activity. Their visual observations webpage is a little out of date (last updated in 2006), unfortunately, but presumably you can still submit your logs.

At any rate, the book then proceeds to describe how you can listen for meteors with your FM radio. Effectively, you use an FM station’s signal as your probe. Signals at the frequencies used by FM stations are high enough that they generally go right through the ionosphere, but if they hit the ionized gas created by a meteor whistling by, they instead bounce back. So you tune your radio to the frequency of a station that is too far away to be received normally (300-600 miles), listen to the static, and wait for a glimpse of non-static. When the signal successfully bounces, you get a snippet of music or speech, and then back to static. You can count these observations just like you’d count meteors streaking across the sky — except that you can count them 24 hours a day, regardless of sky conditions. Awesome!

Older entries »