Pat Gunn (dachte) wrote,
Pat Gunn
dachte

All programs...

evolve to the point where they can read mail.mp3deep is on its way. I'm also thinking about makingsome utilities to clean some of the brain-damage presentin redhat8.. or have I talked about that already? I don'tremember. Finally, I'm playing with writing a simulator toplay with some concepts in game theory. I don't really knowas much about game theory as people who have studied itseriously, but in some ways that might actually make it morefun. Kind of strange how that works...

I've also been thinking about picking up some long-neglectedprogramming projects that I lost interest in some time ago.No, not MoLD (for now), but once I was working on a program thatwould attempt to generate ocean sounds and rain. Speaking of which,I once wrote a toy script that, with proper cron entries, would chimelike a grandfather clock, and I spent about an hour on the net justlistening to hundreds (thousands?) of chimes until I found just theright one. I should probably dig that sound out (I hope I didn't lose it).

For those of you who like philosophy, this entry is pretty geeky, I guess.For those of you who like geeky stuff, this is probably a welcome breakfrom the usual faire. If you're just interested in what I'm up to, *shrug*

  1. !/usr/bin/perl -w

  2. Recursively, randomly play mp3s under current dir with mpg123

@default_options = ('-z');$mutex_options{'-Z'} = '-z'; # What kind of random$mutex_options{'-0'} = '-1'; # Channel selector$mutex_options{'-2'} = '-4'; # Downsampling options@options_disallow = ('-w','-@','-u','-p','-h','-d','-o','-a','-g','-r','-f','-n','-k','-b'); # These all take arguments after them, and make it harder to
# do magic spiffy mutex checking.
cleanup_predef();

main(@ARGV);

sub main{ # eventually accept arguments for mpg123, for now, ignore argsmy @program_args = @_;my @args = figure_args(@program_args);print "Figured args

[Error: Irreparable invalid markup ('<a [...] join(',>') in entry. Owner must fix manually. Raw contents below.]

<p>evolve to the point where they can read mail.mp3deep is on its way. I'm also thinking about makingsome utilities to clean some of the brain-damage presentin redhat8.. or have I talked about that already? I don'tremember. Finally, I'm playing with writing a simulator toplay with some concepts in game theory. I don't really knowas much about game theory as people who have studied itseriously, but in some ways that might actually make it morefun. Kind of strange how that works...</p><p>I've also been thinking about picking up some long-neglectedprogramming projects that I lost interest in some time ago.No, not MoLD (for now), but once I was working on a program thatwould attempt to generate ocean sounds and rain. Speaking of which,I once wrote a toy script that, with proper cron entries, would chimelike a grandfather clock, and I spent about an hour on the net justlistening to hundreds (thousands?) of chimes until I found just theright one. I should probably dig that sound out (I hope I didn't lose it).</p><p>For those of you who like philosophy, this entry is pretty geeky, I guess.For those of you who like geeky stuff, this is probably a welcome breakfrom the usual faire. If you're just interested in what I'm up to, *shrug*</p><ol><li>!/usr/bin/perl -w</li>
Recursively, randomly play mp3s under current dir with mpg123
</ol><p>@default_options = ('-z');$mutex_options{'-Z'} = '-z'; # What kind of random$mutex_options{'-0'} = '-1'; # Channel selector$mutex_options{'-2'} = '-4'; # Downsampling options@options_disallow = ('-w','-@','-u','-p','-h','-d','-o','-a','-g','-r','-f','-n','-k','-b'); # These all take arguments after them, and make it harder to
# do magic spiffy mutex checking.
cleanup_predef();</p><p>main(@ARGV);</p><p>sub main{ # eventually accept arguments for mpg123, for now, ignore argsmy @program_args = @_;my @args = figure_args(@program_args);print "Figured args <a href="" . join(', ',@args) . "">LINK</a>\n";my @mp3_list = recurse_get_mp3list(".");do_mpg123(\@args, @mp3_list);}</p><p>sub recurse_get_mp3list{my $cwd = shift;opendir(THISDIR, $cwd);my @mp3files;my @direntries = map {$cwd . '/' . $_;} grep !/^\./, readdir(THISDIR);closedir(THISDIR);foreach my $entry (@direntries)
{
if( -d $entry)
{
push(@mp3files, recurse_get_mp3list($entry));
next;
}
if( ( -f $entry) &amp;&amp; ($entry =~ /\.mp<a href="32">LINK</a>$/i))
{
push(@mp3files, $entry);
next;
}
}
return @mp3files;}</p><p>sub do_mpg123{my $argsref = shift;my @mp3s = @_;exec 'mpg123', @$argsref, @mp3s;}</p><p>sub figure_args{ # Coalesce @argv and @default_options into a coherent
# set of args, using %mutex_args
my @argv = @_;my %h_returner;</p><p>foreach $arg (@argv, @default_options)
{
if($disallow{$arg})
{die "Disallowed argument <a href="$arg">LINK</a> found\n";}
if(! (($mutex_options{$arg}) &amp;&amp; ($h_returner{$mutex_options{$arg}})))
{$h_returner{$arg} = 1;}
}
return (keys %h_returner);}</p><p>sub cleanup_predef{ # It'd suck to need to specify mutually exclusive flags both waysmap{$mutex_options{$mutex_options{$_}} = $_;} keys %mutex_options;map{$disallow{$_}=1;} @options_disallow;}
Tags: programming
Subscribe

  • Still alive

    Been feeling a bit nostalgic. Not about to return to LiveJournal - their new ownership is unfortunate, but I wanted to briefly note what's been up…

  • Unplugging LJ

    It's about time I pulled the plug on the LJ version of my blog: 1) I'm much more active on G+ than I am with general blogging. I post many times a…

  • Mutual Trust

    I don't know which should be considered more remarkable: That a cat should trust a member of a far larger and stronger species that it can't…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments