Re: [SLUG] Lucent winmodem question

2007-12-18 Thread Jobst Schmalenbach

Would you be better of to scan ebay for an old EXTERNAL modem, plug that into 
the RS232 port of you computer and run 64Bit debian?

jobst



On Wed, Dec 19, 2007 at 03:51:45PM +1100, Heracles ([EMAIL PROTECTED]) wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> I have a driver for the Lucent winmodem which is available as a deb for
> i386, but I can't find one to run on 64bit debian. Is one available or
> am I better off installing the 32bit Debian on my daughter's AMD X2
> system and running the one I have?
>  Thanks
> Heracles
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFHaKNfybPcBAs9CE8RAokzAJ0Q0SX4LCkm8CRE4TJReSECbzdvrACgkXSw
> 7jfhs0m+eTLQwbC9qBTAP+k=
> =S40+
> -END PGP SIGNATURE-
> -- 
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

-- 
'I will go to Korea.' - Dwight D Eisenhower.

  | |0| |   Jobst Schmalenbach, [EMAIL PROTECTED], General Manager
  | | |0|   Barrett Consulting Group P/L & The Meditation Room P/L
  |0|0|0|   +61 3 9532 7677, POBox 277, Caulfield South, 3162, Australia
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Xorg Configurators

2007-12-18 Thread David P
I've personally never had a problem with SaX2 (X config tool in yast2)
and it's dual-head/Xinerama options, though it doesn't have a
web-based interface. I'd think success with multi-head on any distro
depends a lot on the graphics card (my geforce 6200 with proprietary
nvidia drivers works great). I'm sure that the graphical X config
tools in fedora and such would work great as well.

David


On 12/19/07, Dean Hamstead <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> In spite of being a staunch fan of configuring X with vi, i am looking
> for a graphical configuration tool for Xorg. Especially one with good
> multi-head support. So i am wondering if anyone has any thoughts.
>
> Generally i am a debian man, but am willing to go with suse, fedora etc.
> Not sure if yast2 has web based config, i know it has ncurses and x11.
> But im not sure how good its multi-head configuration goes.
>
> Web based would even be nice.
>
> Even perl modules to simplify making my own interface would be helpfull.
>
> Nvidia-xconfig is may also make my life easier and i am aware of it.
>
> Dean
> --
> http://fragfest.com.au
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Lucent winmodem question

2007-12-18 Thread Heracles
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I have a driver for the Lucent winmodem which is available as a deb for
i386, but I can't find one to run on 64bit debian. Is one available or
am I better off installing the 32bit Debian on my daughter's AMD X2
system and running the one I have?
 Thanks
Heracles
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHaKNfybPcBAs9CE8RAokzAJ0Q0SX4LCkm8CRE4TJReSECbzdvrACgkXSw
7jfhs0m+eTLQwbC9qBTAP+k=
=S40+
-END PGP SIGNATURE-
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Ian Wienand
On Wed, Dec 19, 2007 at 02:51:34PM +1100, Matthew Hannigan wrote:
> Here's one in lex; ripped off from the flex info page.
> I'd be interested in its performance compared to straight C.
> No doubt worse, just curious how much worse.

Similar to the Python version

[EMAIL PROTECTED]:/tmp$ /usr/bin/time ./count < ./randomcommas 
# of commas = 1287100
2.57user 0.02system 0:02.60elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+138minor)pagefaults 0swaps

I'm not even going to guess at what that version is actually doing!  A
quick look says this one is CPU bound, compared to Python which is
memory bound.

Lex
% Cycles lost due to GR/load dependency stalls (lower is better): 0.31

Python
% Cycles lost due to GR/load dependency stalls (lower is better): 46.25

The Python spends a lot of time sitting around waiting for data to
come from the cache/memory (load dependency stalls).  The Lex version
doesn't so the extra time can be attributed to CPU work.

-i
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Matthew Hannigan
On Wed, Dec 19, 2007 at 02:50:55PM +1100, Ian Wienand wrote:
> [ C version ]

Here's one in lex; ripped off from the flex info page.
I'd be interested in its performance compared to straight C.
No doubt worse, just curious how much worse.


$ cat count.l

cat count.l
int num_commas = 0;

%%
, ++num_commas;
.|\n   {}

%%
main()
{
yylex();
printf( "# of commas = %d\n",
num_commas );
return 0;
}

$ lex -t count.l > count.c
$ cc count.c -lfl -o count
$ echo dsfsdf | ./count
# of commas = 4





-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Ian Wienand
On Wed, Dec 19, 2007 at 12:34:02AM +1100, Rick Welykochy wrote:
> >No sir! But shell usually wins.
> 
> On my 1 GHz / 1 GB powerbook, the python one-liner
> I just submitted runs 5 x faster than the original.

I think C usually wins, the version below is 25 times faster than the
python version (from disk cache).

[EMAIL PROTECTED]:~$ ls -lh /tmp/randomcommas 
-rw-r--r-- 1 ianw ianw 65M 2007-12-19 14:30 /tmp/randomcommas

[EMAIL PROTECTED]:~$ /usr/bin/time ./comma < /tmp/randomcommas
commas: 1287100
0.07user 0.04system 0:00.11elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+126minor)pagefaults 0swaps

[EMAIL PROTECTED]:~$ /usr/bin/time python -Sc "import sys; print 
sum(l.count(',') for l in sys.stdin)" < /tmp/randomcommas 
1287100
2.68user 0.13system 0:02.84elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+8659minor)pagefaults 0swaps

I'd guess the Python version is spending that time doing some extra
copying because it causes a lot of page faults is really cache
unfriendly.

Python
Instructions retired per L1 data cache access: 11.03
Instructions retired per L2 data cache access: 24.16

C
Instructions retired per L1 data cache access: 6.01
Instructions retired per L2 data cache access: 366.92

-i

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define CHUNK 16384 

char buf[CHUNK];

int main(int argc, char *argv[])
{
unsigned long count = 0;
ssize_t len;
int fd = 0;

if (argc != 1)
fd = open(argv[1], O_RDONLY);
if (fd == -1) {
printf("blah: %s\n", strerror(errno));
exit(-1);
}

while ( (len = read(fd, buf, CHUNK)) != 0 )
{
int i;
for (i=0; i < len; i++)
if (buf[i] == ',') count++;
}

printf("commas: %lu\n", count);
return 0;
}
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Matthew Hannigan
On Wed, Dec 19, 2007 at 12:34:02AM +1100, Rick Welykochy wrote:
> Jeff Waugh wrote:
>
>>> Does it have to be in shell? :-)
>>
>> No sir! But shell usually wins.
>
> On my 1 GHz / 1 GB powerbook, the python one-liner
> I just submitted runs 5 x faster than the original.
>
> But what does 'shell' really mean? python,perl, etc.
> are external to the shell as surely as sed,tr,wc.

Here's a pure shell version (without the overrated
quality of being correct).  It works by using comma
as a field separator then counting the number of
fields.  Main problem: trailing fields non-empty lines still count, but empty 
lines don't!


IFS=,
while read
do
set -- $REPLY
n=$(($n+$#))
done
echo $n




$ echo ,,, | ./count.sh 
3
$ echo ,,, | ./count.sh 
7
$ echo 'cow,dog,fish,' | ./count.sh 
3

so far so good but:

$ echo 'cow,dog,fish' | ./count.sh 
3
$ echo 'cow 
dog 
fish' | ./count.sh 
3

Poo!

Could almost certainly be fixed with one or more of
test -n, shift and expr but that's enough for me.





-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Rick Welykochy

Norman Gaywood wrote:


There is also the slightly shorter, tending to perl ugly instead of
perl neat:

perl -0777 -pe '$_=tr/,//' input.txt


Let's get rid of one character:

perl -0777 -pe '$_=y/,//' input.txt


cheers
rickw




--
_
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being 
made.
-- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Norman Gaywood
On Wed, Dec 19, 2007 at 12:46:51PM +1100, Scott Ragen wrote:
> [EMAIL PROTECTED] wrote on 19/12/2007 11:34:30 AM:
> > Norman Gaywood wrote:
> > > perl -00 -ne 'print tr/,//' input.txt
> > 
> > I nominate the perl soln as the winner so far: runs like
> > a bat of out hell and is the most easy to understand.
> > And the shortest in source code size.
> 
> I have to disagree. Whilst it may be fast, its not 100% correct.
> Most of the time it would probably work, but if there are any blank lines, 
> it outputs the current count, and starts again.
> 
> Consider the following file contents:
> --file contents--
> this,is,the,first,line
> this,is,the,second
> 
> the,above,was,a,blank,line
> 
> and,another,blank,line
> --end file contents--
> 
> On Jeff's original command:
> sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
> 15
> 
> The perl command:
> perl -00 -ne 'print tr/,//' input.txt
> 753

You are correct. I misread the perlrun man page. -00 means paragraph
mode. I wanted slurp mode, which is the slightly uglier -0777. So the perl
solution should be:

perl -0777 -ne 'print tr/,//' input.txt

There is also the slightly shorter, tending to perl ugly instead of
perl neat:

perl -0777 -pe '$_=tr/,//' input.txt

-- 
Norman Gaywood, Systems Administrator
University of New England, Armidale, NSW 2351, Australia

[EMAIL PROTECTED]Phone: +61 (0)2 6773 3337
http://mcs.une.edu.au/~normFax:   +61 (0)2 6773 3312

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Rick Welykochy

Scott Ragen wrote:


I have to disagree. Whilst it may be fast, its not 100% correct.
Most of the time it would probably work, but if there are any blank lines, 
it outputs the current count, and starts again.


Consider the following file contents:
--file contents--
this,is,the,first,line
this,is,the,second

the,above,was,a,blank,line

and,another,blank,line
--end file contents--

On Jeff's original command:
sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
15

The perl command:
perl -00 -ne 'print tr/,//' input.txt
753


Change the input line separator to octal 0777:

perl -0777 -ne 'print tr/,//' input.txt
15


cheers
rickw



--
_
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being 
made.
-- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Scott Ragen
[EMAIL PROTECTED] wrote on 19/12/2007 11:34:30 AM:

> Norman Gaywood wrote:
> 
> >> Oddly, perl very rarely wins these. ;-)
> > This must come close:
> > 
> > perl -00 -ne 'print tr/,//' input.txt
> 
> Timing test: say the above takes time 1.0
> then the following takes time 0.46 ...
> 
> >> python -Sc "import sys; print sys.stdin.read().count(',')"
> 
> both are much much faster than a sequence of pipes and
> low-level shell utils. And easier to comprehend.
> 
> IMHO, the most important part of optimisation these days
> is comprehensibility: people power costs a lot more than
> CPU and disks power.
> 
> I nominate the perl soln as the winner so far: runs like
> a bat of out hell and is the most easy to understand.
> And the shortest in source code size.

I have to disagree. Whilst it may be fast, its not 100% correct.
Most of the time it would probably work, but if there are any blank lines, 
it outputs the current count, and starts again.

Consider the following file contents:
--file contents--
this,is,the,first,line
this,is,the,second

the,above,was,a,blank,line

and,another,blank,line
--end file contents--

On Jeff's original command:
sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
15

The perl command:
perl -00 -ne 'print tr/,//' input.txt
753

I'm not skilled enough with perl to correct this, but
If the numbers could easily be added together it would work...

Cheers,

Scott
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Rick Welykochy

Norman Gaywood wrote:


Oddly, perl very rarely wins these. ;-)

This must come close:

perl -00 -ne 'print tr/,//' input.txt


Timing test: say the above takes time 1.0
then the following takes time 0.46 ...


python -Sc "import sys; print sys.stdin.read().count(',')"


both are much much faster than a sequence of pipes and
low-level shell utils. And easier to comprehend.

IMHO, the most important part of optimisation these days
is comprehensibility: people power costs a lot more than
CPU and disks power.

I nominate the perl soln as the winner so far: runs like
a bat of out hell and is the most easy to understand.
And the shortest in source code size.

cheers
rickw



--
_
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being 
made.
-- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Xorg Configurators

2007-12-18 Thread Dean Hamstead

Hi All,

In spite of being a staunch fan of configuring X with vi, i am looking 
for a graphical configuration tool for Xorg. Especially one with good

multi-head support. So i am wondering if anyone has any thoughts.

Generally i am a debian man, but am willing to go with suse, fedora etc.
Not sure if yast2 has web based config, i know it has ncurses and x11.
But im not sure how good its multi-head configuration goes.

Web based would even be nice.

Even perl modules to simplify making my own interface would be helpfull.

Nvidia-xconfig is may also make my life easier and i am aware of it.

