BIPEDU

my ideas in action

Monthly Archives: September 2012

loop all files inside a folder

Another command line trick.

Let’s say that you just come back from vacation and you have few hundreds pictures in a folder. And you want to rename them from DSCxxxxx.JPG to something else like Vacation_2012_xxx.JPG.

You can do this with just a single line command:

for file in DSC*; do mv “$file” Vacation_2012_”${file#DSC}”; done

So basically this command is taking all files from current folder, that start with DSC string. If your files start with different string the replace DSC with yours (example “IMG”…).

Then each file is renamed (mv command) in to Vacation_2012_xxxxx.JPG . As you can see the string replacement is just adding the “Vacation_2012_” to a string from which it deleted “DSC”.

 

Now lets say that you have somewhere a web photo album ( like a PHP or Picasa, or similar). You want to upload all pictures there but they are too big (12MP, or 16MP). Well, a similar strategy works here, like this command:

for file in *.JPG; do convert $file -resize 1000 $file; done

So the same looping in the current folder, but now the “convert” command is used and all pictures are re-sized to  1000 pixel width. Please run this on a backup , since the originals will be replaced !

for more option please use :

man convert

 

Advertisements

Fetih 1453 – propaganda movie – review

Fetih 1453 - movie poster

 

Recently I saw the Fetih 1453 movie. For the people that do not know what is this … well, it is a historic movie made by Turkish cinema about the conquest of Constantinople in 1453. It is full of special effects and it aims to revive the Ottoman glory.

 

The story is set in the 1453 (and few years earlier). The movie start with a prophecy that a strong ruler will rise and the Ottoman Empire will be the biggest. Then continue with some background of the historical and personal aspects of Mehmet sultan. Then for almost 1 hour the battle of Constantinople.

The movie is very long, approx 2.5 hours. It has some action scene but also some boring scene.

I think the director of this movie wanted to show too much in too little time. So it give the impression that is a gathering of scenes and episodes and it may be hard to follow for the people that do not have historical background.

 

My personal remarks are mainly about the historical accuracy of the events and the propaganda and Turkish heroism.

I want to remark first the clear difference and superiority of the Turks in compare will all other nations ( Byzantines and Vatican ). In may scenes the byzantine emperor is shown in company of party girls while the sultan is only with his wife and kid. The images are idealized so that it will look very patriotic. The amusing part for me was that the sultan had time to write poetry to his wife as a goodbye gift before going to war. I do not doubt the fact that the sultan may write poetry , but the scene was exaggerated.

Then the scenes in which the sultan fight with sword or hunts with bow and arrow… please.. it looks better that in the Robin Hood propaganda movies ! Basically , to be short, this propaganda movie want to show that the sultan was perfect: best soldier , best father, best husband ( where is the harem ??) best politician, wise, patient and stubborn. Too many qualities for a single person. If we read some history we see other things. But I will not enter now in the polemic with this propaganda movie.

 

The other important scenes are the ones with Byzantine people, from simple people to the Emperor. The decoration are somehow realistic, but it is visible that the historical truth is “modeled” for the Turkish viewers. The byzantine rooms look big but miss essential decoration, like icons, mosaics, colors, crosses. It may be understandable that do to limited budget this details are lost. Or maybe do to Muslim rules it is not pleasant to show crosses or other orthodox symbols. Funny thing is that the actors say many bad words to the “turks unbelievers”. So the Turkish viewers are motivated to hate the byzantine enemies 🙂

 

The scenes with Vatican people ( Pope and his followers) are also realistic. It is showing one true historical truth: the fact that Byzantine empire was in danger not only because of the turks but also because of the Vatican then wanted to impose the Catholic reign over Orthodox Church. And the movie show a real tension inside the Orthodox people that were more afraid of Catholics rather than Ottoman enemy.

The funny part was that in all scenes where the Pope was blessing his cardinals, the Pope made the cross like Orthodox and not like Catholics. It is a small detail, but it may rise questions if the movie is shown to Christian people. Probably for Muslim population it is ok, since they may not know the difference.

 

Then about the big cannon. Indeed this was real and was the main reason the Turks breached the Constantinople walls. But the romantic story is exaggerated. I mean the girl for that role is too ugly to start such a romantic affair. I do not understand it ! Turks have such nice girls and they choose one ugly girl, for such a big role.

The scenes with Crusaders murdering her family are strange since the girl should have hatted Catholics ( Crusaders) and not Byzantine people. But again I think that here is intended confusion between Catholics and Orthodox people made on purpose just to emphasize the movie plot.

 

The final scenes are completely out of historic sync, since the Turks enter peacefully in Saint Sophia Church and nobody dies. Even the Sultan kiss a small girl. Please ! the history say then after days and days of slaughter the sultan said that the building should not be destroyed but transformed in mosque ( probably he was thinking that it will cost too much to rebuild it from scratch),.

 

So my opinion is that this movie was made for pure propaganda and mainly for the Turks viewers.

It is actually a big trend in Turkey to revive the old Ottoman memories and to search for the former glory.

 

hard passwords but easy to remember

One of the important problems of the modern computing is the security, privacy and the personal data that must be protected .

Usually we are using passwords to protect our data or  accounts ( email, web…).  But one of the main issues is that the passwords must be easy to remember for the owner but very hard to crack for the enemy. So if we choose a password that can be easily remembered, then there is a chance that other persons know it ( like object names, famous places, books quotes…etc).

If we use hard passwords, then it is a risk that we ( owner of the data) forget the password. The alternative is to write down the hard ( complex ) password on a paper and put the paper on a hard to find place. But this solution rise also the problem of the aces to that password. We may need this password in various moments , at random places in time, when we do not have immediate access to our little paper with passwords.

An alternative is to have a easy to remember password but to code it in such a way that the results is a very complex and hard to crack password.

For the people that have access to a computer this is an easy task.

Just an example : we generate the md5sum of a password.

$ echo “password” | md5sum

286755fad04869ca523320acce0dc6a4  –

The md5sum is unique to a input and cannot be cracked. This means that based on the result you cannot recover the input.

If we need only a certain number of characters, we can trim this string to a desired length (example 10 characters), like this:

$ echo “password” | md5sum | head -c 10 ; echo

286755fad0

If we want more, we can go further. As you notice in this string there are only numbers and letters ( small cap letters ). We can now pipe the result to another level of encoding. For example base64 encoding. This type of encoding is reversible ( the input can be found based on output data). The purpose here is to introduce more variation in the string.

$ echo “password” | md5sum | base64 | head -c 25 ; echo
Mjg2NzU1ZmFkMDQ4NjljYTUyM

Here we obtain the md5sum of the “password” word and the the result is send to base64 encoding. Then the length of the string is reduced to only 25 characters.

So now we have numbers and letters ( big and small cap).

So , as you can see this results are very hard to remember and crack. But for the owner that know to make this easy steps, the solution is easier.

Now lets suppose that the enemy find the “password” word. Well, whatever he tries, he cannot take the account.

The owner will never remember the Mjg2NzU1ZmFkMDQ4NjljYTUyM password, so even if the enemy force the owner to tell him his password , he cannot get it.

 

Of course, the secret here is that the “easy to remember password” is processed so that we obtain a hard password. Of course this is just an example.

You can even encode few times the result, mds5sum again few times, cut the length, or even add special characters in certain positions. So the possibilities here are infinite.

 

So please use hard password !

the dictionary attacks are very common in our days and the computing power is rising every day. ( now the cracking tools use  also GPU for a even faster speed).

Fix GRUB2 errors with Gparted from Live Distro !

Recently a friend of mine came to me and asked me for some help with his laptop .  He is using Mint Linux ( based on Ubuntu edition 10.10) . So what happened ? During startup he pushed the power button to close fast the laptop. It is a Dell XPS 15 inch ( Intel I7 with Nvidia Optimis GPU card) with dual boot Win7 and Mint Linux.

After that the Dell laptop starts up in a GRUB prompt and not going further.
I started confident that I will fix it fast with my Linux/Grub knowledge. But to my surprize, after 4 hours of trials and errors I did not accomplished anything.

I tried the booting from USB and CD/DVD and various techniques to reinstall the GRUB. Acctualy I was able to see and access the data from HDD but I was not able to reinstall the GRUB. Each time the errors were more strange and the results was void. After each restart the GRUB prompt was there…

Then after such a long time I begin to think…
I remembered that after a partition resizing ( with Gparted tool) the pop-up menu was telling me that the Gparted tool will reconfigure the GRUB and read the new values. So I said : Why not ? Maybe it will work !

So I put the Ubuntu 12.04 Live DVD and after startup I opened the Gparted. I did not want to change to mush the partitions . So I took one partition and reduced the size with only 1Mb. The main idea is that I want Gparted to trigger the GRUB recovery ( re-install). So it did ! After resizing that 1Mb, the Grub was reinstalled and the new configuration was read. After reboot the Mint Linux was as new ! Thanks Gparted ! Acctualy I think that Gparted should habe a option ( somewhere in the menu) to fix the Grub or Boot problems. Anyway Gparted does this automatically at each partition change ( resize ).

So basically what I discovered is that is was easier to apply this method than to try all the crazy ideas found with Google. It take only 30 seconds. It is not necesary any root commands or any terminal tricks.

Gparted screen

Învață o limbă străină ! Gratis , online !

Am descoperit de curând un site ce oferă posibilitatea de a învăța câteva limbi străine.
Are interfață în românește, și în plus oferă fișierele audio și pentru download. Super !


http://www.goethe-verlag.com/book2/RO/index.htm

Totuși nu recomand folosirea doar a acestor lecții, ci și a unor manuale ( pe suport hârtie).

Spor la învățat !

make your searches anonymous

You can increase your privacy by using a search engine that do not give your IP address to bad guys, and offer also HPTTS.
But , wait ! Google is the best for search !
So why not combine the privacy with best google service ?

So use https://startpage.com

So first of all this search engine is owned by a European company ( no US jurisdiction) and offer HTTPS connection.
See settings in top right corner.

Also a Firefox plugin is available (HTTP and HTTPS ) so you can search directly from Firefox.

De ce zambea Mona Lisa …

Why Mona Lisa was smiling ….

De ce zambea Mona Lisa...