Author Archive

Linux Quiz #008

Friday, June 15th, 2007

Bandwidth Monitor (Submit Answer)

Create a script in the language of your choice to monitor transmit and receive bandwidth in bytes per second. The script should accept two arguments, the interface to monitor and the interval it is checked (in seconds). Output should be in CSV format to STDOUT with the following fields: Timestamp,Interface,RX Bytes/sec,TX Bytes/sec.

Example output:

wriley@behemoth:~$ BWMon --interface eth0 --interval 2
Timestamp,Interface,RX Bytes/Sec,TX Bytes/Sec
2007-05-16 09:10:16,eth0,2043,0
2007-05-16 09:10:18,eth0,1963,0
2007-05-16 09:10:20,eth0,1518,0
2007-05-16 09:10:22,eth0,2304,0
2007-05-16 09:10:24,eth0,1326,0

Postscript for Encoder Wheels

Thursday, May 17th, 2007

From ranchbots

%! Postscript utility for printing an encoder wheel
%
/inch {72 mul} def % #points/inch (don't change me)
/size 0.5 inch def % radius of encoder wheel
/segments 16 def % number of segments (black and white)
/angle 360 segments div def
/wedge
{ /radius exch def
/angle_s exch def
/angle_e exch def
newpath 0 0 moveto
0 0 radius angle_s angle_e arc
closepath
} def

gsave
1.0 inch 1.0 inch translate
0 1 segments {
360 segments div rotate
angle 0 size wedge
2 mod 0 eq {1} {0} ifelse
setgray fill
} for
grestore

showpage

Linux Quiz #007

Thursday, May 10th, 2007

Shell Word Count (Submit Answer)

Create a bash shell script that when given a filename as the first argument will print out the number of words in the filename. The filename can be any text file and a word is defined as a sequence of one or more printable characters, not including whitespace characters.

New Project: usbServo

Wednesday, May 9th, 2007

Flush with the success of my scantool project I have started the usbServo project. There are already plenty of projects out there like this, as well as commercial units, but what is the fun in that? 🙂