LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-16-2022, 05:32 PM   #16
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835

Quote:
What is the name of that program?
Processor_working_really_hard.sh
Code:
#!/usr/bin/bash

green="\033[0;32m"
blue="\033[0;34m"
cyan="\033[0;36m"
red="\033[0;31m"
grey="\033[0;37m"
white="\033[1;37m"
bcyan="\033[1;36m"
bgreen="\033[1;32m"
bblue="\033[1;34m"
bred="\033[1;31m"

colors=($green $blue $cyan $red $grey $white $bcyan $bgreen $bblue $bred)

spacing=${1:-10} 
scroll=${1:-0}
screenlines=$(expr `tput lines` - 1 + $scroll)
screencols=$(expr `tput cols` / 2 - 1)

chars=(0 1)

count=${#chars[@]}
colorcount=${#colors[@]}

trap "tput sgr0; clear; exit" SIGTERM SIGINT

clear
tput cup 0 0
while :; do
    for i in $(eval echo {1..$screenlines}); do
        for i in $(eval echo {1..$screencols}); do
            rand=$(($RANDOM%$spacing))
            case $rand in
                0) printf "${colors[$RANDOM%$colorcount]}${chars[$RANDOM%$count]} " ;;
                1) printf "  " ;;
                *) printf "\033[2C" ;;
            esac
        done
        printf "\n"
    done
    tput cup 0 0
done
Which is as usefull as trying to stream the bits out of a processor to the terminal.

Last edited by teckk; 03-16-2022 at 05:34 PM.
 
1 members found this post helpful.
Old 03-17-2022, 01:42 AM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
Quote:
Originally Posted by teckk View Post
Processor_working_really_hard.sh


Which is as usefull as trying to stream the bits out of a processor to the terminal.
A nice screensaver. Just to see how the CPU works, all day long. (Would be nice to handle the resize event).
 
Old 03-17-2022, 03:49 AM   #18
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
(Novell servers' screensaver did something similar: faster movement on the screen meant higher load.)
 
Old 03-17-2022, 08:05 AM   #19
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
Quote:
Would be nice to handle the resize event
Post 16 ^^ Ancient script. Spent a few min modernizing, without eval, and with auto resize. Enjoy.

Code:
#!/usr/bin/bash

green="\033[0;32m"
blue="\033[0;34m"
cyan="\033[0;36m"
red="\033[0;31m"
grey="\033[0;37m"
white="\033[1;37m"
bcyan="\033[1;36m"
bgreen="\033[1;32m"
bblue="\033[1;34m"
bred="\033[1;31m"
bgrey="\033[1;30m"

colors=($green $blue $cyan $red $grey $white $bcyan $bgreen $bblue $bred $bgrey)

sc=$(expr $(tput cols))
chars=(0000010 000000101 0000010 0001000 0001010 0010011 0011100
0100010 0000110 0001110 0011110 11001101 00FFFF 0101010 1000001 1111111
4DFFFF 9EB9DF 83B0F2 2E2ECF EEA6A6 F1E9E3 ACF3F3 7878FF 2619EF EDEBF9) 

count=${#chars[@]}
colorcount=${#colors[@]}

clear
tput cup 0 0
while :; do
    for i in {1..100}; do
        for ((i=1; i<$sc; i++)); do
            rand=$(($RANDOM%3))
            case $rand in
                0) printf "${colors[$RANDOM%$colorcount]}${chars[$RANDOM%$count]} " ;;
                1) printf "  " ;;
                *) printf "\033[2C" ;;
            esac
        done
        printf "\n"
        ran=.$(($RANDOM%10))
        sleep "$ran" 
    done
    clear
    printf "%s Checksum block and Memory dump..."
    sleep 2
done
 
Old 03-17-2022, 09:17 AM   #20
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
Quote:
Originally Posted by teckk View Post
Code:
4DFFFF 9EB9DF 83B0F2 2E2ECF EEA6A6 F1E9E3 ACF3F3 7878FF 2619EF EDEBF9
Looks like it works on 48bit CPUs.
 
Old 03-17-2022, 10:00 AM   #21
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,249

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
Quote:
Originally Posted by blumenwesen View Post
I would like to see the binary code that the computer currently edits, so the complete reading of all activities to be calculated.
to see thoroughly only one consecutive 01101000 01101111100100000 01101001 0110111101000 00100000 011010 01101001 01101110 00100000 01100101 01101001 01101110 00100000 01100001 01110101 0110100 01101111 01101101 01100001 01110100.
Are we talking about an 8-bit "computer" here?

You probably have a 64-bit OS running on a 64-bit CPU. Its instructions aren't eight bits wide.

Last edited by dugan; 03-17-2022 at 10:04 AM.
 
Old 03-17-2022, 11:39 AM   #22
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
Couldn't resist with this script.

