#!/bin/bash -
#title :matrix_to_user_console.sh
#description :This script will write matrix characters to another user console :-) .
#author :Mehmet DEMİR
#date :20140302
#version :0.1
#usage :bash matrix_to_user_console.sh
#notes :Will be fun!
#==============================================================================
#remove comment if target user at remote
#ssh root@10.6.181.111
target_user="mehmet"
the_message="\n
\n
################################################\n
################################################\n
################## THE MATRIX ##################\n
################################################\n
# Your computer got involved in matrix network.#\n
# Don't touch this machine! ####################\n
################################################\n
################################################\n
\n
\n"
message_duration=10 # as second
target_tty="/dev/"`who|grep $target_user|tail -1|awk {'print $2'}`
echo -e $the_message > $target_tty
sleep $message_duration
# from https://github.com/devsnd/matrix-curses/blob/master/matrix-curses.py
MATRIX_CODE_CHARS=(ɀ Ɂ ɂ ŧ Ϣ ϣ Ϥ ϥ Ϧ ϧ Ϩ ϫ Ϭ ϭ Ϯ ϯ ϰ ϱ Ϣ ϣ Ϥ ϥ Ϧ ϧ Ϩ ϩ Ϫ ϫ Ϭ ϭ Ϯ ϯ ϰ ߃ ߄ ༣ ༤ ༥ ༦ ༧ ༩ ༪ ༫ ༬ ༭ ༮ ༯ ༰ ༱ ༲ ༳ ༶)
count=${#MATRIX_CODE_CHARS[*]}
maxcol=15
while (true); do
noshow=$((RANDOM % $count))
noshowchar[$noshow]=$noshow;
for (( i=0; i<=$maxcol; i++ ))
do
if [ "${noshowchar[$i]}" == "$i" ]; then
printf '\t%s' ' ' > $target_tty
else
index=$((RANDOM % $count))
printf '\t%s' ${MATRIX_CODE_CHARS[$index]} > $target_tty
fi
done
printf '\n' > $target_tty
sleep 0.05
noshowchar[$((RANDOM % $count))]=100;
noshowchar[$((RANDOM % $count))]=100;
noshowchar[$((RANDOM % $count))]=100;
noshowchar[$((RANDOM % $count))]=100;
noshowchar[$((RANDOM % $count))]=100;
done
exit 0
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
write matrix chars to another user console for manipulation
watch the video for action :-).
Labels:
bash,
console,
linux,
manipulation,
matrix,
matrix characters,
terminal,
ubuntu,
unix,
user console manipulation
0
comments
Java Nmon Analyser for AIX topas_nmon data
nmon is perfect tool for system monitoring and capacity planning. You can be found nmon installation and its benefits here.
How to show nmon datas as graphics?
I know two tools for this purpose;
Run this for capacity planning (15 min for 1 day) :
If you run this command, it creates a file called like mehmet-ThinkPad-W530_130809_1644.nmon. This file contains a lot of numeric data.
We need to presentation numeric data as graphics for understanding it. We can use Java Nmon Analyser.
My Problem:
I have a nmon data but created with following command in AIX.
When i try to load it in Java Nmon Analyser, the program abnormally quits with any error messages.
I downloaded the source code of Java Nmon Analyser, and ran it in eclipse for obtain why its fail in topas_nmon data.
I got an error :
I found reason. Problem is the empty line in the .nmon file.
For solution you can delete this line or download this Nmon Java Analyser modified by me.
What did i do for solution ?
error occured in this line :
I say that "if line is empty continue" in NmonFileLoader.java file.
list of added features to generic java nmon analyser
- added jscroll
- selecting multiple .nmon files one time
- changed filedialog to jfilechooser
- can be handle nmon files that created from topas_nmon command (in AIX)
How to run?
now it ran :
How to show nmon datas as graphics?
I know two tools for this purpose;
- nmon analyser — A free tool to produce AIX performance reports (excell macros)
- Java Nmon Analyser
Run this for capacity planning (15 min for 1 day) :
nmon -x If you run this command, it creates a file called like mehmet-ThinkPad-W530_130809_1644.nmon. This file contains a lot of numeric data.
We need to presentation numeric data as graphics for understanding it. We can use Java Nmon Analyser.
My Problem:
I have a nmon data but created with following command in AIX.
topas_nmon -fdALMNVY^ -m /perf/ -youtput_dir=/perf/servername -ystart_time=00:00:00,Oct16,2012
When i try to load it in Java Nmon Analyser, the program abnormally quits with any error messages.
I downloaded the source code of Java Nmon Analyser, and ran it in eclipse for obtain why its fail in topas_nmon data.
I got an error :
Exception in thread "Thread-1" java.lang.ArrayIndexOutOfBoundsException: 1
at li.xiang.nmonanalyser.NmonFileLoader.run(NmonFileLoader.java:111)
at java.lang.Thread.run(Thread.java:662)
I found reason. Problem is the empty line in the .nmon file.
For solution you can delete this line or download this Nmon Java Analyser modified by me.
What did i do for solution ?
error occured in this line :
}else if(cols[1].matches("T\\d+")){ // ===> Data area(exclude TOP tag).I say that "if line is empty continue" in NmonFileLoader.java file.
while((!Thread.interrupted())&&(line =reader.readLine())!=null){
if(line.isEmpty()) continue;
list of added features to generic java nmon analyser
- added jscroll
- selecting multiple .nmon files one time
- changed filedialog to jfilechooser
- remember last path in file chooser
How to run?
java -jar java_nmon_analyser_2.jar now it ran :
Compile and run mpi program from gedit with shortcut key
Hi guys,
In this post you will see that, how to compile and run your mpi program in gedit with one shortcut key.
If you not installed MPI, look at here for installation on ubuntu. You will see compile and run your mpi program in Geany.
If you are using Gedit and you want to control number of process simple, use the gedit external script below written by me.
After you wrote your code, press ALT+R for compiling and running its.
You will see that : your program will be compiling (mpicc) and running (mpirun) with you specified number of processes in .c program file. You can see it below.
Watch the video.
installation on ubuntu :
External tools script:
Don't forget
add this line to your mpi program for number of processor.
// mpirun with np=4
Have a good time.
In this post you will see that, how to compile and run your mpi program in gedit with one shortcut key.
If you not installed MPI, look at here for installation on ubuntu. You will see compile and run your mpi program in Geany.
If you are using Gedit and you want to control number of process simple, use the gedit external script below written by me.
After you wrote your code, press ALT+R for compiling and running its.
You will see that : your program will be compiling (mpicc) and running (mpirun) with you specified number of processes in .c program file. You can see it below.
// mpirun with np=4
Watch the video.
installation on ubuntu :
# install openmpi
sudo apt-get install libopenmpi-dev openmpi-bin openmpi-doc
# install gedit plugins.
sudo apt-get install gedit-plugins
# enable external tools.
# compile mpi program
mpicc test.c -o testprog
# run compiled mpi program
mpirun -np 5 testprog
External tools script:
#!/bin/sh
cat - > /tmp/a.c
np=`eval grep "mpirun\ with\ np=" /tmp/a.c | awk -F "=" {'print $2'}`
mpicc /tmp/a.c -o /tmp/a.out
mpirun -np $np /tmp/a.out
Don't forget
add this line to your mpi program for number of processor.
// mpirun with np=4
Have a good time.
Labels:
external tools,
gedit,
gedit plugins,
linux,
mpi,
mpicc,
mpirun,
openmpi,
run a command,
ubuntu
0
comments
Run a command to terminal from gedit with shortcut key
Hi guys.
If you working with gedit and terminal this tool is very usefull for run a command to in the terminal from gedit (previous window).
I wrote a script with gedit external plugin for this purpose.
How to use:
Installation on Ubuntu :
install gedit plugins.
install xdotool.
Open gedit -> Edit -> Preferences -> Enable External Tools plugin.
Open gedit -> Manage External Tools -> click +
paste the script in the below to Edit: box.
Select Shortcut Key: <ALT+L>
Click againt +, for another shortcut (run "Current selection"). <ALT+B>
All is same except "Input: Current selection" and shortcut key.
If you working with gedit and terminal this tool is very usefull for run a command to in the terminal from gedit (previous window).
I wrote a script with gedit external plugin for this purpose.
How to use:
- Select a text and press "Alt+B" key
or - Locate a cursor to line and press "Alt+L" key
Installation on Ubuntu :
install gedit plugins.
# sudo apt-get install gedit-plugins install xdotool.
# sudo apt-get install xdotoolOpen gedit -> Edit -> Preferences -> Enable External Tools plugin.
Open gedit -> Manage External Tools -> click +
paste the script in the below to Edit: box.
#!/bin/sh cat - > /tmp/runprev_meh.txt line=$(cat /tmp/runprev_meh.txt) xdotool key alt+Tab xdotool sleep 0.2 xdotool type "$line" xdotool key Return xdotool key alt+Tab
Select Shortcut Key: <ALT+L>
Click againt +, for another shortcut (run "Current selection"). <ALT+B>
All is same except "Input: Current selection" and shortcut key.
Labels:
automaticly,
command,
gedit,
gedit plugins,
linux,
run a command,
shortcut,
terminal,
ubuntu,
xdotool
0
comments
Usefull network scripts for linux
Hi all,
You can find a few usefull scripts about networking.
Which server is down (not network reachable) ?
You can find a few usefull scripts about networking.
Which server is down (not network reachable) ?
while read serverip; do result=""; result=`ping $serverip -c 1 -W 1|grep "100% packet loss"`; test -n "$result" && echo $serverip; done < iplist.txt # iplist.txt: contains server ip addresses.
Posted by
Mehmet DEMİR
at
1:38 AM
Save Searched Words Automaticly Babylon Word Search Extension
You know there is Babylon Word Search extension for firefox. This extension is free but Babylon Dictionary is not.
When we want to learn a foreign language we require save the foreign words meaning or description in our language. We make this more often copy and paste to a document. If you want save the words to a file automaticly look at http://eeecoder.blogspot.com/ 2013/08/firefox-babylon-add- on-and-more.html .
When we want to learn a foreign language we require save the foreign words meaning or description in our language. We make this more often copy and paste to a document. If you want save the words to a file automaticly look at http://eeecoder.blogspot.com/
Labels:
babylon,
firefox,
firefox extension,
foreign language,
linux,
save,
translating,
ubuntu,
word search
0
comments
Subscribe to:
Posts (Atom)




