Tuesday, March 31, 2009

Writer's Block: How Soon Is Now?

What scientific or medical breakthrough do you most want to happen in your lifetime?
Live Journals Writer's Block

medical... probably a toss up between a cure for Alzheimer's and a cure for cancer. I still remember my grandmother, from when I was little up to when she finally passed on. Heh to this day my mother refuses to donate to the Alzheimer's association. In my family, it's also a general thing: you will probably die of heart attack, cancer, or stroke; take ya pick.

scientific... well, if I was an inventor my "pet project" would probably be to invent something like the force fields in Star Trek. In the wider scope, I'd kind of like to see advances in high energy physics and a less radioactive form of nuclear power: like the minovsky fusion reactors from MS Gundam, in application.

Finally managed to embarrass myself lol

The other day, I was on comms waiting for Carter to show up; so I was getting some work done in the mean time. No one was around the virtual pub yet, so I didn't worry about the copy/pastes (my push to talk key is left control). Managed to get a head start on my work load, but The parakeets chirping, so I'm whistling back in the hopes that the bird will pipe down by the time training starts; then I realize a teammates sister joined the channel, and I'm thinking "oy, could this be taken the wrong way" lol.

That's the most embarrassed I've felt in many years :-/.

You know you code to much when....

you can read this code without a compiler

even worse, when you enjoyed reading it.... haha !!!

funny qotd

The average girl would rather have beauty than brains because she
knows that the average man can see much better than he can think.
-- Ladies' Home Journal

At the bottom of my login profile is a `[ -x /usr/games/fortune ] && /usr/games/fortune -aes` line that likes to generate odd messages haha

Monday, March 30, 2009

Writer's Block: Prison Time

If you were sent to prison for an undefined amount of time, what would you miss most?
Live Journals Writer's Block

Probably programming!

Honestly, I can't fathom what it would be like to not program stuff.... if I didn't have a computer or something, you'd probably find me rewiring old electronic gizmo's into something new and strange, or building a robot.... or accidentally electrocuting myself in the process lol.

(that being said, if I had the resources I would try building my own PDA, and probably have to watch the FCC confiscate it or something :-(.)

a great time saver in thick subs

sub ... {
    my $coderef = sub { 
        function body ...



Sunday, March 29, 2009

A little real life.... (IRC style)

     i3lack0p | so is there an exit script for blackbox?      │
 SAS_Spidey01 | 'exit script' ?                               │
     i3lack0p | yea when a user request to log out of a       │
                blackbox seesion is there a script that will  │
                execute                                       │
     i3lack0p | before the user leaves                        │
 SAS_Spidey01 | somehow I think blackbox enter and exit       │
                scripts are delegated to the 11th power of X  │
     i3lack0p | what                                          │
     i3lack0p | .blackboxrc is the startup script is there an │
                exit script                                   │
             -*- SAS_Spidey01 bangs head against wall         │

note: Blackbox = Window Manager for X11; .blackboxrc = x resource file which is != a script.

this is something I would do

This linguistics professor was lecturing the class.
"In English," he explained, "a double negative forms a positive. In some languages, such as Russian, a double negative is still a negative."
"However," the professor continued, "there is no language wherein a double positive can form a negative."
Immediately, a voice from the back of the room piped up: "Yeah..... right...."

mm, bash.org is making this a laughing day lol


Chuckle of the day, 2009-03-29

Quote #877975:

I got the worst fortune after having a condom break
"Even the smallest leak can sink a ship"
Damn Asian Cookies

*rolling on the floor laughing my freaking rear-end off*


#26985 +(75)- [X]

-= fortezza] if I push my honda over a cliff, how fast will it get to 60mph?
-= x1bncwn] the same speed as the viper
-= x1bncwn] :P

The others, are at best rated NC-17 or generally offensive in anture, but still funny lol.

interm to-do-list

  • finish sas work
  • finish implementing history commands/HISTFILE in tpsh
  • take a shower
  • hexedit firefox3 > /dev/hell/level/7
  • figure out the least painful route of doing a crap load of software updates on my laptop

spent most of my day in the proving grounds, and a little time on the hallway. Really, I was rather surprised: my first trip down the hallway I was making good accuracy, good pace (for an old fart), until I got to the nearly bullet proof potted plant and the 9mm roller skater next to the hostage lol.

bookmark: cmp nasm gas


last line read: NASM uses the resb, resw, and resd keywords to allocated byte, word, and dword space in the BSS section.

(back in dec/jan or so, I was trying to learn some asm using examples in GAS and the NASM manual; wish I had time to restart those studies!)

Friday, March 27, 2009

Good girl, bad girl?

Willow laid down on the floor eating something and I called out, "did you give her a carrot or something?" (the Vet Tech proscribed healthy-snacks lol) and Ma answered back No, as the dog ran out of the room.

I found Willow on the floor behind the cache trying to eat it, but didn't see it... to me it looked like it might've been a big piece of bird seed, I couldn't get it out of her mouth so I commanded her to "split it", she did.... surprise, surprise - it was Ma's Vitamin E softgel! She did it once with a calcium pill, that looked just like her interceptor (worm-preventive) pill; but hid it because it didn't taste good enough to chew haha; after that she stopped eating her interceptor like candy. This time, I guess the vitamin E must have tasted good :\

"Bad giir... good girl for spitting it out, but bad girl for taking it!"

So I swapped it with a marrow bone, and Willows all the happier lmao.

Dogs are just like kids, gotta watch them close or don't be shocked at what ends up in their mouths when you're not looking lol.

Code monkey go to bed...

It's been a rather slow day, but somewhat productive (only about 10 or 11 commits :@). My families made sure that I've had a throbbing headache most of the day... rat fuckers! But at least there is some work to show for it. tpsh now has a concept of $PATHEXT based on cmd.exe's %PathExt% variable.

Windows is ruled by file extensions, while UNIX could care less about them; so really one of the few good things about Microsoft's cmd.exe is you can tell it what file extensions should be "understood", i.e. so you can type 'notepad' instead of 'notepad.exe'. Since tpsh is modeled after the standard Unix sh, it's mostly oblivious to file extensions: it cares about names. However it is virtually _impossible_ to use Windows from the CLI level without implementing something like PATHEXT or typing yourself into a nightmare (winxp/cmd.exe is actually good at making you do that, compared to a unix/sh).

For better compatibility with a Windows environment, tpsh now implements it's (my) own concept of the feature, complete with a 'pathext' option (default on) to toggle the functionality. The main reason tpsh does this, is so I can type 'gvim' when I mean 'C:\Path\to\gvim.bat', the fact that I'm used to typing 'vim' is aside the point lol. (I rarely use gvim off win32 b/c of diffs between nt and unix cli)

About the only time I use file extensions is when forced (Win32), when ideal (.zip, .tar, etc), when saving text with CRLF for new line indicators (notepad friendly .txt), multimedia files (.png, .ogg, etc), or when deploying crap to a Windows machine lol. So it's not an important thing for me; just a time saver.

Another thing I sorted out is what I call the "hash separator" for environment variables. UNIX shells by convention separate values like $PATH with a ':', e.g. '/bin:/usr/bin', but DOS and related bastards use ';' for things like %PATH%, e.g. 'C:\Windows;C:\Windows\System32'. Because many older operating systems use a 'letter:path' style for paths anyway, there is no universally portable default setting. Since virtually all operations involving a variables like PATH, CDPATH, and ENV (an extension used in tpsh, which I've never seen another shell use) involve a hash table, I call the mark the 'hash-sep' for short. One of today's changes was exposing the hash-sep directly to the user.

The default hash-sep is ';' under MSWin32, DOS, and OS/2 and ':' otherwise, I've no clue what the hell VMS uses and don't have access to it, so no worries yet ;-). Whenever the user changes the HASHSEP environment variable, the next time an operation that relies on it (basically hsplit(), short for hash-sep split()) the shell compiles it down to a suitable regular expression to save time on future commands.

setenv HASHSEP '/'

the rehash will cause '/' to compile via qr for to speed up later splits; and due to the change of hashsep, causes the internal cache of $PATH to switch from the default ':' or ';', to '/', which is probably not something anyone wants to do, but being able to fiddle with it can be useful for scripting reasons ^_^. Not to mention the fact that it makes concatenating things like PATH/CDPATH settings more portable when the environment requires something different.

Another bit of today's work, was setting it up so that the history built-in now displays the correct line numbers. I want to setup builtins to save/load data from HISTFILE; so that command history is not lost between sessions - I've always had a bit of an itch about how most shells deal with it; wonder what tpsh might do hehe. Not sure about the $LINENO yet, I never really use it in scripting or interactive usage that much: will probably take the single unix specification into consideration on $LINENO.

If I didn't have to so much crap for tomorrow, I could probably have half the manual done tonight and still get to bed before 0600 local. But no.... work early, work long, to be driven nuts after work, and probably end up PTFO instead of coding the night way.


my idea of a great vacation: a Ferrari, laptops, solar panels to power them, hot date, and a tropical island with a sunny beach ;-)
man, what the heck did we do before tools like git?

