I was about to choose a BaaS provider, after a quick research I found that the silver player is not materialized yet, however number of providers was more than my expectations since all what I knew was the big names only, I prepared a matrix for comparison in terms of the common features they should offer.

I’m interested to use App42, Kii or working with a big name like Parse or StackMob, whenever I use them in production I will share my experience.

Here it is!


I finally got tons of pirated movies from my friends on a HD, the movies number maybe was about 500 movies.

My problem was that which one to start with, I used to pick a name and search the Internet for the ratings, and repeat this till I get a recommended one, shit, no?!

What is nice about being a programmer? is you can help yourself 🙂

I wrote a Python script which expects the movies directory and will scan this directory and collect the movies sub-directories names and get the ratings from the Internet and sort them by rating, that’s it.

Example of the tool results:

arefaey@arefaey:~/workspace/Movies Rater: python movies-rater.py /home/arefaey/movies/
Total movies found: 236
API response had no rating for movie: The Back-Up Plan
API response had no rating for movie: Once Upon a Time in the West
API response had no rating for movie: Cowboys and Aliens
API response had no rating for movie: New folder

Rated Movies: 222

(‘The Shawshank Redemption’, 9.3)
(‘The Rite’, 9.3)
(‘The Godfather’, 9.2)
(‘Pulp Fiction’, 9.0)
(‘The Dark Knight’, 9.0)
(‘The Godfather Part II’, 9.0)
(‘Fight Club’, 8.9)
(‘Inception’, 8.8)
(‘Inception ‘, 8.8)
(‘Goodfellas’, 8.8)
(‘Saving Private Ryan’, 8.6)

Unrated Movies: 14

Even the Rain
Gnomeo and Juliet
The Back-Up Plan
Undisputed III Redemption
Like Stars on Earth
Terribly Happy
Love Likes Coincedences
Once Upon a Time in the West
Cowboys and Aliens
New folder
Born to Raise Hell 2
King of Devil’s Island

Fork me  https://github.com/montaro/movies-rater

Mikrotik Auto Login Script

Posted: November 11, 2011 in Hack!, Technical

Unfortunately, I had to subscribe to some Internet provider and found that he uses Mikrotik Proxy. First of all he restricted my access to a single MAC address, however I access the network now through 2 laptops and desktop machine simultaneously 😀 What was really annoying is that I have to create a session with the server by logging in using a username and password using their web interface every time I start my machine, so no internet connectivity unless I open my browser and login to their server..Boring :S I tried to login using Python/httplib2 using my plain username and password but it did not pay. So I inspected the Login web interface and found that the password is salted (Some HEX numbers and my password in between) then MD5ed before it is sent to server…interesting!

It was like this:

