Using vpnc to connect to a Cisco VPN on Ubuntu

First instal vpnc:
sudo apt-get install vpnc

Now, find the .pcf file that your office provides you. Open it in a text editor and use the relevant info to create file /etc/vpnc/default.conf. The contents shoudl look something like this:

IPSec gateway 123.456.789.123
IPSec ID
IPSec secret
Xauth username

There’s one hold up, though, as many companies provide their secret phrase pre-hashed. This means that it can’t be entered correctly into the configuration file for vpnc.

(your pre-hashed secret string will look something like this)

E6A01097705A303C1128DC224D959D741A708AA5A
AE8D5DAA8E982A5AC5328B76639038E03A8620395
A11C5C1732D5149FB4743293B4E50A

The solution is to hop over to this cisco vpnclient password decoder, pop in your hash, and retrieve the key. If you’re really paranoid, you can download the C source code and run it on your machine.

Finish filling out the conf file, save it, then run
sudo vpnc --natt-mode cisco-udp /etc/vpnc/default.conf

To disconnect, run
sudo vpnc-disconnect

Telco Shakeup

Sending an amount of data that would cost $1 from your ISP would cost over $61 million if you were to send it via text message. How ridiculous is that?

The good news is, the rise of the iPhone seems to be forcing telcos to open up the airwaves to more applications. Verizon plans to open their network to any device and application sometime this year. This is promising news that should help make internet access even more ubiquitous.

Why I use emacs

Everyone’s first vi session:

^C^C^X^X^X^XquitqQ!qdammit[esc]
qwertyuiopasdfghjkl;:xwhat

Working from home




Left: The lab’s Macbook Pro. Not mine, although it is pretty and fun to play with.

Center: Dual monitors for my Ubuntu desktop

Right: An old Dell laptop running Ubuntu Edgy. (I never bothered to upgrade)

all controlled via one mouse and keyboard with Synergy

Whitelisting

The anti-spam movement has long known that blacklists aren’t a very effective way to fight spam. The spammer just registers a new email account, or spoofs the From address, and your blacklist is worthless. Thanks to networks of ‘zombie’ computers, blocking IP addresses is ineffective as well. What’s the only solution that eliminates all spam? Whitelists, of course.

Whitelists have a large number of drawbacks, though. Adhering to a strict whitelist means that users can’t receive email from people who aren’t on their list. That means you’ll miss the emails from that old classmate or new business associate unless you set up some kind of cumbersome authentication system. That’s generally more hassle that it’s worth.

I realized the other day that whitelists are making a comeback, though, in an unexpected way. It turns out that more and more youngsters aren’t using email at all. They prefer to message each other through Facebook.

Sure, the interfaces are clunky, it’s hard to find old messages, etc, but the spam count is almost zero, since you can only message your friends. In essence, the social network acts as a whitelist for communications.

Sadly, this approach doesn’t work well for adults. We communicate with people outside our immediate circle of friends quite a bit. We need to be able to shoot spreadsheets to our business contacts, or find that old email from our boss. For kids under the age of 18, though, none of that matters. They just talk to their limited group of friends, and for that kind of communication, social networks work pretty damn well.

Auto-correct This

Keeping the bashing-on-excel theme going, here’s an old paper from BMC Bioinformatics: Mistaken Identifiers: Gene name errors can be introduced inadvertently when using Excel in bioinformatics

First of all, they got a paper out of stating the obvious? That’s it. I’m going to stop blogging and submit these posts to journals low on the prestige scale.

Second of all, duuuuuh. Auto-correct makes dumb assumptions about dates and numbers, so ‘RP11 | 12E3′ gets changed to ‘RP11 | 12000′. (12E3 = 12e3 = 12×10^3 = 12,000) Awesome, huh?

Another reason why you should stay the hell away from Excel.

Long Day

Some days it feels like all I do is convert files from one ill-defined data format to another.

And for those thinking about storing their massive dataset in Excel, let me give you some advice: Don’t.

If you don’t know why this is a bad thing, find yourself a bioinformatician and ask. Be sure to observe the look of horror on their face when you show them your workbook with 16 different sheets, all cross-referenced and full of arcane formulas that you’ll never be able to decipher. For bonus points, store multiple types of data in the same text field and don’t bother using a consistent format. (It’s okay because, I know that FM85436 is the same thing as 98TBE3)

Sigh. . .

Xbox Live Customer Service: Not Half Bad

I called to cancel my Xbox Live account today, since my one-year subscription was up. (and I don’t play much besides my Wii anymore). I braced myself for the worst, remembering what a pain in the ass canceling these services always is.

The five minute hold time didn’t do much to assuage my fears, so when the Microsoft rep picked up the phone, I was immediately on the defensive. “Hey”, he said, “What can I do for you today?”. Gritting my teeth, I said “I need to cancel my Xbox Live account”.

“Okay, no problem - can I ask why you’re getting rid of it?”

Oh boy, here it comes, I thought. This is where they quiz you about the details and look for ways to retain a customer.

“I sold my Xbox”, I lied.

“All right, fair enough. Do you have any family members that might want to take over your account?”

Sigh. . . What kind of lame script is this? I mean, have they EVER met someone who said “Well, sure - I bet my mom would love to play Halo as ‘LilHellSpawn354′

“Uhh, No. Sorry”

“Hey, that’s cool. I just had to ask the questions off the lame script here. Besides, it’s not like anyone has ever answered yes to that one”

Nice. I appreciate candor. It’s not something you normally see from a service rep.

As he filled out the rest of the paperwork, we made some small talk, and it turns out he was from Missouri and living in Austin. We bitched about the weather for a few minutes while he put through the request, and then the call was over.

It was a mercifully short and even, I daresay, pleasant experience. Some of that may have been because I lied about not owning an Xbox, but issues like that never stopped AOL reps from trying. Since I bitch when customer service goes awry, I feel like I should give Microsoft props for doing it well this time. Props to Brian from Austin, and I hope that people like him are the norm over there. If so, you guys are doing a damn fine job.

Ruby (sans Rails)

Fair warning: If you aren’t programatically inclined, you may want to skip this post.

(Yes, “programatically” is a word, because I say so.)


I wasted a few minutes tonight trying to find out what was wrong with this simple piece of ruby code (which is part of a GEO parser, for the curious)