don't answer that.

Thursday, March 26, 2009

An epiphany!

3. a sudden, intuitive perception of or insight into the reality or essential meaning of something, usually initiated by some simple, homely, or commonplace occurrence or experience.

I actually thanked my mother for dragging my out on a shopping expedition today, because I figured out sometime a ways "down" my todo list: implementing control flow in tpsh. I guess you can take the programmer away from the code, but you can't take the code away from programmer ^_^ ^_^ ^_^.

Earlier I recorded that the goal was for tpsh to use a queue of commands to execute rather then going by lines, the idea being:

`cmd1; cmd2; cmd3`

would parse into a list like '(cmd1, cmd2, cmd3') which tpsh would then walk, eval, and execute the result in sequence (i.e. first in, first out). Then it occurred to me, if the shell will go that route for lexical reasons: why not implement the shells control flow operators as keywords that manipulate that queue directly? So that conceptually, a shell snippet like:

if [ expr ]; then

would be inserted into the queue in a suitable manor and passed to the call back, so if the queue looked something like this:

( cmd0, if [ expr ], cmd1, cmd2, else, cmd3, cmd4, fi, cmd5 )

the call back would receive that relevant portion of the queue, (i.e. queue1 through queue7), evaluate the test and return the appropriate portion to be spliced into the queue, in this case:

( cmd0, cmd1, cmd2, cmd5 ) or ( cmd0, cmd3, cmd4, cmd5 )

depending on whether `[ expr ]` evaluated as true or false.

Damn, this so makes me want to straighten up the necessary parts of tpsh... now if only I didn't have to work tomorrow from morning to whenever I drop over undead, or pass out lol. These kinds of things have always fascinated me about programming, but life has never offered much chance to study compilers, virtual machines, and interpretors... let along create something like tpsh, that requires implementing a scripting language :\. The one good thing, despite the ups/downs and expressiveness of sh script, it's really an easy language for a human to understand.
hmm, there was something I wanted to add a `set -o option` for, but I can't remember what the heck it was lol.
man it's been a slow day... I've only made about 15~16 commits on tpsh, one of which was merging branches lol. The main focuses of today's tinkering has been minor bugfixes (mostly related to and tweaking the completion function.

Previously my completer would just take a quick approach, but always doing completions for built in commands, stored macros, known programs, and filenames. Now it has some notion of *what* it should complete.

$ b^I -> assume it can be anything
$ echo b^ -> assume it's a file (formally a full eval() was done)
$ builtin l^I -> complete built-in commands
$ alias x -> complete to names in %Macros.

When I get the time, I want to make the completion function have a more hot-plug-in nature to it. A pre-completion hook, completion hook, and post-completion hook; the pre getting to modify the thing before completion, the completion hook being able to totally replace do_completion() aside from the pre/post hooks; and the post-hook having a change to modify the completions being returned. The current working idea is: a TPSH_WHAT_HOOK environment variable being set to A. perl code to generate a CODE ref from, or B. an external program to delegate to. (e.g. TPSH_COMPLETION_HOOK="compl.rb" would pass compl.rb the necessary data, and expect the program to generate a \n delimited list on its stdout for tpsh to parse). Odds are there will be more variables to tune it with later, as well as the API avail. being documented in the manual page My main reason for desiring this style of dynamically configurable completion is so I could do things like, seting up my tpshrc to "ignore" any 'lost+found' entries in filename completions; i.e. /usr/local/l^I expands to /usr/local/local not /usr/local/lo - completion list for local / lost+found. I know the zsh (which I use a lot) is noted for it's configurable completion and spelling correction, but honestly I've never customized it beyond the lines zsh's setup program added to my rc, let along RTFM'd about it lol.

Making it easy to add command sensitive completions through the hooks would be nice too, e.g. `man 2 foo^I` and have a hook spot the man 2 and go about completing foo to manual pages in section 2, hehe. (the only zsh feature I abuse, actually lol)

Really what needs doing atm in tpsh, is cleaning up the lex/eval subroutines and merging them and a few related changes with resolve_cmd(). Basically the principal adjustment needed is to go from line-based handling of commands, to (properly) breaking them lexically for storage into an execution queue. Generally though I like how stuffs coming along, except for a few odds and ends here and there.

At one point,tpsh relied on a list of "this command marks something to skip macro expansion on", a quick solution until expand_aliases() could be rewritten. One night I found myself working on a scratch file with commands to modify said list (add, rm, and show the non expanding commands list via expr or array slice/index). That's when I threw my hands up in disguest, and decided tomorrows job would be fixing expand_aliases (note to self: s/aliases/macro/). Imagine if you tried to type 'unalias ls' and the shell expanded ls to it's aliased value, that kinda stuff. Kind a cool to be able to configure that, but kinda wrong to need a linear look up on each pass through the loop (ugh!).

