#!/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 ubuntu. Show all posts
Showing posts with label ubuntu. 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
extract attachments from .eml file in ubuntu
mu command - a set of tools to deal with Maildirs and message files, in particular to index and search e-mail messages.
mu command provided by: maildir-utils
installation on ubuntu
mu command provided by: maildir-utils
installation on ubuntu
sudo apt-get install maildir-utils
# extract attachments
mu extract -a email.eml
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)