Dean
--
http://fragfest.com.au
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Norman Gaywood
On Dec 18, 2007 4:47 PM, Jeff Waugh <[EMAIL PROTECTED]> wrote:
> 
>
> >  perl -e 'while(<>){$a+=s/[,]//g};print "$a\n"'  >
> > Do I win??
>
> Oddly, perl very rarely wins these. ;-)

This must come close:

perl -00 -ne 'print tr/,//' input.txt

-- 
Norman Gaywood, Systems Administrator
University of New England, Armidale,
NSW 2351, Australia
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Alex Samad
On Tue, Dec 18, 2007 at 11:57:39PM +1100, Jamie Wilkinson wrote:
> This one time, at band camp, Jeff Waugh wrote:
> >
> >
> >> >   sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
> >> 
> >> Something like the following might be close:
> >> 
> >> awk 'BEGIN{FS=","}{$0~",$":i=i+NF?i=i+NF-1}END{print(i)}' input.txt
> >
> >Close in what sense, the syntax error, the length, or the output? ;-)
> 
> Why *are* you using the g option to sed's search and replace?
g - global (?) means to do it more than one time on the line
> 
> Oh I see, I misread your caret.  Nevermind.
> -- 
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
> 


signature.asc
Description: Digital signature
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Rick Welykochy

Andrew Bennetts wrote:


If you want to avoid reading the whole file into memory:

python -Sc "import sys; print sum(l.count(',') for l in sys.stdin)" < input.txt


Yes. That's much better. Slurping the input into memory doesn't
scale well.

And they said TIMTOWTDI applied only to perl.

cheers
rickw


--
_
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being 
made.
-- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] USB to serial

2007-12-18 Thread John Ferlito
On Tue, Dec 18, 2007 at 11:32:23PM +1030, Glen Turner wrote:
> Personally, when configuring routers these days I use a Bluetooth-serial
> dongle, which I hang off about 10cm of shortened Cisco console cable.
> Gets rid of the cable across the computer room floor, which is always a
> trip hazard when making physical changes (about the only time you need
> to jack into the console, as opposed to coming in via a console server).
> I
> picked it up in the USA for US$40 and have never seen its like again.
> I'd love to know if something similar can be sourced locally so that
> other staff members can stop stealing mine.

Hmm I want one of those! The important question though is how many
times do you leave the data centre with it still attached to the
router :)

Expansys have a couple. All quite pricey though.


-- 
John
http://www.inodes.org/
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Andrew Bennetts
Rick Welykochy wrote:
> Jamie Wilkinson wrote:
>> This one time, at band camp, Jeff Waugh wrote:
>>> Hi all,
>>>
>>> Here's a starting point. What's a more optimal way to perform this task? 
>>> :-)
>>>
>>>  sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
>>>
>>> Tuesday afternoon shell optimisation party!
>> You want to count the total number of characters in a file, not including
>> newlines, that are on lines that don't start with a comma.
>> Does it have to be in shell? :-)
>
> How about this. You want to count the total number of commas in a file.
>
> python -c "import sys; print (''.join(sys.stdin.readlines())).count(',')" < 
> input.txt

You can simplify that slightly:

python -Sc "import sys; print sys.stdin.read().count(',')" < input.txt

This way is faster, too :)

If you want to avoid reading the whole file into memory:

python -Sc "import sys; print sum(l.count(',') for l in sys.stdin)" < input.txt

-Andrew.

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] USB to serial

2007-12-18 Thread Glen Turner

On Tue, 2007-12-18 at 12:59 +1100, Alan L Tyree wrote:
> Is there anything that I need to look for in these USB to serial
> converters? Any special software needed?

We (AARNet) use the Keyspan USA-19HS. They are about $49 from the
distributor.
We selected them mainly for continuity of supply -- you can certainly
see other devices around for a lot less. They require a firmware
download and a driver, both of these are built into recent Linux
(eg, not RHEL3).  Absolutely solid and no complaints.

