• Mac OS X,  Mac OS X Server

    Scripted Country Geolocations Using OS X’s Built-In ip2cc

    Recently I was working on a project where we were isolating IP addresses by country. In the process, I found an easy little tool built right into OS X called ip2cc. Using ip2cc, you can lookup what country an IP is in. To do so, simply run ip2cc followed by a name or ip address. For example, to lookup apple.com you might run: ip2cc apple.com Or to lookup Much Music, you might run: ip2cc muchmusic.ca The output would be: IP::Country modules (v2.28) Copyright (c) 2002-13 Nigel Wetters Gourlay Database updated Wed May 15 15:29:48 2013 Name: muchmusic.com Address: 199.85.71.88 Country: CA (Canada) You can just get the country line: ip2cc…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Network Infrastructure,  Programming,  Ubuntu,  Unix

    Opposite Day: Reversing Lines In Files

    The other day, my daughter said “it’s opposite day” when it was time to do a little homework, trying to get out of it! Which reminded me of a funny little command line tool called rev. Rev reads a file and reverses all the lines. So let’s touch a file called rev ~/Desktop/revtest and then populate it with the following lines: 123 321 123 Now run rev followed by the file name: rev ~/Desktop/revtest Now cat it: cat !$ Now rev it again: rev !$ You go go forward and back at will for fun, much more fun than homework… Enjoy!

  • Mac OS X,  Mac Security

    Core Dumps in Mac OS X

    Every now and then, OS X has to drop some kids off at the pool. Usually it’s some developer that didn’t build a sanity check for every-single-possible-flippin’-thing-you-might-think-to-do-to-his/her-poor-flippin’-app-OMGYFI! And then, suddenly, out of nowhere, you get crap all over the system. Actually, as expected, Apple’s dumps are pretty well sequestered in the /cores directory. Each core file has a number appended behind it. For example, core.9901. When applications crash, they can save a lot of information about the state when they crashed into these files. For example, I have seen  cached passwords in there… To disable core dumps, add the following line to /etc/sysctl.conf: kern.coredump=0 After a restart core dumps will…

  • Mac OS X,  Mac OS X Server

    Symbolic Link vs Alias

    A symbolic link is *not* an alias. A symlink (symbolic link) is in the filesystem so all of the layers of the OS can use symlinks. This includes Carbon, Cocoa, Java, and BSD apps. Alias files are Finder-specific concept. Aliases are not used by the rest of the system. Only the Finder deals with aliases. At the Finder level, aliases and symlinks are similar, but symlinks are far more versatile and used in pretty much every flavor of *nix.