Bit of scripting fun

Using applications, configuring, problems
Post Reply
Message
Author
april

Bit of scripting fun

#1 Post by april »

I saw a post on instructables for a bat script that did nothing but looked bad .
So I threw a bit together for Linux that also does nothing but looks bad.

You scripters out there ..Anybody got any other good looking stuff?
Remove .jpg and make .sh and give executable permission to run
PS time the forum updated this and changed so you can move attachments about.
Added the windows bat file I found too ,remove jpeg too same as above
Attachments
MatrixW.bat.jpg
(317 Bytes) Downloaded 96 times
Matrix.jpg
(1.12 KiB) Downloaded 138 times

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#2 Post by jafadmin »

In Unix/Linux, /dev/urandom is your "one-stop shopping destination" for pure randomness. It pulls from the Linux entropy pool.

Code: Select all

#! /bin/bash
#
MyRANDOM=$(od -vAn -N4 -tu4 < /dev/random)

echo "MyRANDOM = $MyRANDOM"
Last edited by jafadmin on Fri 23 Mar 2018, 17:47, edited 1 time in total.

april

#3 Post by april »

Cheers . How would I use that in a script?
Just keep repeating it I suppose

User avatar
spiritwild
Posts: 181
Joined: Mon 03 Oct 2016, 10:06

#4 Post by spiritwild »

#!/bin/bash
echo -e "\033[2J\033[?25l"; R=`tput lines` C=`tput cols`;: $[R--] ; while true
do ( e=echo\ -e s=sleep j=$[RANDOM%C] d=$[RANDOM%R];for i in `eval $e {1..$R}`;
do c=`printf '\\\\0%o' $[RANDOM%57+33]` ### http://bruxy.regnet.cz/web/linux ###
$e "\033[$[i-1];${j}H\033[32m$c\033[$i;${j}H\033[37m"$c; $s 0.1;if [ $i -ge $d ]
then $e "\033[$[i-d];${j}H ";fi;done;for i in `eval $e {$[i-d]..$R}`; #[mat!rix]
do echo -e "\033[$i;${j}f ";$s 0.1;done)& sleep 0.05;done #(c) 2011 -- [ BruXy ]





That didn't paste well, yuck.
Anyhoo...

Author: Martin "BruXy" Bruchanov, bruxy at http://bruxy.regnet.cz/web/linux/EN/

It's a matrix script I've had forever. if you execute it 3 times, musher0 will show up and make the code look spectacular! :lol:

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#5 Post by musher0 »

What ?!?!
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#6 Post by jafadmin »

april wrote:Cheers . How would I use that in a script?
Just keep repeating it I suppose
Use it to seed instead of using the date. The date ain't random in my country.

'/dev/random' is truly random as it is the result of collected random hardware events on your PC and converting them from "entropy". The /dev/random device only holds like 32 bytes of entropy at a time, so large scale use of it would be painfully slow as it will block and you wait for the entropy pool to replenish.

'/dev/urandom', on the other hand, uses '/dev/random' to seed itself, and is capable of producing a reliable unblocking constant stream of random values.

This code only uses 4 bytes from the entropy pool:

Code: Select all

seed=$(od -vAn -N4 -tu4 < /dev/random)

april

#7 Post by april »

Thanks jafadmin ..gotta study that. It seems to work just fine that way

Thanks also spiritwild...Im trying to follow that too
That script runs well though. Proper downwards lines


Using the code block to post it and it looks like this

Code: Select all

#!/bin/bash
echo -e "\033[2J\033[?25l"; 
R=`tput lines` C=`tput cols`;: $[R--] ;
 while true
do ( e=echo\ -e s=sleep j=$[RANDOM%C] d=$[RANDOM%R];
for i in `eval $e {1..$R}`;
do c=`printf '\\\\0%o' $[RANDOM%57+33]` ### http://bruxy.regnet.cz/web/linux ###
$e "\033[$[i-1];
${j}H\033[32m$c\033[$i;
${j}H\033[37m"$c; 
$s 0.1;
if [ $i -ge $d ]
then $e "\033[$[i-d];
{j}H ";
fi;
done;
for i in `eval $e {$[i-d]..$R}`; 
#[mat!rix]
do echo -e "\033[$i;${j}f ";
$s 0.1;done)& sleep 0.05;
done #(c) 2011 -- [ BruXy ] 

Post Reply