Since you are a customer and AustLII is such a fantastic resource
(I'd just die without your online copy of the Telco Act), drop me
your snail-mail address privately and Santa will send you one.

Some USB-serial devices use the "character device" profile in USB.
These don't require a special driver, but can't do handshaking.

Personally, when configuring routers these days I use a Bluetooth-serial
dongle, which I hang off about 10cm of shortened Cisco console cable.
Gets rid of the cable across the computer room floor, which is always a
trip hazard when making physical changes (about the only time you need
to jack into the console, as opposed to coming in via a console server).
I
picked it up in the USA for US$40 and have never seen its like again.
I'd love to know if something similar can be sourced locally so that
other staff members can stop stealing mine.

Cheers, Glen

-- 
Glen Turner   
Tel: 0416 295 857 or +61 416 295 857

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Rick Welykochy

Jeff Waugh wrote:


Traditionally it has been quick command line combos, but there are always
offerings in more conventional and esoteric forms. Such as brainf*ck this
time.


I enjoyed the bf and postscript the best so far. 
Any INTERCAL skilz out there?  


cheers
rickw



--
_
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being 
made.
-- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Jeff Waugh


> Jeff Waugh wrote:
>
>>> Does it have to be in shell? :-)
>>
>> No sir! But shell usually wins.
>
> On my 1 GHz / 1 GB powerbook, the python one-liner I just submitted runs 5
> x faster than the original.

Ah yes, well there are different definitions of optimisation, and all are
valid in this game. I was referring to command line length and cleverness
though, which is probably a bit exclusive. ;-)

> But what does 'shell' really mean? python,perl, etc.  are external to the
> shell as surely as sed,tr,wc.

Traditionally it has been quick command line combos, but there are always
offerings in more conventional and esoteric forms. Such as brainf*ck this
time.

I posted this as a result of a joke on another mailing list about an amazing
abuse of commas from a particular poster, but also because we haven't had
one of these threads for ages. It was always fun when Herbert Xu or Gus Lees
would smack everyone about with a clever use of cut(1). ;-)

- Jeff

-- 
linux.conf.au 2008: Melbourne, Australiahttp://lca2008.linux.org.au/
 
   "We are peaking sexually when they are peaking. And two peaks makes a
hell of a good mount." - SMH
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Rick Welykochy

Jamie Wilkinson wrote:

This one time, at band camp, Jeff Waugh wrote:

Hi all,

Here's a starting point. What's a more optimal way to perform this task? :-)

 sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m

Tuesday afternoon shell optimisation party!


You want to count the total number of characters in a file, not including
newlines, that are on lines that don't start with a comma.

Does it have to be in shell? :-)


How about this. You want to count the total number of commas in a file.

python -c "import sys; print (''.join(sys.stdin.readlines())).count(',')" < 
input.txt

cheers
rickw


--
_
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being 
made.
-- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Rick Welykochy

Jeff Waugh wrote:


Does it have to be in shell? :-)


No sir! But shell usually wins.


On my 1 GHz / 1 GB powerbook, the python one-liner
I just submitted runs 5 x faster than the original.

But what does 'shell' really mean? python,perl, etc.
are external to the shell as surely as sed,tr,wc.

cheers 
rick



--
_
Rick Welykochy || Praxis Services

People who enjoy eating sausage and obey the law should not watch either being 
made.
-- Otto von Bismarck
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Jeff Waugh


> >  sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
> >
> >Tuesday afternoon shell optimisation party!
> 
> You want to count the total number of characters in a file, not including
> newlines, that are on lines that don't start with a comma.

That's an... interesting... reading of the command. Clearly this should be a
Tuesday afternoon only activity rather than a Tuesday-almost-Wednesday after
a few drinks activity. ;-)

> Does it have to be in shell? :-)

No sir! But shell usually wins.

- Jeff

-- 
GNOME.conf.au 2008: Melbourne, Australia http://live.gnome.org/Melbourne2008
 
 ASCII stupid question, get a stupid ANSI.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Jamie Wilkinson
This one time, at band camp, Peter Miller wrote:
>Cascade Premium, please.

Zing!
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Jamie Wilkinson
This one time, at band camp, Jeff Waugh wrote:
>
>
>> >   sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
>> 
>> Something like the following might be close:
>> 
>> awk 'BEGIN{FS=","}{$0~",$":i=i+NF?i=i+NF-1}END{print(i)}' input.txt
>
>Close in what sense, the syntax error, the length, or the output? ;-)

Why *are* you using the g option to sed's search and replace?

Oh I see, I misread your caret.  Nevermind.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Jamie Wilkinson
This one time, at band camp, Jeff Waugh wrote:
>Hi all,
>
>Here's a starting point. What's a more optimal way to perform this task? :-)
>
>  sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
>
>Tuesday afternoon shell optimisation party!

