I got 99 problems but a bitch ain’t one!

August 23rd, 2007
#!/bin/bash

if [ -f girlproblems.txt ]
then
  FEELINGS="bad"
  PROBLEMS=`cat myproblems.txt | wc -l`
  if [ $PROBLEMS == "99" ]
  then
    BITCHES=`cat myproblems.txt | grep bitch | wc -l`
    if [ $BITCHES == "0" ]
      then
      echo "a bitch ain't one!"
    fi
  fi
fi

Too many glasses of scotch will do that to you.

Grep all files in a directory for a string

June 30th, 2007

grep -i -r somestring ./

-i means ignore case
-r means recursive

Simple stuff, but useful nonetheless.

Opera 9.20-beta Slackware Packages

April 1st, 2007

Opera has released an official beta build of its upcoming version 9.2 of the popular web browser. One of the big drawcards for this release is the inclusion of something they call “Speed Dial”. Basically, it is essentially a launchpad for your favourite sites which is displayed in any blank tab or window. Below is a screenshot of Speed Dial on my system:

Opera Speed Dial

For those of you using slackware and want to check it out, you can download the latest 9.20b release from my Opera Slackware packages page.

Lateralus and the Fibonacci sequence

February 23rd, 2007

You learn something new every day, or so the saying goes. Today I learned that the lyrics from the song “Lateralus” by Tool form a Fibonacci sequence.

Continue reading »

Ballmer reissues patent threat against Linux

February 21st, 2007

Steve Ballmer has fired off another warning shot across the bow of the Linux users and open source vendors in general by repeating his threats to sue companies that do not respect Microsoft’s intellectual property.

Continue reading »

PHP redirect script

February 16th, 2007

When developing and/or designing websites for clients, I often use a quasi versioning system to keep track of older copies of their respective projects. For example, if I often create a repository for all of my development such as http://mybusiness.com/clientname and all subsequent revisions of the project in directories reflecting their version number (http://mybusiness.com/clientname/1/ and http://mybusiness.com/clientname/3/ and so on).

The beauty of this is that when a client inevitably changes their mind regarding an alteration to a design/feature, all of my original work is not lost, and I can easily refer them back to previous revision for comparison.

Below is a simple PHP snippet I use to redirect the user to the latest version of the project. This saves them having to know what number the revisions is up to, and can merely navigate to http://mybusiness.com/clientname and be taken to the most recent trunk.

<?php
$host  = $_SERVER['HTTP_HOST'];
$uri  = rtrim(dirname($_SERVER['PHP_SELF']), '/\');
$revision = '1/';
header("Location: http://$host$uri/$revision");
exit;
?>

Save this as index.php in your top level directory, and simply change the variable $revision to reflect the current version.

Microsoft… anus?

January 20th, 2007

Zune logo upside-down

Is Bill trying to tell us something?

Linux leads Windows and OSX in flash-player version

January 19th, 2007

For the first time in recorded history (ie. as far as I can remember), linux is actually leading the pack when it comes to flash-player versions. The screenshot below is taken straight from the Adobe website no less than a few minutes ago:

Flash Player Plugin

Notice that Linux is at version 9,0,31,0, while both Windows and OSX are stuck at 9,0,28,0. Sure, I may be splitting hairs here, but after lagging (pun intended – ALSA anyone?) at least 1.5 versions behind for the last few years, it is good to be the front-runner for a change.

Get the latest version of Adobe Flash Player for Linux here

Opera Slackware packages

June 20th, 2006

Current testing release

opera-9.20b_20070323.5-i386-1_hno.tgz
opera-9.01_20060629.6-i486-1hno.tgz

Current stable release

opera-9.10_20061214.5-i386-1_hno.tgz
opera-9.0-i486-1hno.tgz

About the above packages

The opera desktop team have been releasing weekly builds of the upcoming recently released version 9.0.

I have been creating opera slackware packages for each one of these releases for my own personal use, and considering the fact that 9.0-final has been released, I thought that might as well share the love and upload my packages for my fellow slackers to use.

The current stable release is available for download, but I will also provide a package of the latest beta/nightly/weekly release. My own personal experience is that the beta builds are more often than not stable enough to use in a production environment, although if in doubt, download the latest stable version.

Note: These packages use shared qt libraries, meaning that you will at the very least require a basic KDE installation. As Slackware comes default with KDE installed, this should not be a problem, and I believe that if you are clever enough to engineer a slackware installation without kdelibs installed, I think you should be smart enough to create your own opera package anyway. If there is enough interest, however, I might provide static-qt opera slackware packages if requested.

Recursively chmod directories only

June 19th, 2006

find . -type d -exec chmod 755 {} \;

This will recursively search your directory tree (starting at dir ‘dot’) and chmod 755 all directories only.

Similarly, the following will chmod all files only (and ignore the directories):

find . -type f -exec chmod 644 {} \;