To add built-in commands to manipulate said list rather then fix the problem, just was not something I was NOT willing to do... because to my eyes, it would be like a pox on my honour as a programmer: to gamma-weld such a cheap trick into place with built in commands to configure and abuse it rather then fix it -- thus the macro expansion system got re-implemented, much more correctly this time. (didn't have time to sort positional params and what nots).

I am also VERY glad that tpsh is being developed with git, rather then cvs! (I've also spent part of tonight learning more about gits plumbing)

chuckle of the day, 2009-03-26

(07:04:54) noles: is git is a british slang for stupid?
(07:05:57) me: always thought it was synonymous with obnoxious pain in the ass, but hey am an obnoxious American pain in the ass >_>
(07:06:06) noles: brilliant!
(07:06:13) me: xD

Wednesday, March 25, 2009

A jurassic treat

Ahh, a good movie that I haven't seen in ages: Jurassic Park!

There's just something special about JP, different then most films. IMHO I think the book was much more through, and the sequels more action packed but the original Jurassic Park has just got that air, that feel about it. I've always been fascinated by dinosaurs, all of my life, but knowing the amount of college involved with paleontology I never made it a high-point in my education.

Hmm, for some reason that brings back memories of my birthdays. When I was a little kid, every birthday party was ruled by dinosaurs: or as my aunt Janet probably put it, if I've got to wear this stupid (dino) hat again next year, I'm going to kill this kid looooool. When Jurassic Park came out back in the early 90s, it got even worse xD. Heh, even when I first hit the World Wide Web, my first web searches were paleological in nature lol.

What can I say, I like the study of history and technology in many forms.... <-- geek.
Been working over SSH from SAL1600 today, since my rooms flooded out with cloths racks :\. This crappy wireless ain't helping either, just to keep things stable I've had to drop from AES encryption to Blowfish and add compression... either the signal utterly blows these days, or PuTTY must leak a lot of resources me thinks.

I cloned master in /srv/git/Projects/tpsh to /tmp/tpsh to do a little work, when surprise surprise... OpenBSDs perl barfed at Getopt::Long::GetOptionsFromArray. A cursory inspection of installed Perl modules around the network & change logs, showed my worst fear was right: it's an experimental function added 2 years ago. After inserting a banda-id, and doing quite a bit of testing to avoid regressions... I also fixed a few other bruises and found a few things Perl 5.8.8 / use warnings didn't like very much.

The birth of the "porting" branch, lol.

After taking care of pushing that out to the shared-repos, I checked out master and implemented the eval built in, so before I start coding tonight on my laptop I'll need to update the master branch there from the one on the server, and merge in the changes from the porting branch.

Currently I've got three versions of Perl installed, 5.8.9 on the FreeBSD laptop (the authoritative git repository), 5.10.0 (activeperl) / 5.8.8 (from msys-git) on Windows XP, and 5.8.8 on the OpenBSD machine (home of the shared repository / insurance policy).

if tihs infernal wireless goes out once more.... I might just start working from my laptop on the couch, and the hell with this P.O.S. At least then, Iw ouldn't have to SSH to get work done ^_^.
commit b841dc4954c24d0abea43daf407b6bf70e1c450b
Author: Terry ******* ****** <***********@****.***>
Date: Wed Mar 25 07:15:31 2009 +0000

massively improved alias expansions

aliases now expand recursively until resolved or aborted. A circular
alias like x = y; y = z; z = x; will resolve x to x when it hits z. The
expansion of aliases should behave more or less as desired, but without
positonal paramter support

$ alias x='y -opts P'
$ alias y='z -flags PP'
$ alias z='echo z PPP'
$ x one two three
z PPP -flags PP -opts P one two three
$ alias x='y -opts P'
$ alias y='z -flags PP'
$ alias z='echo z PPP'
$ x one two three four
z PPP -flags PP -opts P one two three four

At the moment the shell local()'s %ENV before each expansion, and will
likely set 0..$#, $#, $@, and $* accordingly someday; but currently does
not use %ENV for anything. In order to allow macros to change the
environment, we can't just local() %ENV to implement positional params
for macros, but it will be a suitable stop-gap until done fully.

note: alias, macro, and function all revolve around %Macros and
&expand_aliases for macro expansion.

the next big chore is improving the code that invokes expand_aliases(), lol.

Why Macs own PCs


Thanks for the distractions Noles 8=)

Monday, March 23, 2009

another (big) section of the manual written, ENV processing, and an initial implementation for the history built-in among a few other things is done.

One interesting thing, usually sh only allows a single file in $ENV, and some versions of sh don't even understand it period! In tpsh, as an interesting extension $ENV is treated like $PATH, in so far as ENV=/etc/tpshrc:/usr/local/etc/tpshrc:~/.tpshrc would cause tpsh to source an rc file in /etc, /usr/local/etc, and then the users home directory.

(Because of old OSes using drive letter:path like C:\Windows, under such OS tpsh uses ';' instead of ':' to separate things like $PATH)
For some odd reason, I'm getting a notion that Term::ReadLine::Zoid is the only read line package for Perl, that isn't fucked in the head >_>

Sunday, March 22, 2009

the things I need out of life, never seem to be in the cards :\. One thing I do know, I want tpsh to have profile/ENV and history support before nI pass out for the night; the only thing ot stand in the way is the usual miseries. Since the . and source built-in's were implemented last night, and the ability to handle scripts some time back: doing a simple profile/ENV handling on startup is pretty easy now lol.

Really my head's not very clear right now. I feel kind of like firing up doom-hr or wesnoth, but I'm not really in the mood for a game either :-(

casual fun with the Perl profiler

call: dproffpp -ap shift.pl

there are three sets of data, each meant to represent a small, medium, or large set. Each set is a list of words, 5, 25, and 100 words long respectively. (realistically the elements would average within 2 to 5 words inclusive). For simplicity N is 10.

There are 2 functions, xx and yy; representing different ways of solving the same problem: pretty printing the last N items of a given data set. In xx(), the set is reversed and then $#set -= N'd to clip all but the last N items, then reversed again to put it back into proper order. In yy() we avoid any reversals and just shift off the front of the list one at a time, until we reach N items left in the set. If the set contains less then N elements, no adjustment need be done.

Each function is called 3 times per iteration, once with each data set, over 3000 iterations (that's 9000 calls to each function, or 3000 times with each set). The test was then executed 10 times.

The things so simple, it's not important how long it takes to finish, but I'm interested in how big the the difference is between for (expr1; expr2; expr3) { shift @list } and $#list -= expr; and how much those two reversals hurt.

Every time, yy() ran faster by at least a half second. Then ran tests with xx() doing one reversal, then no reversals and yy() still beat it.

Now out of more curiosity, let's see how larger data sets work. Each data set now contains 3 words instead of 1, and N is now 43; with the data sets being 5, 25, 100, 250, 500, and 1000 elements long.

A new function, zz() which is xx() without the reversals is also executed during the tests. After running the tests a short duration, it seems that the $#set -= N'ing is a bit faster, more so then the cost of the reversals.

here's the new run down:

$ do_test() {
>   local T=10
>   while [ $T -gt 0 ]; do 
>     N=$1  dprofpp -ap shift.pl | tail -n 7 >> dp
>     T=$(($T - 1))
>   done
> }
$ for NUM in `builtin echo "3\n10\n43\n51\n227\n"`; do do_test $NUM; done

The above (z)sh code will execute the test on shift.pl 10 times with an N of 3, 10, 43, 51, and then 227; appending the report (3 subs = (4+3) lines) to the file 'dp' for post-cpu meltdown review, otherwise we would have to take a look at all the I/O the tests generate before the report is printed by dprofpp.

Yes, I'm to damn lazy to use command history, let along retype the commands each time; why else would they have invented functions and loops :-P

About 15 minutes and 17 degrees Celsius later, some of the arithmetic involved finally caught up with my throbbing head.


  • 5 tests, each test has a different value of N
  • 10 runs of each test, meaning 50 runs
  • each run examines the data sets 3000 times, for 150,000 examinations
  • each examination calls 3 functions once with each of 6 data sets, 18 function calls per examination.
  • The six data sets consists of a list of 5, 25, 100, 250, 500, and 1,000 elements; each element is 3 words long. So like 1880 elements in the data set, and 5,640,000 elements processed per examination

So that is what, maybe 2,700,000 function calls to &xx, &yy, and &zz; without counting the calls within those functions... and 846,000,000,000 list elements processed overall? After a little estimation based on the original data set/run time, I stopped counting after the estimated execution time passed 8 hours * X on this old laptop. Hmm, how's that old saying go, curiosity fried the geeks cooling fan? lol.

I'm beginning to understand why some peoples workstations have like 32 ~ 64 GB of ECC RAM, and Symmetrical Multiple Processor (SMP) configurations to drool $! for, haha!

How the code comes out, when you're ready to pass out

# message for commit 041a7343eb452b827dbd97a0c82c8538597f86f6:
#   read built-in command implemented

sub read_bin {

    my ($prmpt, $time);
    my $line = "";
    my @argv = @_;
    my %opts = ( 'p=s' => \$prmpt,
                 't=s' => \$time,
                 'e'   => sub { "no-op" },

    do_getopt(\@argv, %opts);
    unless (@argv) {
        warn "I can't read into thin air!";
        return 0;

    if ($prmpt and -t *STDIN) {
        print $prmpt;

    eval {
        # remove custom die for ease of error check/report
        local %SIG;
        $SIG{__DIE__} = sub { die @_ };
        $SIG{ALRM}    = sub { die "timed-out\n" };
        if ($time) {
            # an s, m, or h suffix causes sleep for sec, min, or hour
            if ($time =~ /^(\d*)([smh])/) {
                if ($2 eq 's') {
                    $time = $1;
                } elsif ($2 eq 'm') {
                    $time = $1 * 60;
                } elsif ($2 eq 'h') {
                    $time = $1 * 3600;
                } else {
                    warn "internal error on ", __LINE__;
                    # NOTREACHED
            alarm $time;
        chomp($line = );
        alarm 0 if $time;
    if ($@) {
        warn $@ unless $@ eq "timed-out\n";
        # on time out, init the vars to empty strings
        @ENV{@argv} = ('') x scalar @argv;
        return 0;
    } else {
        # set each var to the words
        # XXX because ifsplit has no notion of a &split 'LIMIT'
        #     if we used ifsplit here instead of a manual split,
        #       read x y
        #       foo bar ham
        #     would set $y to 'bar' instead of 'bar ham'
        my $ifs = defined $ENV{IFS} ? qr/[$ENV{IFS}]/ : qr/\s/;
        @ENV{@argv} = grep !/^$/, split $ifs, $line, scalar(@argv);
        return 1;

from the manual page updated in commit b1317d7e6e7f91b6c3a2650f44cd4f425e381d42 with message:

read built-in command documented

and blockquoted here using the pod2html output

read [-p prompt] [-t timeout] variable ...]

Read a line from standard input, split by fields, and assign each field to the indicated variables. If the number of variables is less then the number of fields, the remaining fields will be stored 'as is' in the last variable. If there are more variables then fields, the excess variables will be undefined. A prompt may be printed before reading input, by using the -p option. The -t option may be used to specify a timeout in which to abort the operation, should the user take their sweet time about pressing CR. The timeout value can take an optional s, m, or h suffix to denote seconds, minutes, or hours. If no suffix is given, s will be assumed.

It's not the greatest... but hey, I ain't had any sleep since this mornings roll out... lol. It'll do fine for an initial implementation, until I've actually got a functioning brain to deal with it :-P

Saturday, March 21, 2009


Don't worry about avoiding temptation -- as you grow older, it starts
avoiding you.
-- The Old Farmer's Almanac

I wonder, if I'll ever live to be that old lol.

The wonders of Raven Shield....

Ok, not so surprising I slice 'round the corner, spot the X-Ray on the top of the stairs -> squeeze off a shot from my M16A2 on 3-round burst. Ok, no effect not even a flinch so 1ce more... 2ce more.... POW he shoots me.

The evil thing?

Trigger pulls -> 3x9 rounds should have been fired
Magazine -> 23/31 rounds remaining (on HUD)
Score board -> 8 rounds fired

the guy should have a least 7 holes in him, 9 if I didn't hit the rail below the POI by some work of magic... but 8 rounds on the score board, with 0 hits to a slow tango rofl!!!!!
Now if I didn't have to be awake in ~4 and a half hours, I could get the . / source commands implemented, so handling tpsh_profile / .tpshrc files on startup could be done... and have more of the manual page written out :\. Hmm, that reminds me another big thing I need to work on is the shell special variables ($0...$9..., $*, $@, $#, $?) and the rest of ${parameter expansion} syntax.

If I could get anything done during the day here, and actually sleep at night... instead of coding odd hours, now that would just be heavenly lol.

$ git log | sed 's/my name/\<\;snip\>/g' | sed 's//\<sed@removed.it\>/g' | vim -

commit 4835c4091e59af282ee98952568f0e9ac91c8d09
Author: Terry <snip> <sed@removed.it>
Date: Sat Mar 21 09:27:41 2009 +0000

do_getop() made generic, `set [options]` now works.

The do_getopt() function now takes an array ref and hash to pass onto
Getopt::Long::GetOptionsFromArray, and twists it in place.

set_bin() now calls do_getopt() with it's argument vector and a global
hash; startup code now calls do_getopt() with \@ARGV and that same hash.
Because of that, `set -x`, `set -o xtrace`, and such work but `set +o
xtrace` and such can't be used to turn the option off yet lol. (+o atm
is just an alias for -o.)

commit 90bf68e8b5f0aed867ae4a9fd2eca2c8d99dc1fd
Author: Terry <snip> <sed@removed.it>
Date: Sat Mar 21 08:16:39 2009 +0000

tpsh -o longname now works

further more as an extension, '-o logname1,longname2' also works but is
not documented yet.

commit dcffa41bb57d70c82f502b08ea8c76ebeb559b1c
Author: Terry <snip> <sed@removed.it>
Date: Sat Mar 21 07:49:28 2009 +0000

which built-in command added and documents

see Built-in Commands and CEVEATS & BUGS in tpsh.1.pod for details.

It is really time to make do_getopt() a generic wrapper around
Getopt::Long, the current functionality in do_getopt() needs to be moved
into set_bin() anyway...

Thanks Wiz... lol

After a few other commits, I've finally buckled down and made do_getopt() a simple helper, previously it did parsing for @ARGV via the Getopt::Long module, and twiddle %Options accordingly; now it takes an array ref and a hash to do the job. The wonderful thing? Now both tpsh [options] and the built in `set [options]` command work with half a line of duplicated code :-)

In prepping my code for commit, I wanted to take one last look at do_getopt(), so I went for a quick jump over with the vi/vim :tag command. Wiz IM'd me, so he ended up getting the :ta command instead of vim haha! After alt+tabbing back to the editor, I tried something different just for the heck of it, :ta do_ and guess what!? Vims ex mode completion works on tags as well.... this is so going to spoil me lol. ex/vi lacked command completion, history, and editing; but vim added them. One of these days, I need a refresher on the improved tag commands, my muscle memory is pretty vi compatible until we get into tab completion, :split windows, and multiple tabs lol.

So thanks to Wiz, I've just found a lovely Vi IMproved feature that I never dreamed existed xD

more recent tpsh commits

commit 6f94f751ac76177a23138a1ad014b4af1af50de7
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 18:29:43 2009 +0000

%Aliases renamed %Macros

because it stores all named macros, whether defined with function, macro, or alias

commit 2a83cbc45daf78cb41cba40c28735252e521f965
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 18:24:55 2009 +0000

is_macro() and is_builtin() subroutines added

commit 1853b61eff14d35ddf1f89282ed26a8f3957d373
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 08:43:50 2009 +0000

type built-in documented

documented the type built-in command, and tweaked type_bin; it now
prints macro instead of alias, and will stop at the first match found.

commit 39a9824ca29d7beea6c5a054f970b86968861568
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 08:30:12 2009 +0000

pwd built-in added and documented

commit 488aa51ed2c430848aa80fb26ad093ccec604237
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 08:08:04 2009 +0000

function and macro built-in commands documented

commit 273b7f8bbbf0b3db8759053969e854f1de963003
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 08:02:41 2009 +0000

pipes and I/O redirection can be used inside a named macro definition created with the macro built-in

commit 7aa70dd6873e147f3bfdec7460312dc54482696b
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 07:53:06 2009 +0000

macro_bin now reports `macro name()` as an error, correctly

commit e52aed3dec5455c6488dc4465aa75d20aca4e696
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 07:22:39 2009 +0000

hash built-in documented

commit 843a0de91b3c2df2b1fed8b9416426bc0e7c01af
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 07:21:22 2009 +0000

hash built-in now has an -r option that nukes the %Path hash table

commit 27526bb013cc1ab7b425ee1f3b685585746a0160
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 07:17:36 2009 +0000

hash_bin now displays an error if the item to be deleted does not exist

commit 45c71f7c54faa81106de5e68290884150823e10c
Author: Terry <snip> <sed@removed.it>
Date: Fri Mar 20 07:12:50 2009 +0000

hash_bin can now remove elements from %Path

When the only damn time I can get any sleep... is when I'm ready to pass out, why can't anyone let me sleep? Some days it feels like a game: keep spidey01 awake. *sigh*, and to be waken up early tomorrow.... really, why do I even try to sleep anymore?

Friday, March 20, 2009

Home at last for the rest of the day; got off work early enough for a quick sandwich and some kartoffelchips before taking Willow for her checkup.

13.04 lbs (~5.915kg) and strong as an ox, gained 1lb since last year lol. It's funny though, she's like a little bully at home but as soon as we get within earshot of the vets office.... petrified chihuahua! I'm standing in the examination room with Willow on my one arm, and her and my mom are nervous wrecks; ma asked me how I could be so calm, my reply? It would take something like a zombie invasion to worry me lol.

Pardoning grocery shopping (dang), I'm off until Tuesday; maybe I might actually get some sleep for a change.

Want a dirty look? Try telling a dog she's fat >_<.

Oh for korn sake....

Willow saw the mouse cursor move, and tried to lick the screen! I gave her a hug, "Willow, I love you but you're a silly girl" lol.

May as well hit the hay, before the dog tries anything else with the laptop... lol. Tomorrows gonna be a wreck anyway, need to take the dog to the Victor Echo Tango for a checkup after work, that will be a bark-fest once we arrive, haha!

a few notes from the last time I got to code

now if only I had time to do things tonight... really what I need to get done, is move much of what's left in main_loop() further into a subroutine, so I can implement source_bin() for the . / source built-ins and set it up to handle .tpsh_profile/.tpshrc files on startup through init_sh.

a few other serious things that need doing: hook our completion function into Term::ReadLine::Perl (I'm using Term::ReadLine::Zoid on my workstation; which is very easy to hook up to an app specific completion function); finish coding the completion hooks; implement `tpsh -c "cmds"`, in fact `(cmds)` could probably be expanded to that for sub-shell grouping, lol; write eval_bin(), the code needed for an eval built-in command is there, just needs the sub to bind it together; make `backquotes/backticks` needs to be handled by a pipe opened sub shell, rather then running the command directly with a pipe; and also support for an arbitrary number of pipes in commands, the place holder code in exec_pipe() only allows 'lhs | rhs'; adding ${} expansion to variable expansion, $TMPDIR works but ${TMPDIR:-/tmp} and things don't yet, but that's trivial to code.

Really the only thing that worries me, is how to implement job control :\. Setting up the built-in test command, [ which is gonna be interesting of course but actually doable, like control flow: fun but simple. The job control though, I've no freaking idea how to implement in pure Perl under unix/win32, yet...

# last stream of commits; html fixed
$ git log d59b9f864e916cd914be55b223702ec618c1ec4f..HEAD | sed 's/.../\<snip\>/g' | sed 's/.../sed@removed.it/g' | vim - 

commit 9450eca02b4dffcce6802b8fd72ba4e307ff7b9b
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 10:12:25 2009 +0000

exec and exit commands documented

Also CAVEATS & BUGS section updated about argumentless cd/chdir behaviour.

commit c24135e3748b9dbe8520b5794311af92e3affb36
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 10:06:20 2009 +0000

tpsh now exits with $? >> 8 if no exit status was given to the exit built-in

commit a9138f5991142960114f6898e7d57185eff00256
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:59:59 2009 +0000

cd and chdir commands documented

commit 3145e1a5672330fc913e93b3992b7c6591ff58a8
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:53:58 2009 +0000

CDPATH handling skipped if path starts with / or .

commit e6f8690d05308789a31fb906a28b1dbeba304ec4
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:20:22 2009 +0000

builtin command documented

commit b789721176eeb7d157d7c42e38044b1c111fa3dc
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:16:44 2009 +0000

bugfix: alias expansion turned off for builtin command

noticed that after `alias echo foo`, that `builtin echo ...` would
expand to 'builtin foo ...'

commit a6a7eeddb5309af903569aee31bb5f15ceef9d6e
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 08:46:20 2009 +0000

alias name now displays 'name' => 'definition'

Also alias expansion is now disabled on the alias command as well as
unalias. This prevents expanding the lhs (name) of an alias when name is
given, but definition is not (e.g. `alias name`)

commit 99a57b1b88d58f4ad6b318c181668cf5f5e9eeda
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 08:21:19 2009 +0000

bugfix: rhs of alias definition is no longer sh_eval()'d by alias_bin

alias_bin has ran sh_eval() before storing the macro since commit
2da5a0e38e3d14c29b0fb93ad89797826a41ddac, which was causing expansion of
things like `alias lah='ls -a $HOME' to be stored as 'lah' => 'ls -a
/home/Terry' instead of 'ls -a $HOME'; as the quotes were pre-expanded
on the command line, alias would receive and expand the environment
variable itself.

commit a9177482c3398a6272382672e45ea9d5e8254960
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 08:11:23 2009 +0000

alias built-in documented

commit 8296bb37be75e1e7c301c1ed316db13aa6c9c26d
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 07:34:16 2009 +0000

bugfix: SIGPIPE now handled by exec_pipe()

Previously a construct like `ls | head 1` would cause tpsh to terminate,
due to receiving an unhandled SIGPIPE on unix. tpsh now traps the signal
and will report an error if desired.

Display of the error message can be turned with the 'reportpipe' option,
which defaults to off.

commit b44b8f3b4cf6adedf972bf719f4de1546fc8a8b1
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 23:44:38 2009 +0000

noclobber mode is now implemented

commit 842d3a308e2663c15dc75600c19eb7f096664341
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 23:21:58 2009 +0000

+flag is allowed, i.e. +a

commit 289837932bf4af21c41c538e32e2d886d6f9a03b
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 09:26:30 2009 +0000

added set built in command and command line arguments to the manual

commit e1badaaf1e873ae0808eecb79b1b3a07219752f5
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 08:18:07 2009 +0000

the verbose option now works

xtrace now also prints to stderr, IAW with ash

Thursday, March 19, 2009

How many people tell me to go to sleep...

By country so far... (lmao)

  • USA (to many to count)
  • Great Britain (2-3)
  • Canada (2-3)
  • Germany (2-4)
  • Denmark (1-2)
  • Norway (Just 1, luckily lol)
  • Russia (1)
  • India (1)
  • and possibly (1) in Italy :\

The wonders of the Internet.... lol; what next, people from France and Australia?

Cheap exercise

Between carting crap uo/down stairs, carting crap to and from the car (another set of stairs), and extra crap to do (a third staircase); I've just survived 38 trips up and down stairs, in about 6-12 trip bursts during ~3 hours time lol.

To top it off, when I took Willow for a walk she just had to go for a run instead... Ever seen a grown man dragged by a Chihuahua? LOL.
I really need to give tpsh the ability to use $HISTFILE to save/restore the ReadLine history between sessions...
Grr!!! Even when I can finally sleep, I can't sleep. Fell asleep earlier after dinner, got woken up and then staggered off to bed; now I'm awake again and more tired.

And the dogs got all the covers! *sigh*, there is just no winning in this place lol.

Wednesday, March 18, 2009

And *now* I can pass out.... lol

I was like a zombie at work yesterday, by the time I got home it was a splitting headache and felt like someone had kicked my bodies equilibrium on its side. Like working until burned out, then re-burn the burn out and keep marching :\. Crashed in front of the TV and went to bed early... work wasn't so bad today. What pissed me off is being re-tasked to reconnoiter a new grocery store on the way home -> I freaking hate shopping! I also don't appreciate being made late...

I just got though with a training session, kind of organized chaos I guess but that's thanks to my shitty work schedule. I conducted a deeper level of stealth training then we usually go into, and I used Ghost Recon to do it; JB, Noer, (at end) Ghost, Ambu, Carter, Decapi, Hostile, and Chester. I tried to iron it out how issues of rules of engagement, positioning, observation, reporting, and coordination of movement/fire command could be used to make the most of covert actions. After we did the training scenarios (ambushes, infil, etc), we moved on to a "shoot your instructor" scenario; where they had to sneak up behind me with MP5SD's and go for the CQ kill. The trick was, I was on patrol with an AK and weapons free to shoot at anyone I saw trying to sneak up the hill hehe. I was a little disappointed with how long it took (I scored 2 kills, but 1 was probably a glitch) but overall very impressed with their effort (especially JBs). It was very, very pleasing to see them complete that scenario so well.

What can I say, I borrowed that one from U.S. sniper training and simplified it for our gaming environment lol.

With how long it took between setup and intermissions (note to self: be more strict), we didn't get time for the RvS or S4 portions, considering the big attendance maybe that can do for session 2 next week; whatever. Really I should have just laid down for a nap after work but it was a good 3 or 4 days prep into the session, and one of them days where almost everyone's there at just the right time.

Right now, I ain't moving until the foods on the table - unless I'm snoring on my feet in the process!!!
notes to self:

commit and push changes to ~/.screenrc
continue evaluation of weechat
finish tweaks to .fvwm/config
commit and push changes to ~/init.sh

Tuesday, March 17, 2009

she'll bring a tear to your eye

site | img

Is it just me, or do people try to distract me with instant messengering me random links as I code?

Monday, March 16, 2009

good news: I get to conduct some training sessions soon
bad news: I go back to work Tuesday :-(

Friday, March 13, 2009

A night on burning sands

Nothings up, so I setup GR and ran though a mission: first map of Desert Siege with the Sabre Teams mod active.

Equipped myself with a Diemaco SFW-SD, basically a Canadian M4 with SD, Scope, and M203. Crept through the darkness slow and steady, moving taking it as I would actually do it; instead of running headless chicken. All went well, basically made it into the enemy encampments before I was detected and they hardly knew what hit'em hehe. All the way pro, until I was creeping into a small room and saw an X-Ray unawares behind the door; tried shooting him through the seam of the hinge, but no go. So I backed out FAST, shut the door and moved around to his other flank.... open door, lean out, and plugged a M203 bomblet close to him -> lights out turkey!

Normally I wouldn't do that, but GR utterly sucks and blows for tactical aids.... lol. Scouted out the last encampment, looked good, made ready to drop one of the sentries when my M203 fires... lol. A mistake that wouldn't happen in real life, because you can feel the difference in triggers; but very easy in game when memory and HUD is all you've got to go on instead of memory and tactile senses.

Bugged out and out flanked the enemy counter attack, then moved up like a sniper in the night; nearly lost my head paying more attention to Willow barking like a nut, then moving in on for the kill.

Almost secured the entire map night creeping around, but there was this one bastardo around the building.... searched around before going up, only to realize we must've been playing cat and mouse for the last 8 minutes -> as the 2nd to last X-Ray shot me in the back of the head lol.

when stuck playing alone, night ops and an SD rifle help even the odds lol.

honorable mention

All the leaves are brown and the sky is gray
I went for a walk on a winter`s day
I`d be so safe and warm if I was in L.A.
California dreamin` on such a winter`s day

I stopped into a church (yes I did) and I passed along the way
And I got down on my knees (down on my knees) and I pretend to pray
You know the preacher, he likes it cold
Cause he knows I`m gonna stay (cause he knows I`m gonna stay)
California dreamin` (California dreamin`) on such a winter`s day

All the of leaves are brown and the sky is so gray
I went for a walk on a cool winter`s day, yeah
I`d be so safe and warm if I was in L.A.
California dreamin` (California dreamin`) on such a winter`s day (California dreamin`)
On such a winter`s day (California dreamin`)
On such a winter`s day
California, California dreamin`
California dreamin`

Play that for me

You know it`s just a dream

Dream on

California dreamin`

There must be some kind of way out of here
Said the joker to the thief
Theres too much confusion
I cant get no relief
Businessman they drink my wine
Plow men dig my earth
None will level on the line
Nobody of it is worth
Hey hey

No reason to get excited
The thief he kindly spoke
There are many here among us
Who feel that life is but a joke but uh
But you and I weve been through that
And this is not our fate
So let us not talk falsely now
The hours getting late


All along the watchtower
Princes kept the view
While all the women came and went
Bare-foot servants to, but huh
Outside in the cold distance
A wild cat did growl
Two riders were approachin
And the wind began to howl
All along the watchtower
Hear you sing around the watch
Gotta beware gotta beware I will
Ooh baby

All along the watchtower (Jimi Hendrix)

A few classics

Some folks are born made to wave the flag,
Ooh, they're red, white and blue.
And when the band plays "Hail to the chief",
Ooh, they point the cannon at you, Lord,
It ain't me, it ain't me, I ain't no senator's son, son.
It ain't me, it ain't me; I ain't no fortunate one, no,

Some folks are born silver spoon in hand,
Lord, don't they help themselves, oh.
But when the taxman comes to the door,
Lord, the house looks like a rummage sale, yes,
It ain't me, it ain't me, I ain't no millionaire's son, no.
It ain't me, it ain't me; I ain't no fortunate one, no.

Some folks inherit star spangled eyes,
Ooh, they send you down to war, Lord,
And when you ask them, "How much should we give?"
Ooh, they only answer More! more! more! yoh,
It ain't me, it ain't me, I ain't no military son, son.
It ain't me, it ain't me; I ain't no fortunate one, one.
It ain't me, it ain't me, I ain't no fortunate one, no no no,
It ain't me, it ain't me, I ain't no fortunate son, no no no,

Fortunate Son, Credence Clearwater Revival

Gonna tell Aunt Mary 'bout Uncle John
He says he has the blues but he has a lotta fun
Oh baby
Ye-e-e-eh baby
Woo-o-o-oh baby
Havin' me some fun tonight

Well, long tall Sally has a lot on the balland
Nobody cares if she's long and tall
Oh baby
Ye-e-e-eh baby
Woo-o-o-oh baby
Havin' me some fun tonight

Well, I saw Uncle John with long tall Sally
He saw Aunt mary cummin'
And he ducked back in the alley
Oh baby
Ye-e-e-eh baby
Woo-o-o-oh baby
Havin' me some fun tonight

We're gonna have some fun tonight
Gonna have some fun tonight
We're gonna have some fun tonight
Everything will be alright
We're gonna have some fun
Gonna have some fun tonight
We're gonna have some fun tonight
Gonna have some fun tonight
We're gonna have some fun tonight
Everything will be alright
We're gonna have some fun
Gonna have some fun tonight

Long Tall Sally, Little Richard

Year of the Monkey

Been playing a Vietnam themed Ghost Recon mod that was mentioned on our forums, Year of the Monkey; so far this is an awesome mod lol. Being stuck in the middle of a jungle, well is a terrain type that feels more natural then desert missions ^_^. Moment I got to the intro and heard the mods music taste, I was hooked. YOTM does music and sounds more "in period", some of which are songs that are more my style then oft' found today. GR already has awesome sound effects, and YOTM don't do a bad job there either hehe.

Launched the first map on elite, ordered the sniper to an overwatch position and the next thing I know, I'm laying flat with helmet to the grindstone as bullets are whizzing by our insertion! Ordered all teams to surpress and I put down a bit of frag cover in order to peel alpha & bravo out under sniper fire. Oh man, what a map. Tried circling around the flanks in groups (leaving our sniper as bait lol), only for Bravo to get pinned down; I'm moving, can't see crap, bullet zips over my ear and I dived straight to the ground; Bravo opened fire on their positions. Looking over my shoulder confirmed my ears summery, the poor slept behind me had lost his head; crawling back to safer ground and moving across the stream, so I could regroup on Bravo for a tactical withdrawal (they had just moved out of cover when we took fire). Lo' and behold, 3 bodies moving in the water about 35m to Bravos 4 o'clock.

"I don't give a f*** what that is, let's rock"

and Alpha went weapons free, next thing I know we're picking shrapnel out of our asses from behind lol. Swithced to bravo team, to find 2 men down and one stuck in a tree, being shot at by an enemy 3 metres away..... little M60 fire and problem solved. Maybe the AI isn't totally used to the terrain?

Eventually ended up with just the Sniper left, when I found a small area dug into the earth and covered over with camo -- leading into a tunnel system going all over the map. Now that's what I call attention to detail!!!!! managed to eventually find my way out, only to see the end of tunnel come up practically behind our insertion point! Stuck my head out, and lost it without even seeing a thing.

Loaded it on Multilayer again, sent re spawns to infinite, then kitted out for action. M60 General Purpose Machine Gun plus Frags. That was a crazy map. I went to search around the spawn point, next thing I know there are two X-Rays behind me: little bastards had a small encampment buried into the ground where I couldn't see, came out and shot me lol. In attempts to attack the village position, met with heavy fire and got blown up by grenades several times; ended up using frags and M60 fire just to pepper then enough I could circle around between flanking positions.

A few lives later, managed to creep into the village undetected, passing up a kill - then lit up their world. Main problem was the tunnels and having to frag both sides of a T-Junction; killing the enemy or forcing them to take cover, then trying to engage before getting shot in the back lol. At least though, GR doesn't seem to be capable of simulating booby traps... lol.

Played through several of the missions and it was just awesome; cook a few goons (I love setting ambushes), check your six, then move out, and next thing you know Charlie's fried your ass.

One thing I love about Ghost Recon, is it has that feel to it, that feel that behind any rock or tree could be lurking a nasty surprise. That's something that is sorely missing from war games set in urban environments, where you generally know where threats can come from, where they probably will be, and good cover is scarce.

tpsh, recent commit

 commit 6eda7f33de6bb7505fc64986a5bd31211d68acc5
 Author: Terry ... ... <...@,,,>
 Date:   Fri Mar 13 05:36:45 2009 +0000
     initial implementation of the function and macro built-ins
     'function name() definition' creates an alias named 'name' with evaluation
     'macro name( definition )' creates an alias named 'name' with evaluation
     Eventually macro will probably define the alias wrapped in a (grouping),
     once (command groupings) are implemented. function will allow {
     groupings } when that is also implemented; but will not make the
     Currently variables and quotes are pre-expanded by the line processing
     code, before function/macro receive the text to store in a macro. While
     this is the desired behavour for the alias built in, it is not desired
     for other methods of defining a command macro! It is however possible to
     escape variables and things, e.g.$ macro e( echo hi '$USER' ); so that
     the expansion occurs when 'e' is executed, as opposed to when 'e' is
     recorded. This will hopefully be fixed in the future.
     The manual page is in continual development, and will reflect the
     desired "end state" for macro behavour.

Basically tpsh has no real concept of an alias or function per say; only a simple macro recording facility.

  # bourne style alias
  alias x=y
  # csh style alias
  alias x y

  # bourne again style named function
  function x() y

  # tpsh specific syntax
  macro x( y )

  # each make x expand to y (with appropriate context grouping to be added later)

Generally where things differ enough between sh and csh, to warrant a check of the fine manual, like alias and the export/setenv thing; tpsh endeavors to be more permissive about muscle memory.

Internally there is no real difference between an alias and a function, it's just a macro with a name. sh doesn't use the function keyword, but bash does (which zsh also permits, hehe). It's much less bugger to implement functions with the keyword then not at the moment, and it's really the macro keyword I'm interested in. The macro built in is meant for simple commands, where as the bash function syntax is meant for compatibility and to make using a complex command as the definition readable. The sub shell and same shell command grouping syntax used in sh, of ( commands ) and { commands } I am expecting will be treated like an anonymous macro.

Eventually I'll probably alter sh_eval() to "relax" its evaluations of a function definition so that environment variables and quotes (etc) are expanded when used, instead of stored. Atm the only "don't screw with this" case in sh_eval, is not performing alias expansion when one executes the unalias built-in, since you can't specify the macro to delete if it gets expanded first ^_^.

Personally, I like 'macro foo( bar )' more then 'alias foo=bar' or 'alias foo bar', feels more natural. tpsh after all is meant to reflect MY preferences rather then being purely sh compatible, lol. Even though there is little difference in tpsh (yet) between 'alias la=ls -a' and "alias la="ls -a"', the implicit grouping inside the () is just more to taste:

$ macro la( ls -a )
$ macro ll( la -l )
$ alias
'la' => 'ls -a'
'll' => 'ls -a -l'

most Bourne inspired shells that support alias display them as `la='ls -a'", but the alias command is fairly new in sh, and I prefer 'la' => 'ls -a', thus that is what tpsh uses.

Microsoft saying Open Source is a source of innovation?


I just wish Microsoft was more innovative! lol.

Thursday, March 12, 2009

Hmm, what pipe was I smoking when I thought it would be possible to get a measure of consistency between 3 different readline implementations?

Wednesday, March 11, 2009

Was playing a bit of Ghost Recons PlayStation 2 editiion, after so many years of CQ in [SAS], I really hate the AI more then I used to lol. One nice thing though, despite that it seems micro-management (barf!) or leaving by the wayside the Squad AI isn't much use tactically beyond (very) simple fire and maneuver. One nice thing though, was scouting 20~40m ahead of the assault group when I spotted a sentry in a ditch; amazingly he didn't notice me laying some 25 meters to his side, even with a tweedle dee and tweedle dumb giving away my snipers position 8=)

swapped fire teams and moved Alpha up, plugged a M203 into the ditch and then switched back to the sniper on Bravo to pick off anything fleeing from Alphas SAW.

Now if only the dipsticks didn't cross my line of fire so often, lol. In terms of friendly AI, for what they are capable of GR has good squad AI, but sadly still needs baby sitting for anything beyond rules of engagement. I have no exposure to the AI community, but most video games have the "Artificial" part right, they just lack "Intelligence" to go with it.

Tuesday, March 10, 2009

A little DooM II: HR

Spawned in the middle of a field like area, heard of imps at the 12, and a wolf pack of Mancubus to the 9. Crazy critters flying about with big guns and arachno-things snipin', pure madness. Took a couple of lives just to get into the "grove" of evading the shots lol. I forget what difficulty I have the game set to, but just looking at the things section in the wiki, goes to show the mixture of nasties on the map. So many baddies crawling around it was a dance between hit-and-run super shotgun, paint the plasma gun blue, and rocket frenzy lol, The hard part was the rocket launching critter around the one key.

By the time I got to MAP15: Gates to Hell (Hell Revealed), and managed to fight it down to just the imps on the wall... it got almost a chore to clear out survivors lol. DooM makes a great way to relax some brain cells though -> don't care what the fuck that huge mother ****ing thing is called, but it's getting a quartet of rockets shoved up it's ass kind of moments lol.

What Do People Envy About You?

People Envy Your Compassion
You have a kind heart and an unusual empathy for all living creatures. You tend to absorb others' happiness and pain.
People envy your compassion, and more importantly, the connections it helps you build. And compassionate as you are, you feel for them.

Monday, March 9, 2009

Terry's Portable SHell

Hmm, my recent pet project (tpsh) is actually shaping up quite nicely. It is almost to what I would consider a usable interactive state, the only big irk left I guess is the pipe handling and a few odds and ends. Development started like last month (first commit in my master branch is dated 2009-02-28), and has been a very on/off thing in my spare time; a lot remains to be done, but progress is quite nice.

I rather like the korn shells, but I find it annoying to see what implementation of korn from who behaves in what way. OpenBSDs customized pdksh being the best of the lot in my opinion, the only problem with the korn *family* being consistency in the wild... cmd.exe just barely counts as a command shell, better for scripting then for interactive use. I can't help but think, cmd.exe's filename completion was either written by a 5th grader or a hold over from command.com (I haven't used command.com in years). Currently I use zsh most of the day on FreeBSD, ksh on OpenBSD, and cmd.exe on Windows XP. So it is really important to me to have a single and SANE shell.

I used to use tcsh a lot, but after getting into Bourne-style shell scripting (Nota bene: I know nothing about csh scripting) I got pissed and sought out a shell that would allow me to test sh snippets at the prompt. To be honest, I do not have any issues with the GNU Bourne Again SHell (bash); some distros default init files aside. Yet just like tcsh/zsh -- I have no big desire to cart bash around with me everywhere (and I do not like cygwin).

The solution? Create a shell that behaves more or less consistently across platforms, does what I want, and is not a pain in the ass to port along for the ride.

Line editing is completely delegated to Term::ReadLine. Someday writing something like readline or curses on an alien OS for terminal XYZ would be one thing, having to implement shell line editing and be portable between the UNIX and Windows NT environments: I wouldn't do it if you paid me. (and even if drunk, I would still likely use normal libraries!)

On the interactive level, line editing for me is an absolute must. Command completion I can live without for awhile. Unix names are usually short and I like fairly terse and structured ones myself, winsucks is a bit of a different story. The child like way cmd.exe does command completion, it's almost better to do without completion on windows haha!

Right now basic expansions work, ${VAR} and $VAR, line editing and history is via Term::ReadLine (I've been using Term::ReadLine:: Zoid and Perl implementations). There's only rudimentary handling of quoting for the time being, something that needs labouring with in order to handle nested quotes (e.g. echo "`ls 'C:/Program Files'`") but currently does the job well enough for right now. The 'single' and "double" quotes mostly work as expected, The `backticks` work as expected in simple cases, but since there is no proper support for shell script or -c "command" yet, things like `find /some/where -name foo -print` will work as expected, but `find /some/where -name foo -print | xargs whatever` will not work. Once things are more evolved on the scripting side, it should be trivial to implement backticks correctly (nested quotes aside). The idea being to pass the backticks onto a child shell. Right now the only big catch 22 with quotes is only one set can be used and they do not nest yet; fixing that will be fun.

I/O Redirection and pipes also work for starters, but not completely. The >, >>, and < operators do work, but don't accept an optional file descriptor number yet (e.g. foobitz 2>/dev/null) or other tricks of the trade. Basically just the I/O redirection I use a lot is implemented for right now; since the focus is on interactive use by yours truly, it will probably stay that way for a while. Command1 | command2 also works well enough right now, but I've yet to implement pipe lines properly (e.g. cat f1 f2 f3 | sort | uniq | less; doesn't work yet); just wasn't enough time to shift from prototype to finish without sleep lol. Only one use of pipes currently is supported, until I have the time for coding unlimited segments in a pipe line.

Aliases even work ok at the moment, but no (damn!) addictive runtime parameter expansions have been added yet (e.g. alias qux="xuq -f $1 -x $2"). That will have to be done someday, hehe. In point of fact, $*, $@, and the things related to positional parameters are not even implemented yet.

One benefit of my development environment, is I can use I/O redirection to run a simple test suite. I created a 'test-sh' script that strips the environment of all but the interesting stuffs before invoking tpsh. Then I have a test file with commands written out.

 $ ./test-sh < file
and I can watch the results of the test file fly across my screen, as if typed interactively (I freaking love unix shells). It is not quite a unit test, but it is enough to be able to run the test file and monitor the results for unexpected regressions or fuck ups, before pushing the code to vectra. Currently shell globbing is limited to Perls glob(), probably to be implemented directly with File::Glob::bsd_glob() in the future, and someway of letting an environment variable specify the desired GLOB_* flags. (perl 5.8s glob() seems to do what I want). I have yet to decide how to handle tab completion across the Gnu, Perl, and Zoid ReadLine modules but coding the completion functionality itself should be fairly easy; the issue is just how to plug it in properly. Exactly what the globbing behaviour will be like, I dunno yet: because to be honest I have never noticed any big difference between (t)csh, perl, and zsh when it comes to using globs (but I also admit that I rarely do more then abuse * and {x,y,z} on a daily basis). If at all possible, I would like to use File::Glob rather then roll my own (and modern perl glob() does use File::Glob in the background afaik). I believe that as soon as a full pipe line implementation is done, I'll be ready to start coding it from a tpsh session lol. Goal wise, where am I trying to go? It is implemented in Perl, because perl is fun, perl is less pain to port then C/C++, and I'm not going to use Java or C# period lol (my zsh setup starts up slow enough as is). Python, Ruby, or PHP would also have been good choices, except I'm trying to avoid rubber banding between languages. (Also note: I _hate_ writing C code on Win32.) It should generally behave like a traditional Bourne shell most of the time, but not be a true sh knock off. Whenever in doubt, mimic ash / sh behaviour. It's not meant to be POSIX compliant, anymore then it is meant to be a real sh: based on, not clone of. It is supposed to behave as close to identical under unix and winnt as possible, with "pains of installing" meant to be a working ReadLine module. A good example is perl -e 'code' should work on Windows without having to adapt cmd.exe quoting rules. (really I think cmd.exe has shitty documentation for such an essential program). One reason I like languages like Perl and Python, they mostly behave the same on whatever OS, with a minimal of pain involved (especially Python) It should be easy to use, providing all the expected features -- without massive bloat. It behaves like _I_ expect, not what someone else expects (good example: unix style shell, not dos style shell) It is not an interface to Perl. There's at least 2 different perl shells out there that I know of, but I do not want a shell script that behaves like perl or even does configuration in perl; I want a shell written in perl that behaves like a regular shell lol. It's also an easy project to take my mind else other matters in life right now... tpsh's builtin eval command will work more or less like sh, not CORE::eval !!! Maybe I will implement a peval or pleval builtin that works like shells eval, but instead executes it as perl code rather then shell commands. (basically type `peval perl` code instead of `perl -e 'perl code'`). Accessing perl code through tpsh just is not a priority, when I want to talk to a perl interpretor, I'll invoke one. Eventually I want it to be able to execute shell script in some form, the goal of which (obviously) will be handling my shells initialization files (~/.${USER}_shrc and ~/.site_shrc) without going belly up. To pull that off, a Bourne-style shell, a which program or built in, and support for functions / aliases is required. (My init files handle sh, bash, zsh, and several flavours of korn; plus several OSes from one main file + a site local settings file). My init file is rather elaborate in design compared to most others I've seen, yet very conservative in what it demands of the shell: the most advanced sh features required being function support lol. Basic idea of feature/priorities for tpsh:
 a usable shell for daily use (basically done)
 tab completion (filenames, then command; then pluggable, then 'smart' completion)
 code the remaining builtins and allow a coloured prompt ;-) (etc)
 expand the expression syntax into a more usable (read normal) form
 do shell functions
 handle job control (basic (i.e. bg, fg, &), then rest)
 allow shell scripting in a conventional way, rather then tpsh < cmdfile
 grow the control flow and things for shell script (if, while, for, ...)
 take POSIX into closer consideration for the minor details

the only part that worries me, is implementing the [ builtin lol. (mm, maybe feed [ stuff ] into a syntax tree that we can build a corresponding perl statement to eval())

Sunday, March 8, 2009

Saturday, March 7, 2009

Using git for all my scm/vcs needs, I'm starting to wonder how the hell I ever lived with CVS lol. (The documentation for git isn't to bad these days either)

Friday, March 6, 2009

Writer's Block: Deal or No Deal

What's on your list of dealbreakers when it comes to romantic relationships?
Live Journals Writer's Block

  • If she's a bitch, just plain cruel, or has no feeling for other people (Gee, sounds familiar), then I'm more likely to regard her with contempt more then anything else, just like everyone else with that kind of attitude towards others.
  • If she is a Bimbo, or worse a first class / major bimbo... that is an end to almost all romantic interest on my part lol. Bimbo = common name for the type of girl that usually gives me a _H_E_A_D_A_C_H_E_ in the long run. I don't mean the woman has to be a rocket scientist or something like that, but some common level of intelligence and attention span is a must!
  • If she (or I) is only interested in sex or that's the primary goal in/nature of the relationship. For me, things have to go much deeper then that to be lasting, let along develop a romantic tone. I'm a guy, so such things obviously cross my mind eventually, but still I would take the effort for her mind, body, and soul: not solely for the sake of a home run.
  • If she's currently involved with someone or married, then that's a no go: automatic mental disconnect (my brain generally raises the off limits sign).
  • If she can't love me for who and what I am, deals off.


A hopeless romantic is not the same as a hopeless flirter. A hopeless romantic dreams of who they will spend the rest of their life with and what the two of them will do together. They want to be romanced with sweet simple things and the thoughtful amazing surprises. They dream of being loved but also loving somebody. They don't just want somebody to hold them. they also want to hold someone. They realize that love isn't just about one person but both people. they are hopelessly in love with being loved AND loving back.

Wednesday, March 4, 2009

Writer's Block: More Island Time

You're packing your bag for that other desert island—the one with no electricity—what 5 books do you take with you?
Live Journals Writer's Block

If trillogies count as 3 books:

0. My copy of the Bible (it's an NIV)
1. The Thrawn Trilogy: Dark Force Rising
2. The Thrawn Trilogy: Heir to the Empire
3. The Thrawn Trilogy: The Last Command
4. Lord of the Rings (it is one insanely huge book!) or Dune.

If trillogies count as 1 book:

0. My copy of the Bible (it's an NIV)
1. The Thrawn Trilogy
2. Dune
3. Lord of the Rings
4. My old U.S. Army survival field manual

Wouldn't be much of a list without a copy of the Bible on it, now would it? When I started in Fusion (one of two youth groups at the church), my pastor was polite enough to equip me with a copy free of charge. Haha, I still remember the first time I read it... friends had to teach me the whole chapter _and_ verse notation (yeah, that was an awkard moment lol). One day everyone in the group was asked to read a passage picked at random, I ended up in the book of Acts. Later on my D-Group had a week long pledge to read the bible every night, being me I of course had to inhale all of Genesis. I rarely get to read the bible these days, but it's still a book I would take. The perfect chance to the entire thing cover to cover.

Timothy Zahns first tale about the imperial grand admerial Thrawn is one of my favorites, including the first appearance of my all time favorite Star Wars charactor: Mara Jade. I remember the first time I read it, I couldn't help but wonder where Luke and Mara might end up in the future. The Hand of Thrawn duology solved that question lol (the skywalker curse aside, which she seems to be the only women to ever survive reasonably well). For some good reason, all the best Star Wars novels seem to come in trilogies and average at least 950pg or better xD. I've always loved Star Wars, especially the expanded universe. Largely gave up reading them after Vector Prime though, but If I had the cash; from things that I've heard more recently, I think I would pick up where I left off from and catch up with the years. Out of all the SW books I've read, the original Thrawn stories are my top fav, hence a must on the list :-)

Dune, a movie I loved and a novel I really loved once I got to read it. Dune is just my kind of story, big, long, so much depth and imersion - like an RPG taken to an extreme. I also love Sci-Fi and stories that give one room to think a bit. Anyone who likes science fiction or fantasy must read Dune eventuall!!!!

I'm not a huge LoTR fan, but the Lord of the Rings is a very big, long, and in depth book - just right up my ally (like Dune). That reminds me, one of these days I need to puchase the remaining volumes and inhale them haha. J.R.R. Tolkien and Frank Herbert seem to have a great nack for creating their own little (eh, big) world, and finding a way to suck you into it.... you'll either have to learn all the history of it, or be bored out of your mind before the end of the book (in which case, you probably wouldn't like such books anyway)

Some years ago, well many now I guess lol. My brother picked up a few old field manuals from a military antique and surplus store. I have the manual to an M1 .30-06 rifle (the Grand), fm on booby trapping (where most of my minor-knowledge of explosives comes from), and Survival; which covers survival issues on land and sea, both tropical/desert and arctic environments (even for the avator that has fallen from the sky). After ~40 years, I'm sure it is woefully out of date or been replaced at least once or twice by the army, but hey... I wouldn't dare plan a camping trip without it, let along being stuck on a desert island!

I love to read, although honestly these days any reading time I actually get to myself... usually ends up on something techy. There is just nothing like a good book.... born a couch potato, but books are better then watching the TV. Unlike television, where they have to pick and choose what to show you, a book lets you choose what you see. To explore that authors vision, and gaze upon it with your own eyes; dive into an eventure or visit a strange new world that only exists there in. Plus there is a lot more content then TV can offer lol.

And yes, Star Wars dominates my book shelfs better segments xD.

Writer's Block: Desert Island Time

You're packing your bag for that magical desert island that happens to have electricity, a TV, and a DVD player—what five DVDs do you take with you?
Live Journals Writer's Block

0. Terminator 2: Judgement Day
1. Spaceballs
2. ALIENS (think space marines and xenomorphs)
3. El Dorado (my favorite western)
4. A classic, maybe Now Voyager or something like Arsenic & Old Lace

Spaceballs though, would have to be on the list! Heh, I think I've seen that move so many times over the years that I could probably be the dork on set with the script, should they ever have to re-film it ^_^

Monday, March 2, 2009

Yet Another Way To Hang Your Web Browser

Try copy/pasting ~4.5MB of data into a text area, then watch your CPU catch fire and the laptop overheat. If you have a decent browser or a cooling system, you might get as far as the form submission timing out ^_^,

Honestly, I could swear there is almost no complex software on this damn planet that does not f***ing suck!

Complex software that doesn't suck: FreeBSD, OpenBSD, nvi, vim, GNU Screen, rxvt-unicode, GNU grep, nawk, ed, the better forms of emacs, gcc/g++, perl, fvwm2, but what else..... lol. There is more software that sucks then that doesn't.

Sunday, March 1, 2009

learning to use warnings, the hardway

Trying to write to file names instead of file handles by way of typographical error, yes I am a super schmuck! Trying to figure out for at least 5 minutes why the parant isn't getting any output from the child process, and sure enough.... Don't print $filename when you mean print $filehandle, haha! (or better yet, don't use ($lhs, $rhs) and ($lfd, $rfd) for the file names and handles when tired)

Tried running my scratch-file under use warnings, and sure enough the expected warnings poped up. This is what I get for not enabling warnings when writing a function in a separate file for testing crap. Hmm, what was it she said to me years back? Something like "We need to pump some caffeine into you", maybe it's not a bad idea lool.

Rule #1 of Perl, use warnings or die $!
Rule #2 of Perl, use strict or warn $!
Rule #3 of Perl, goto Rule #0

(use what or ... is not actually perl syntax, let a long setting $!, and is infact a compiler error that would have to be trapped in an eval, but hey at this time of morning it works well enough in ascii :-P)

Does Darth Vader drink?


Writer's Block: Taking It Personally

Have you ever taken a personality test like the Myers-Briggs or Enneagram? If so, did you agree with the results? And what was your type?
Live Journals Writer's Block

Once took something based on the Myers-Briggs style, can't remember the type though. The result was fairly accurate, the only problem was it was also classified as being among like 2% of the population with that type lol.

I've always valued my uniqueness, hehe.

Writer's Block: Priorities

What quality do you think is most important in a significant other?
Live Journals Writer's Block

The size of her heart.

RvS action today

Todays RvS live op was a success, and I should be able to start work on the maps for the S4 op during the week. Spent most of the day between practicing in TG#1, did the LO, then we set it to Adversarial mode for some force on force drilling.

Rule #1, always get Nick first, haha!

I don't care a great deal for survival / team survival mode, and I'm not terribly skilled at bomb mode; but I do love pilot mode and a full set of elements. Why, is because it makes you think rather then just kill stuff. Private Airport and Import-Export were especialyl fun maps. Nice to see though that the young troopers paid some attention to their training after all. Heh, that reminds me of a funny. We were on Team Survvial mode, off the banking house. I came 'round looking for some tangos, when I see someone laying prone with an AR in front of a n openning. Since we're all on the same TS, I call out, "Hey whoevers laying prone ...here... look behind you!". The funny part, Hunter eventually got twitchy enough to do it, maybe felt me staring at him lol. So he stand sup toa crouch and turns around....... I squeeze off a solvo of Mac 9/11+SD into his helmet, but die leaving him gimped after Hunter opened up with his AR.

That's when I learned, shoot them in the leg before they turn around, or just shoot them in the head 6-12 times instead of 4 xD

I also got to enjoy peaks, sniper fest and I was in the thick of it with my Walther WA-2000 magnum going head hunting. The sniper rifle is not something I use often in RvS, because I ___h_a_t_e___ having to fire 2ce to kill 1 tango at close range with a gun, designed to have a lethal knock down punch from hundreds of metres away! In the fighting on Peaks, I used 3 rounds per kill just to be sure lol. I always open fire and keep shooting the targets until they go down... and sometimes tempted to put two in the head before moving on, just to make sure we don't get a frag rolling out after the fact.

Me and TF also went on a rampage in the Penthouse, 3vs2 and won hehe. Penthouse was always my favorite adversial map. Before I got into [SAS] stuff seriously, I spent over a year in adversarial play learning the trade. When I went back to Co-Op style, I embraced a more slow and methodical approuch until reaching the [SAS] Selection Course. These days, I know when to be slow, when the be fast, and when to shake, rattle, and roll.
Man I just had the strangest dream, dreamt that our webhost was trying to sell all our files on the black market, disguised as a fat woman. And then me and Wiz went down to collect the disks. What a ludicrous dream lol, like that scene from Good Fellas meets Big Mommas House :\