You want to count the total number of characters in a file, not including
newlines, that are on lines that don't start with a comma.

Does it have to be in shell? :-)
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] OT Jobs in Sydney Australia

2007-12-18 Thread Sridhar Dhanapalan
On Tue, 18 Dec 2007, [EMAIL PROTECTED] wrote:
> Hi all,
>
> I hope my post is ok as I am not sure where to post it or what web-sites I
> should be looking at.
>
> I wanted to find out if there are jobs available in Australia for a junior
> Linux systems admin more than likely in the Sydney area.
>
> I do not have any Linux certifications but I am working towards my LPI 101.
>
> My wife and myself are thinking of immigrating to Australia as most of our
> friends are leaving for Australia.
>
> Any advice would be great.
>
> Regards,
> Lee

A good place to start is http://www.slug.org.au/jobs :)


-- 
"If you can't make it good, at least make it look good." - Bill Gates, 1994


signature.asc
Description: This is a digitally signed message part.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Re: [SLUG] OT Jobs in Sydney Australia

2007-12-18 Thread Jeff Waugh


> I hope my post is ok as I am not sure where to post it or what web-sites I
> should be looking at.
> 
> I wanted to find out if there are jobs available in Australia for a junior
> Linux systems admin more than likely in the Sydney area.
> 
> I do not have any Linux certifications but I am working towards my LPI
> 101.
> 
> My wife and myself are thinking of immigrating to Australia as most of our
> friends are leaving for Australia.
> 
> Any advice would be great.

The market is pretty good at the moment -- lots of demand for Linux and Open
Source systems administration skills... Largely because Google are hiring
everyone (and one of them is going to reply to this in order to catch you
and get their blood money)! If you have experience, you are likely to have
an easy time finding a job in Sydney.

- Jeff

-- 
GNOME.conf.au 2008: Melbourne, Australia http://live.gnome.org/Melbourne2008
 
  Push the envelope, or push the daisies.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Sam Gentle
On Dec 18, 2007 5:21 PM, Peter Hardy <[EMAIL PROTECTED]> wrote:
> On Tue, 2007-12-18 at 16:09 +1100, Jeff Waugh wrote:
> > Here's a starting point. What's a more optimal way to perform this task? :-)
> >
> >   sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
> >
> > Tuesday afternoon shell optimisation party!
>
> How do you want it optimised?

Well, for readability, speed and code size this handy BF program is
easily the winner:

>,[<[->>+++<<]>>[-<->]+<[[-]>-<]>[->+<]<,]>>.

Keep in mind it's also optimised for usability, so the output is the
ascii value of the number rather than the number itself. It only
handles up to 255 commas (unless you have a unicode BF interpreter.)

HTH,
Sam
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] OT Jobs in Sydney Australia

2007-12-18 Thread leei
Hi all,

I hope my post is ok as I am not sure where to post it or what web-sites I
should be looking at.

I wanted to find out if there are jobs available in Australia for a junior
Linux systems admin more than likely in the Sydney area.

I do not have any Linux certifications but I am working towards my LPI 101.

My wife and myself are thinking of immigrating to Australia as most of our
friends are leaving for Australia.

Any advice would be great.

Regards,
Lee


---
South Africas premier free email service - www.webmail.co.za 
--
For super low premiums, click here http://www.webmail.co.za/dd.pwm

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Tuesday afternoon shell command optimisation party!

2007-12-18 Thread Peter Miller

On Tue, 2007-12-18 at 17:55 +1100, Peter Hardy wrote:
> I've got a sixpack of beer for a working PostScript variant. :-)

drop this in a file called count.ps

%!PS
/count { 0 { currentfile read { (,) 0 get eq { 1 add } if } { 20
string cvs print (\n) print stop } ifelse } loop } def count

and then use the following command

cat count.ps input.txt | gs -

and, yes, I tested it before posting.
Cascade Premium, please.


Regards
Peter Miller <[EMAIL PROTECTED]>
/\/\*http://miller.emu.id.au/pmiller/

PGP public key ID: 1024D/D0EDB64D
fingerprint = AD0A C5DF C426 4F03 5D53  2BDB 18D8 A4E2 D0ED B64D
See http://www.keyserver.net or any PGP keyserver for public key.

"DRM doesn't anger consumers, content owners abusing DRM angers consumers."


signature.asc
Description: This is a digitally signed message part
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html