Re: [wmii] slock XID patch

From: bharder <bharder_AT_methodlogic.net>
Date: Wed, 14 Nov 2007 00:36:40 -0800

On Wed, Nov 14, 2007 at 05:23:57PM +0900, sqweek wrote:
> On Nov 14, 2007 4:47 PM, Alexis Hildebrandt <afh_AT_2drop.net> wrote:
> > Hello Chris,
> > thanks for the patch I do appreciate it for it brings some subtle
> > eyecandy to slock.
> >
> > Anyone knows how to choose a random image file from a directory using an
> > rc or shell script for use with the commands proposed by Chris?
>
> I was going to say: ls *.png *.jpg etc |shuf |sed q
> But I don't /have/ shuf here. I wonder where it came from on my home
> machine... GNU coreutils it seems, must have a newer version at home.
> Anyway, shuf is not on my netbsd machine either so I wrote this naive
> replacement:

On NetBSD, shuffle(1).

> #!/bin/sh
> awk '
> BEGIN {srand()}
> {l[NR]=$0}
>
> END {
> while(length(l)) {
> i=int(rand()*NR+1)
> if(i in l) {
> print l[i]
> delete l[i]
> }
> }
> }'
>
> -sqweek
>

-- 
-bch
http://www.methodlogic.net
Received on Wed Nov 14 2007 - 09:36:42 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:30:52 UTC