Time Until Wedding
Days
Hours
Minutes
Seconds
 
Navigation
 
Search
 
My Usable Projects
 
Reading...
 
Listening...
 
Random Image
DVC00010
 
Archives
 
Me. Elsewhere.
 
Feeds and Such

Google Reader or Homepage
Add to My Yahoo!
Add to Technorati Favorites!
Bookmark del.icio.us
Bookmark Furl
Bookmark Spurl
 
Darcy
 
Things I Like
Sidux Linux
 
License
 
Nix Monitor V0.6

I’m releasing version 0.6 of Nix Monitor today. It’s gotten a bit bigger and harder to configure, so I wrote a kickin configurator script using Zenity for all my prompts. Check it out at http://kde-look.org/content/show.php/Nix+Monitor?content=67399

Posted November 13th, 2007 - Permalink
Categories: BASH - Linux - Nix - Programming - Projects
No Comments »
 
VCReviews - A MediaWiki Extension

Recently I worked on a review extension for the Omaha Wiki. They wanted to give users of the wiki the ability to write reviews for pages, while still keeping control of the content and separating the factual information from the opinions.

Initially I just worked on adapting the Rating extension by Sanford Poon, but it was getting hard to deal with and make all the changes that were needed, so I started over.

The end result is VCReviews which combines the rating and review process into one submission, and is only accessible by logged in users. You can check it out at the Omaha Wiki. Just pick an article and click on a “reviews” tab.

Source is available: VCReviews Version 0.2.2

Posted November 4th, 2007 - Permalink
Categories: PHP - Programming - Projects - VCReviews
No Comments »
 
Recursive Word Count With Bash

I was curious how many lines were in the new OurUNO rewrite, so I decided to write a little script to find out. Well, that all got out of hand and I kept adding things and masks and depth recursion limiting and I managed to stop myself before I added color to the script, so I did okay I guess.

Anyway, here it is. I’m sure there is some really clever way to do an equivalent one-liner of this, but hey, that’s life.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
 
function printUsage {
 
  echo "Usage: countLines directory [options]"
  echo
  echo "Options:"
  echo " -m=XX   --mask=XX    - The mask may be any grep style regular expression."
  echo " -d=XX   --depth=XX   - The maximum depth of recursion. Defaults to 20."
  echo
  exit
}
 
if [ $# -le 0 ]; then
  printUsage
  exit
fi
 
if [  "$1" == "-v" ]; then
  printUsage
  exit
fi
 
TOTALCOUNT=0
FILEMASK=''
MAXDEPTH=20
 
# Drag out our options...
for i in $@; do
  if [ `echo $i | sed 's/^\(-m=\).*$/\1/'` == "-m=" ]; then
     FILEMASK=`echo $i | sed 's/^-m=\(.*\)$/\1/'`
  elif [ `echo $i | sed 's/^\(--mask=\).*$/\1/'` == "--mask=" ]; then
    FILEMASK=`echo $i | sed 's/^--mask=\(.*\)$/\1/'`
  elif [ "$i" == "$1" ]; then
     continue;
  elif [ `echo $i | sed 's/^\(-d=\)[0-9]*$/\1/'` == "-d=" ]; then
    MAXDEPTH=`echo $i | sed 's/^-d=\(.*\)$/\1/'`
  elif [ `echo $i | sed 's/^\(--depth=\)[0-9]*$/\1/'` == "--depth=" ]; then
    MAXDEPTH=`echo $i | sed 's/^--depth=\(.*\)$/\1/'`
  else
    printUsage
    exit
  fi
done
 
CURDEPTH=0
 
function wcDir {
  FILES=`ls -l $1 | grep ^- | awk '{print $8}' | grep -e "$FILEMASK"`
 
  for i in $FILES; do
    LINES=`wc -l $1/$i | awk '{print $1}'`
    TOTALCOUNT=$(($LINES + $TOTALCOUNT))
  done
}
 
function recurseDir {
  COUNT=`ls -l $1 | grep ^d | awk '{print $8}' | wc -l`
 
  CURDEPTH=$(($CURDEPTH + 1))
 
  if [ $COUNT != 0 ] && [ $CURDEPTH -lt $MAXDEPTH ]; then
    for i in `ls -l $1 | grep ^d | awk '{print $8}'`; do
      recurseDir $1/$i
    done
  fi
 
  wcDir $1
 
  CURDEPTH=$(($CURDEPTH - 1))
}
 
recurseDir $1
 
echo $TOTALCOUNT

Bonus! Here’s a tip for posting scripts on the interwebs. Replace your tabs with spaces before copying them into your posts with:
$ cat scriptOrCodeSource | sed ’s/\t/ /g’

Update (11/08/07)So that doesn’t work as advertised. I think it’s doing some double counting or something. I’ll post the rewrite when I finish it.

Posted November 3rd, 2007 - Permalink
Categories: BASH - Linux - Programming
No Comments »
 
My WordPress Was Broken

Whew. My WordPress was broken for a while now. I did an update using Dreamhost’s one-click installs and it blew to pieces. Obviously I have it working again though :) Never found the problem, just did it from scratch.

Also switched to a new highlighting plugin. I like it better, but I had to hand correct all my tags, so if I missed some, my bad.

Posted November 3rd, 2007 - Permalink
Categories: Uncategorized
No Comments »
 
More Posts
« Older
Newer »