.lobo  perfect, pissed off, beautiful, i'm god
"always, always count your curly brackets"
Programing and the ability to program means that one day you will transcend this mortal coil and become a beautiful being of pure light...
I have generated quite a lump of code over the years including TDL, BASH, VB 4,5,6,.Net, ASP/ASP.Net, VBScript, Javascript, C, VC++, T-SQL/Pl-SQL, HTML, DHTML, XML/XSLT, CSS, SilkTest and a shoking assortment of funny little languages that I never used effectively. Here is where I'll try and list some of the code. Most of it will probably be amusing rather than in any way helpful but some things were done right :) Now if I could get Dell to relinquish intellectual property rights on the last four years' professional code this page might actually be useful but ce la bum.
Click on the bullets below for more information
  • Shell scripts
    • cdOven; Linux terminal based cd burner
      • follow the instructions below run ./roast and point it to the tree you want to burn. It will create the iso fs on the fly and stream it to your burner. It even ejects the cd tray for you to load and unload cds :) This and the next script were really just messing with dialog to see if it could be used in decent applications -- the verdic="kinda"
      • This one goes in app/bin/roast
        #!/bin/bash
        ##########################################################################
        #
        # Main scriptfile for cdOven
        #
        # (Manages application flow, changes should
        # be made in the include directory)
        #
        ##########################################################################
        # Feel free to use and abuse this software it's just a fun wrapper to
        # stream mkisofs to cdrecord (cd data burner only... so far)
        ##########################################################################
        # Release History
        # X00-00 1/11/02 Stephen Reilly Initial Release
        #
        ##########################################################################
        # inlude files
        . /root/scripts/cdOven/include/global
        . ${cdO_INC}dialogtext

        # Opening tray
        eject "${cdO_DEV}"

        # Eating blank cd
        dialog --backtitle "${cdO_BACK}" --yesno "${cdO_EATCDTEXT}" ${cdO_EATCDSIZE}
        if [ $? = 0 ]
        then cdO_EATRESPONSE="${cdO_EATCDYES}"
        eject -t "${cdO_DEV}"
        dialog --backtitle "${cdO_BACK}" --sleep 2 --infobox "${cdO_EATRESPONSE}" 5 35
        else cdO_EATRESPONSE="${cdO_EATCDNO}"
        dialog --backtitle "${cdO_BACK}" --sleep 2 --infobox "${cdO_EATRESPONSE}" 5 35
        exit
        fi

        # allowing selection of directory/tree to burn
        export cdO_BURN=`dialog --backtitle "${cdO_DIRBACK}" --stdout --fselect "${cdO_BURN}" 9 40`
        if [ ${cdO_BURN}"" = "" ]
        then exit
        fi

        # nice looking but irrelevant progress bar, you know - the usual
        # well it would be shame to hide the -v output of cdburner
        seq 0 4 100 | xargs -n 1 -r dialog --backtitle "${cdO_BACK}" --gauge "${cdO_PROGTEXT}" 6 50

        # this is the business bit, creating and streaming an iso9660 image to
        # cdrecord, run at nice level 18
        nice --18 mkisofs -R "${cdO_BURN}" | cdrecord -v fs=6m speed=${cdO_SPEED} dev="${cdO_NAME}" -
        dialog --backtitle "${cdO_BACK}" --infobox "${cdO_BAKED}" 5 40

        # pop the toast
        eject "${cdO_DEV}"

        #audio burning not finished yet ...
        #-audio /mnt/cdrom/*
        # for more accurate cd2cd audio recording...
        # cdda2wav -v255 -D2,0 -B -Owav
        # and then run
        # cdrecord -v dev=2,0 -dao -useinfo *.wav
      • and this one goes into app/include/dialogtext
        ##########################################################################
        #
        # Dialog include file for cdOven
        # (Used for setting text variables/titles)
        #
        ##########################################################################
        # Feel free to use and abuse this software it's just a fun wrapper for
        # mkisofs and cdrecord
        ##########################################################################
        # Release History
        # X00-00 1/11/02 Stephen Reilly Initial Release
        #
        ##########################################################################
        # Generic text
        export cdO_BACK="Reilly's cdOven Roaster"
        export cdO_TITLE="Born to Burn"

        # Initial screen
        export cdO_EATCDTEXT="It puts the cd in the open tray"
        export cdO_EATCDSIZE="5 40"
        export cdO_EATCDYES="Thanks, hmmm mmm yummy cd"
        export cdO_EATCDNO="Fine then, let me starve !\nAnd take back your cd too"
        export cdO_DIRBACK="Type in the directory you wish to burn to cd if your screen display is mucky..."
        export cdO_PROGTEXT="Percentage burn complete ..."
        export cdO_BAKED="Bun's done, watch your fingers\nLet it stop spinning first :)"
      • stick this into app/include/global
        ##########################################################################
        #
        # Global include file for cdOven
        # (Used for global settings and cd variables)
        #
        ##########################################################################
        # Feel free to use and abuse this software it's just a fun wrapper for
        # mkisofs and cdrecord
        ##########################################################################
        # Release History
        # X00-00 1/11/02 Stephen Reilly Initial Release
        #
        ##########################################################################
        # directory/file constants
        export cdO_HOME="/root/scripts/cdOven/"
        export cdO_BURN="${cdO_HOME}burn/"
        export cdO_LOGS="${cdO_HOME}var/logs/"
        export cdO_INC="${cdO_HOME}include/"
        export cdO_ETC="${cdO_HOME}etc/"
        export cdO_BIN="${cdO_HOME}bin/"
        export cdO_DIALOGTEXT="${cdO_HOME}includes/dialogtext"
        export cdO_DEV="/dev/cdrom1"

        # cd constants
        export cdO_SPEED=16
        export cdO_SIZE=650
        export cdO_NAME="0,0"
    • m3u2mpg123; Linux terminal based mp3 list creater/player
      • follow the instructions below and run ./m3u2mpg123 /original/list.m3u (/mp3/mount/point/). It will read in the m3u (winamp generated list) and play it with mpg321/123 it sticks in the mount point if necessary. It will convert either linux xmms lists or windows winamp lists replacing windows drive letters with the mount point if supplied. It allows you remove files from the list with a nice dialog GUI thing :) Oh and includes a progress bar which actually doesn't lie, well it gets a bit funny when you try very large lists...
      • put this script into app/bin/m3u2mpg123
        #!/bin/bash
        ##########################################################################
        #
        # Main scriptfile for m3u2mpg123
        #
        # (Converts m3u mp3 list files (winamp/ximms) to a format which
        # mpg123/mpg321 (terminal based mp3 players) can read and then attempts to
        # play them)
        #
        ##########################################################################
        # Feel free to use and abuse this software it's just a fun wrapper to
        # translate mp3 playlists and play them
        ##########################################################################
        # Release History
        # X00-00 2/11/02 Stephen Reilly Initial Release
        #
        ##########################################################################
        . createlist

        USEAGE='./m3u2mpg123 /original/list.m3u (/mp3/mount/point/)'
        if [ $1"" = "" ]
        then dialog --backtitle "m3u2mpg123 -- Stephen Reilly" --title "To use type: " --infobox "\n${USEAGE}" 5 58
        exit
        fi

        LISTNAME=`echo $1 | sed "s/\([.]*\)\.m3u/\1.lst/"`
        if [ ${2}"" = "" ]
        then MOUNTPOINT=""
        else MOUNTPOINT=`echo $2 | sed -e 's@/@\\\/@g' -e 'se\\\/$ee'`
        fi

        sed -e "/^#/d" -e 's/\\/\//g' -e "s/${MOUNTPOINT}//g" -e "s/^/${MOUNTPOINT}/g" $1 > "${LISTNAME}"
        clear
        MODIFYLIST "${LISTNAME}"

        dialog --title "Play list ..." --backtitle "m3u2mpg123" --yesno "The list has been created as ${LISTNAME}\nTo use type ./play ${LISTNAME}\n\nWould you like to play the list in random order with standard paramaters ?" 0 0
        if [ $? = 0 ]
        then mpg123 -g 100 -Z -v --stereo -@ "${LISTNAME}"
        else echo "ok, later then"
        fi

        ##########################################################################
        # Todo:
        # Allow full editing of lists
        #
        ##########################################################################
      • and this goes into app/bin/createlist
        #!/bin/bash
        ##########################################################################
        #
        # Include file for m3u2mpg123
        #
        # (Converts m3u mp3 list files (winamp/ximms) to a format which
        # mpg123/mpg321 (terminal based mp3 players) can read and then attemps to
        # play them)
        #
        ##########################################################################
        # Feel free to use and abuse this software it's just a fun wrapper to
        # translate mp3 playlists and play them
        ##########################################################################
        # Release History
        # X00-00 2/11/02 Stephen Reilly Initial Release
        #
        ##########################################################################
        function MODIFYLIST()
        {
        KEEPLIST=`dialog --stdout --no-shadow --backtitle "m3u2mpg123 -- Stephen Reilly" --title "mpg123 list" --checklist "Use the space bar to include/exclude mp3s" 25 80 19 \`sed -e "s/'//g" -e 's/"//g' -e "s/ //g" -e "s@.*/\(.*/.*.[m|M][p|P]3\)@\1@g" -e "s/\(.*\)$/\1 on/g" -e = $1\``
        #LOWDIG=`echo "${KEEPLIST}" | grep -o '"[0-9]"' | tr '\n' ' '`
        KEEPLIST=`echo ${KEEPLIST} | sed 's/"//g'`

        if [ -f $1.tmp ]
        then rm $1.tmp
        fi

        INCR=`expr 100 / \`echo ${KEEPLIST} |wc -w\``
        if [ $INCR = 0 ]
        then INCR=1
        CAPTION="Rewriting list ... this will go to `echo ${KEEPLIST} |wc -w`%"
        else CAPTION="Rewriting list ..."
        fi
        x=0
        for each in ${KEEPLIST}
        do
        sed = $1 | grep --after-context=1 -x "^${each}$" | grep "^/" >> $1.tmp
        x=`expr $x + $INCR`
        echo $x | dialog --backtitle "List generation" --gauge "${CAPTION}" 6 50
        done
        echo 100 | dialog --backtitle "List generation" --gauge "Write complete" 6 50
        mv $1.tmp $1
        }
    • perl/sed nonsense
      • Python is executable pseudocode
        Perl is executable line noise
        last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
        God, however, uses sed
        sed -e s/o.+/\\f1 ·\\f0 /g -e s/^\([A-Z0-9_][A-Z0-9_()]*\) *\([^ ].*[^ ]\) *\1$/\\b \1
        \2 \1\\b0\
        \\pard\\tx800\\tx1600\\tx2400\\tc3200\\tc4000\\cf0//^\\li0 [A-Z ]*$/{
        x
        s/^/\\li0 /
        x
        }
        #must get the colour working properly :)
        cal | sed "s/\b\(`date +%d|sed s/^0//`\)\b/^[[01;31m\1^[[00m/"
        sed -e "s/[-. \ta-zA-Z0-9]*<[i|I][m|M][g|G]
        [s|S][r|R][c|C]=[\"|\']\([a-zA-Z0-9.]*\)\"[-.\ta-zA-Z0-9]*>.*/¬\1¬/gp" -e
        "s/¬\([a-zA-Z0-9.]*\)¬/\1/p" foo.jsp | grep "^[a-zA-Z0-9-.]*\....$" | sort | uniq
  • Mushroom Clippings (can't remember the real name, JSM or something)
    • a computer language family which escapes the quotidian limitation of linear control flow and embraces program counters flying through multiple dimensions with exotic topologies.
      just had to stick this in, as I said to the...never mind
      [1 J^P$L$$
      J <.-Z; .,(S,$ -D .)FX1 @F^B $K :L I $ G1 L>$$
      The happy little piece of code above reads in a list of "firstname surname"s and sorts them alphabetically spitting out a list of "surname, firstname"s...
i'm disgusted by my fingertips and what they've done .lobo