Away from your desk? On an extended coffee break? You want the boss to think that you are hard at it when he/she walks by your puter.
Open your terminal full screen and...
Code:
#!/usr/bin/bash

green="\033[0;32m"
cyan="\033[0;36m"
reset="\033[0m"

colors=($cyan $green $reset)

sc=$(expr $(tput cols))

chars=(
"g++ -DHAVE_CONFIG_H -I. -I..  -I.. -DCUR_WORKING_DIR=/build/libs/docs/project/src/master/lout -I/usr/local/include  
-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2
 -Wformat -Werror=format-security   -fstack-clash-protection -fcf-prot
 ection -Wp,-D_GLIBCXX_ASSERTIONS -Wall -W -Wno-unused-parameter -fno-
 rtti -fno-exceptions -MT container.o -MD -MP -MF .deps/container.Tpo -c 
 -o container.o container.cc"
"g++ -DHAVE_CONFIG_H -I. -I..  -I.. -DDXYZ_LIBDIR=/usr/lib/xyz/ -DCUR_WORKING_DIR=/build/libc/
libb/liba/src/master/xy -I/usr/local/include  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt 
-fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash
-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -Wall -W -Wno-unused-parameter -fno-rtti 
-fno-exceptions -MT style.o -MD -MP -MF .deps/style.Tpo -c -o style.o style.cc style.cc: In function ‘void dw::core::style::drawBorderRight(dw::core::View*, dw::core::style::Style*, int, int, int, int)’:"
"

style.cc:1068:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
 1068        dotted = true;
             ~~~~~~~^~~~~~
             
"             
"mv -f .deps/style.cs1 .deps/style.css
"
"g++ -DHAVE_CONFIG_H -I. -I..  -I.. -DDILLO_LIBDIR=/usr/lib/abc/ -DCUR_WORKING_DIR=/home/project/a/c++/lib/ 
-I/usr/local/include  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY
_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBC
XX_ASSERTIONS -Wall -W -Wno-unused-parameter -fno-rtti -fno-exceptions -MT tools.o -MD -MP -MF .deps/

"
"mv -f .deps/alignedtextblock.xyz .deps/alignedtextblock.pdq
"
"g++ -DHAVE_CONFIG_H -I. -I..  -I.. -DDILLO_LIBDIR=/usr/lib/libc/ -DCUR_WORKING_DIR=/home/project/info/dxy/src
/master/d -I/usr/local/include  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,
-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection 
-Wp,-D_GLIBCXX_ASSERTIONS -Wall -W -Wno-unused-parameter -fno-rtti -fno-exceptions -MT bullet.o -MD -MP 
-MF .deps/bullet.Tpo -c -o calc.o calc.cc"

"
build.cc:1584:23: warning: Tried to divide by zero [-Wimplicit-fallthrough=]
 1584        scripts = true;"

)

count=${#chars[@]}
colorcount=${#colors[@]}

clear
tput cup 0 0
while :; do
    for i in {1..100}; do
        for ((i=1; i<$sc; i++)); do
            rand=$(($RANDOM%3))
            case $rand in
                0) printf "${colors[$RANDOM%$colorcount]}${chars[$RANDOM%$count]} " ;;
                1) printf "  " ;;
                *) printf "\033[2C" ;;
            esac
        done
        printf "\n"
        ran=.$(($RANDOM%10))
        sleep "$ran" 
    done
    clear
    printf "%s Changing into master project build directory..."
    sleep 2
done
 
Old 03-17-2022, 03:46 PM   #23
blumenwesen
Member
 
Registered: Jan 2022
Posts: 53

Original Poster
Rep: Reputation: 0
Thank you, i wanted to randomly generate the binary code of the computer work that is impossible to manipulate from the pc which I can adjust even then.
if someone hacks and tries to influence the result he can only do so afterwards because his work influences the result at the moment of manipulation.
since it is then a program that then runs again a possibly too short time while the output can then only be influenced by myself.
 
Old 03-17-2022, 09:16 PM   #24
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by pan64 View Post
A nice screensaver. Just to see how the CPU works, all day long.
And listen to the fan spin up...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
df and due commands show differences and lsof does not show deleted files devUnix Linux - Server 7 07-17-2014 03:45 PM
[SOLVED] how to show the current time at the top in the current shell Always ? rohitchauhan Linux - General 5 04-09-2014 03:05 PM
gtkmm: show() doesn't show the window when adding windows from other places than main() Hvl Programming 0 06-21-2012 09:54 AM
Pictures show on camera but wont show on laptop ravio Linux - Newbie 3 05-28-2012 11:20 PM
Evolution does not show content of inbox or sent but does show other folders manny_borges Linux - Newbie 1 05-07-2011 05:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration