A New Era in UNIX Timestamps

If you haven’t heard it already, today the UNIX timestamp rolls over 1234567890.  Apparently that is how many seconds  have past since the beginning of the UNIX time epoch: January 1, 1970.  So get your geek on, and party like it is… well… 1234567890 seconds since January 1, 1970.

I’m Hating it!

Humanity has a love-hate relationship with technology. Geeks like to take it to the extreme. Take the recent hub-bub in the blogosphere about the aptly named: Linux Hater’s Blog. In that blog, the anonymous blogger (or bloggers) rants about how BAD Linux is. Its entertaining and educational! Entertaining because rants and rabble-raising is fun… in a perverse sort of fashion.

This is not just a simply a rehash of Microsoftian propaganda; a machination of an ingenious marketing machine feeding FUD to an ignorant public. Rather the Linux Hater’s Blog (LHB) looks at the issues that Linux suffers from. Just like the Unix Hater’s Guide (thanks LH) before it, LHB satires the attitudes of the community, developers and companies in the Linux landscape. And hopeful as satire has done before, maybe better the Linux, Open Source and Software Libre ecosystem as a whole. Don’t be fooled. The Linux Hater is most likely an experience developer in the Linux world, and knows damn well what he is talking err… ranting about. And deep down inside he loves it.

I read both of the Linux Hater’s Blog and Unix Hater’s Guide in their entirety. It changed my perspective. Linux and UNIX are not perfect. The design and implementation of both of them aren’t the shining gems of computer science. And for historical reasons, and laziness on the part of Linux/FOSS developers, just doesn’t cut it anymore.

I admit it. I still prefer Linux. I’ll continue using Linux with all its wrinkles and weirdness because it’s still the best OS out there. I’ll still think freedom in software is paramount. I’ll still advocate open source as the most ethical and efficient way of doing business in the software industry. And I’ll still write in C, C++ and its spawn Java. Cause Lisp is way too hard to do in my head.

Thanks Linux Hater.

Symlink Mirror – A Useful Python Script

Just wanted to share a useful little python script I crafted. I creates symlinks from the top level directories in a specified source folder to a target folder. Its a neat little tool for linking between two distant directories under UNIX. Share and enjoy!

#! /usr/bin/env python
"""    Symlink Mirror -----------------------------------------------------------
       Author: Dorian Pula    Version: 0.1    Date: 2008 May 29
       --------------------------------------------------------------------------
       Creates symlinks in the current directory to the top level folders inside
       a specified directory.  Its a great utility for linking a user's home
       directory with a directory holding files shared between users on the same
       system.

       Usage: python symlink_mirror.py [source of links] [target for links]
      --------------------------------------------------------------------------
       This program is free software: you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published by
       the Free Software Foundation, either version 3 of the License, or
       (at your option) any later version.

       This program is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>"""

import re, os, sys, stat

verbose = "True"

def main():
    """ The main function of the program. """

    'Check if there are enough arguments supplied.'
    if checkNumberOfArgs():
         'Make the path directories.'
         sourceDir = os.path.abspath(sys.argv[1])
         targetDir = os.path.abspath(sys.argv[2])

         'Get all the names of the directories.
         sourceEntries = os.listdir(sourceDir)

         for toLink in sourceEntries:
             source = os.path.join(sourceDir, toLink)
             target = os.path.join(targetDir, toLink)
             dirCheck = os.path.isdir(source)

             if((os.path.isdir(source)) and not (os.path.islink(source)) and not (os.path.exists(target))):
                  os.symlink(source, target)
                  if(verbose == "True"):
                        print "Linking " + source + " to " + target + "."

def checkNumberOfArgs():
    """
    Checks if there are enough arguments to work on.  There should be two
    arguments, the directory from which we generate the links from, and
    the directory in which the links appear. """

    argNum = len(sys.argv)
    if argNum < 1:
        print("I need a source directory to mirror.")

    elif argNum < 2:
        print("I need the directory to store the created symlinks.")

    if argNum < 2:
        print("nUsage:")
        print("python symlink_mirror.py [source of links] [target for links]n")
        return False

    else:
        return True

if __name__ == "__main__": main()