[GLLUG] Beep Toy-Program

Karl Schuttler karl.schuttler at gmail.com
Thu Oct 13 17:49:36 EDT 2011


Smoke.sh is just a batch script that runs the beep command multiple
times and pauses inbetween beeps. Command arguments for beep command
are -f (frequency) and -l (length in milliseconds)

while true #loop forever
 if `vmstat|tail -1|cut -d\" \" -f2`.to_i > 2 #vmstat dumps system
info, the rest formats it to get just the processor queue. "If queue >
2"
   system("beep -f " + (200+rand(400)).to_s + " -l 150") #runs beep
command with a random frequency between 200-600hz for 150ms.
 end
end

To end program, do pkill ruby or ctrl-c. Program is ran by "$ruby wopr.rb"

On Thu, Oct 13, 2011 at 5:33 PM, Stanley C. Mortel <mortel at cyber-nos.com> wrote:
> Karl,
>
> As a public service, why don't you annotate, comment, explain what each
> little bit of this thing is doing, for those of us to whom the syntax is not
> particularly perspicuous.
>
> Stan
>
> On 10/13/2011 4:36 PM, Karl Schuttler wrote:
>
> Hi all,
>
> Some of you may remember my world famous beep scripts from back in the
> day, including great beep hits like Smoke on the Water (attached), and
> Iron Man. I felt inspired yesterday and wrote up this quick ruby
> script which makes random beeping sounds reminiscent of old sci-fi
> computers when your linux computer is doing anything that requires a
> bit of processor. Required is the linux beep utility (apt-get install
> beep), ruby (probably already installed), and your pc speaker turned
> on (modprobe pcspkr and use alsamixer to pump up the volume).
>
> wopr.rb
> =========
> while true
>   if `vmstat|tail -1|cut -d\" \" -f2`.to_i > 2
>     system("beep -f " + (200+rand(400)).to_s + " -l 150")
>   end
> end
>
>
> Leave it running in the background and have a little fun. To test it,
> you can always do a dd if=/dev/urandom of=/dev/null to generate some
> processor cycles.
>
> Enjoy,
> Karl
>
>
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://mailman.egr.msu.edu/mailman/listinfo/linux-user
>
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://mailman.egr.msu.edu/mailman/listinfo/linux-user
>
>


More information about the linux-user mailing list