infile.each_line {|line|
    if (line=~/\^SAMPLE = (.+)/)
        newFile = File.new(”#{name}.soft”, “w”)

    elsif (line=~/!sample_table_begin/)
        header = false
        data = true

    elsif (line=~/!sample_table_end/)
        data = false
        newFile.close

    elsif (data == true) && (fileopen = true)
        newFile.print line
    end
}

it kept giving me the error:

open private method `print' called for nil:NilClass

Turns out it was a trivial scope problem. In Ruby, variables declared within the loop don’t persist into the next iteration of the loop. Contrast this with perl, where doing that would work just fine. Perhaps the perl way is fundamentally sloppier, but it’s a heck of a lot more convenient.

I should have caught this sooner, but switching languages has been messing with my head. Most of our lab uses Ruby, and I’ve been slowly weaning myself off of perl and converting my scripts over.

My biggest complaint so far is that being a young language, Ruby lacks the resources of a Java or a Perl. It’s easy to find a Perl resource to answer your question, but Ruby forums are less common (The Pragmatic Programmer’s Guide rocks, though). The same goes doubly for packages. I looked for ages and couldn’t find a single goddamn Ruby package that will do a student’s t-test. It ended up being easier to use RSruby to interface with my R-server, which is kind of a ridiculous work-around, when you think about it.

All things considered, though, Ruby’s not a bad language. It’s similar enough to perl that switching wasn’t horrible, and I’ve found that the syntax is much cleaner and much more intuitive. Writing code is faster when you don’t have to screw around with dollar signs and semicolons all the time.

Oh, and for the curious, prefixing all of my ‘newFile’s with @ to make them instance variables fixed the problem. Declaring newFile outside of the loop would have also worked.

Understanding Engineers

An engineer describing something as “non-trivial” means roughly the following:

It means impossible. Since no engineer is going to admit something is impossible, they use this word instead. When an engineer says something is “non-trivial,” it’s the equivalent of an airline pilot calmly telling you that you might encounter “just a bit of turbulence” as he flies you into a cat 5 hurricane.

July 17th, 2007  •   Comments Off  •   Tags: ,   •  

A New Low

I was looking for something in my closet today, and thought: “Geez - I really need to delete some of this junk.”

I think I spend too much time on the computer.

Public Service Announcement

My phone plan does not allow me to send or receive text messages. If you have sent me a text message in the last six months or so, I did not get it. I am not ignoring you. I still want to be your friend. You can email me, IM me, or god forbid, actually call me, and I will be happy to converse.

My phone is old and I am cheap, and thus, I will continue to be sans text-messages in the forseeable future. Please plan your communications strategies accordingly.

Now back to our regularly scheduled program.

UPDATE: So several days after I opened my big mouth, I found out that I can now get texting on a small charge per-message basis again. Text away.

Geek Humor at it’s finest

Digg Headline:
“Linux car” first to crash at Indianapolis 500

From the comments:
Looks like it was a driver issue.

Revolt of the Diggers

As you may or may not know, the DRM scheme that protects HD-DVDs was recently cracked. This means that by using a 16-digit hex code, you can decrypt HD-DVDs and copy them, in the same way that DeCSS lets you copy current-generation DVDs.

Users over at Digg started spreading the news and publishing the code in posts and links as the story broke. Due to the fact that publishing the code is a likely violation of the DMCA, digg admins started deleting the posts and banning users that posted the code. The copy-left loving, techno-anarchist kids didn’t like that, and since then, Digg has been overwhelmed with submissions containing the code and derivatives thereof. As of right now, the first three pages solid are nothing but links to the decryption hex. As Matt Haughey points out, it’s always interesting to see what happens when a community revolts against it’s leaders.

Some other Notes:

  • My favorite representation so far is the avatar image that this user made, using the hex codes to represent shades of grey. This sort of creative art has a precedent, including this DeCSS algorithm haiku that gives poetic instructions on how to decrypt DVDs without actually publishing the code.
  • When are manufacturers going to learn that DRM doesn’t work? The way to be profitable in the new millennium is to sell quality products that are easy to buy, fairly priced, and DRM-free. Many artists are doing quite well by following that formula, but it threatens the stranglehold that the big corporations have on the marketplace. They’ve been spiraling into obsolescence since the days of Napster.
  • What we’re witnessing here is the democratization of culture. It’s chaotic, and even frightening at times, but it’s always a lot of fun, and it’s paving the way towards a new era of collaborative culture.
  • Bonus reading: Most anything by Cory Doctrow or Lawrence Lessig

GnuCash

GnuCash 2.1.1 is now out. Besides all the regular bugfixes, the big news is that it’s now available for windows.

I’ve written about GnuCash before, and it’s a great tool for getting your financial affairs in order. As always, it’s free and open source.

Power-up!

I can’t be the only one that thought of Super Mario Bros when I saw this mushroom.

For comparison:
mario mushroom

April Fools

As seen on Waxy.org

Internet Jackass Day 2007 is in full effect

I’m sitting this one out.

Too bad the rest of teh intarwebs are going nucking futs…

Emacs tips

  • To get more color themes for emacs install the emacs-color-themes, available in most major distros. In ubuntu:
    sudo apt-get install emacs-color-themes
    My current favorite is clarity. One you find one you like, edit your .emacs file (in your home directory) and add the line:
    (color-theme-clarity)
    (replacing “clarity” with your theme of choice, natch)
  • Once you know the keyboard commands, the toolbars just get in the way and take up valuable screen real-estate. Add the following lines to your .emacs file to get rid of them:
    (tool-bar-mode 0)
    (menu-bar-mode 0)
  • The scroll bar is also annoying, as are emacs’ default scrolling methods. We can hide the scrollbar by adding this line to our .emacs file:
    (scroll-bar-mode nil)
    The following lines will also add mousewheel support:


    ;; Mousewheel
    (defun sd-mousewheel-scroll-up (event)
    “Scroll window under mouse up by five lines.”
    (interactive “e”)
    (let ((current-window (selected-window)))
    (unwind-protect
    (progn
    (select-window (posn-window (event-start event)))
    (scroll-up 5))
    (select-window current-window))))
    (defun sd-mousewheel-scroll-down (event)
    “Scroll window under mouse down by five lines.”
    (interactive “e”)
    (let ((current-window (selected-window)))
    (unwind-protect
    (progn
    (select-window (posn-window (event-start event)))
    (scroll-down 5))

    (select-window current-window))))
    (global-set-key (kbd ““) ’sd-mousewheel-scroll-up)
    (global-set-key (kbd ““)
    ’sd-mousewheel-scroll-down

Happy Hacking!

Nerdcore

If you’re not fluent in geek-speak, don’t even bother with this one.

Syncing Google Calendar to your iPod

In addition to listening to music with my iPod, I use it to carry around a copy of my google calendar. How, you may ask? Well, it takes a few steps to get set up, but it’s easy as hell once you do.

Instructions for syncing iPod to Google calendar from Windows or Ubuntu Linux:

Windows:

  1. Download wget for windows. Extract the contents of the zip file to your windows/system32 folder
  2. In iTunes, be sure that you have “Enable Disk Use” checked for your iPod. Note the drive letter that it maps to in “My Computer”
  3. Download this batch script: gcal2ipod.bat, the contents of which look like this:

    cd I:\Calendars
    IF EXIST basic.ics rename basic.ics oldbasic.ics
    set address=”http://www.google.com/calendar/ical/chrisamiller%%40gmail.com/private-46a6b4e3c29303d17
    58bb39a874672ef/basic.ics”
    wget.exe -T 10 -t 3 -O I:\Calendars\basic.ics %address%
    IF EXIST basic.ics del oldbasic.ics
  4. Change every instance of “I:\” to be the appropriate drive letter for your iPod.
  5. Change the google calendar url to match your private feed. This can be found by going to Settings>Calendars, then clicking on your calendar. You want to copy the Private address of the iCal feed. Paste it into the script, in place of the address I have there. Important: You have to change the “%40″ in the address to “%%40″. This is so the windows command line will recognize the percent sign correctly. (Took me forever to figure that out…)
  6. Save the script and run it by double clicking it. If all goes well, you can fire up your iPod and peruse your calendar entries through the Calendar function. I went a step further and added it to my Scheduled Tasks. Late every night, the script fires up and syncs it for me, if my iPod is connected.

Linux

This is going to be vastly simpler on your Ubuntu linux box. I assume that your iPod auto-mounts at /media/ipod (the default location). From the command line:

  1. Create a new script:
    gedit gcal2ipod.sh
  2. Paste this into the script:

    #!/bin/bash
    wget http://www.google.com/calendar/ical/chrisamiller%40gmail.com/private-46edb3ae3c930dd1458bb39ae74672ef/basic.ics
    mv basic.ics /media/ipod/Calendars/basic.ics

    Replace the calendar address with your private iCal feed, as described above.

  3. Save the script, close the editor, then make the script executable:
    chmod +x cal2ipod.sh
  4. Run the script by typing “./cal2ipod.sh”. You can then create a cron job and have it run every night, if you’re so inclined.

Hope this is helpful!

« Previous Entries |