<script type="text/javascript" src="/md5.js"></script>
	<script type="text/javascript">
	    function doLogin() {
		document.sendin.username.value = document.login.username.value;
		document.sendin.password.value = hexMD5('\330' + document.login.password.value + '\155\153\216\266\076\244\006\261\251\237\164\021\307\047\212\015');
		return false;

At first I manually MD5ed my “salted” password as I found in the Login page html using Python/md5 module and tried to send it programmatically , But it failed again!

I noticed that the salt changed when I refreshed the page, so at the beginning of my script I grab the Login page html/content and using Python/re REGEX module I extracted the salt from the javascript code and added my password in between and using Python/simplejson I JSONed my POST request payload, But it failed again:S

I suspected that I miss some thing I can not see through Google Chrome Web Inspector Network sniffer, So I tried Wireshark..yes Wireshark😀 to sniff myself and found that my login POST request payload/content is encoded not JSONed, which I did not notice since Chrome Inspector viewed my POST request payload in human readable format, then I changed my code to encode the POST request content to be encoded using Python/urllib.urlencode, tried again and it SUCCEEDED this time 😉

Added the Python shebang at the start of script and added it to the Ubuntu startup programs list and my username/password passed, so I get automatically logged in every time I boot my Ubuntu 😀

You can check my code here  https://github.com/montaro/mikrotik-autologin/

I got a very simple idea when I was recharging my mobile using the normal way, scratching a card to get a secret code and either calling recharging automated service or requesting a shorthand like in Vodafone *858*secretcode#

I suggest adding the shorthand substituted with the secret code as a QR code!
Then when I scratch the card I get the QR code as an alternative way to recharge besides the code for manual recharging.

The motivation is that most of phones now have built-in QR readers or it can be installed as a third-part application, which will quickly translates the QR code to the correspondent code and you can quickly call it!

Vodafone Egypt Example:
The shorthanded code to charge with secret code *858*12345678901234#
The Generated QR code:

What do you think?

Sony Ericsson W705 Renumbering

Posted: October 8, 2011 in Technical
Tags: ,

Like all Egyptians, I had to modify all my phone book to be in-sync with the new numbering domains. First of all I tried to download the tool provided by Vodafone Engezly, After installation I ran the phone book updater, and I got a very nice message “No Contacts Need To Be Changed” :D.

A friend told me about some desktop “Windows” tool to do the job, “EgyMobiED“, I followd the steps and after some hassle I managed to backup my contacts using Windows 7 Bluetooth devices, and searched my disk till I found where does Windows 7 store them(*.VCF format files) for further Restore operation.

I tried EgyMobiED and it did the job well, Now I have to get them back to my mobile, I deleted all my contacts using Sony Ericsson PC Companion Phone Contacts tool, and tried to restore the contacts using Windows 7 Bluetooth Devices Restore Backed-up contacts and found that I have to accept each contact on my mobile (pressing accept and minimize per each contact) and I have 385 one ! :S, Moreover it failed multiple times  and I had to restart the operation and uncheck the restored contacts, So it was just like a nightmare!

I googled and found some Sony Ericsson tool called Sync Phones which requires Windows Contacts (*.CONTACT format files), So I imported my *.VCF files into Windows Contacts, and smoothly synchronized my  mobile with Windows Contacts.

Now I have all my contacts again on phone, But I found a new problem!!! 😀

My problem was historical to some extent, Since I migrated from Nokia mobile 2 years ago using the same technique (Windows 7 Bluetooth Devices tools), the imported contacts was in that format:


The Number filed was like that (TEL:0123456789), which Windows Contacts did not recognize in importing from VCF format to CONTACT format .

So I had to replace all my VCF contacts to Windows Contacts recognizable format by replacing all “TEL:” with “TEL;CELL”, So it is time for Python 😀

I quickly wrote this snippet and managed to convert my number field to recognizable one and re-synchronized my phone again, and IT WORKS 😀

Created on Oct 8, 2011

@author: arefaey
import os
src = '/home/arefaey/Desktop/src'
dest = '/home/arefaey/Desktop/dest'
inputs  = os.listdir(src)
outputs = os.listdir(dest)
for contact in inputs:
    f = os.path.join(src, contact)
    f = open(f, 'r')
    o = os.path.join(dest, contact)
    o = open(o, 'w')
    for line in f.readlines():
        line = line.replace('TEL:', 'TEL;CELL:')
    print 'Contact : %s is done' % contact

Now all contacts turned into this format:


For sure I had some victims when a VCF file contains both “TEL:” and “TEL;CELL:” so after refactoring I had duplicate CELL fields and the mobile just recognized the first, isA I will implement a new snipped to resolve this issue :D.

Thanks Ayman for your nice tool.

Ubuntu system wide Equalizer

Posted: March 20, 2011 in Technical
Tags: ,

For Ubuntu 10.10:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update && sudo apt-get install pulseaudio-equalizer

For previous versions:

After Installation you can find the Equaliser in the Main Menue Application / Sound & Video / PulseAudio Equaliser

Pulse Audio Equalizer Image

Have fun 😉

Hello world!

Posted: March 15, 2011 in Me

Since we start learning any new technology with a Hello World Project, This is my Hello World blog post 😉