my net house


Cython in Easy Way, Be cool

Ok Be cool there is lot of buzzing supposed to be happened in my mind because there have to be,

Why I am going to learn about Cython?

1 . Sometimes people say my Favourite language is Damn! Slow! (which is not true if you know about Generators and futures and multiprocessing modules, Let’s just save this for some other day)

2. If I got to use it at any job any day in the field of Data-Analysis or Number-crunching computations.

3. Cyhton is Sexy, I love sexy things,:)๐Ÿ˜‰

4. Portability is good for you if you are Server administrator in day and Android-Developer at night, Or even Web-developer in Weekends.[So cython can help you everywhere]

5. You have lots of C++/C code but you can read it


Slide1> C+Python = Cython

You will not get it’s need in first place unless you are from NASA๐Ÿ˜‰


Slide2> Why we should/must love Python

{import antigravity}

Slide3> C+P….. = Cython

Do I need to learn C if I have to go with Cython?


Slide4> Cython is made for Python Programmers to achieve the Speed of C and Productivity of Python,

Aha! I feel Like I can create Whole universe now(If you understood above statement)


Slide5> Where to start if you want to write programs in Cython?

Rember (C+Python = Cython) or (Python+C = Cython)๐Ÿ˜‰

So let’s Start With Python…! yay!!


A very Simple Python Function(Don’t try at home๐Ÿ˜‰ )

def sum_text(double number_range):

“This function explains lot about my lazyness”
return sum([i*i for i in xrange(number_range)])

When you will run it in ipython uisng %timeit sum_text(100000000) function your system Can crash/hang if you don’t have good RAM like 10 GB

It will take around 15.6 seconds.

So now we need Cython to optimise it.

Again Using Ipython

cpdef double sum_text_cython(int number_range):
“This is cython(!100% but…), It works๐Ÿ˜€ ”

cdef int i
return sum([i*i for i in xrange(number_range)])

Image of above thing:


%timeit sum_text_cython(100000000)

1 loops, best of 3: 3.43 s per loop

So it is about "2.5 times" faster, Yeah!!! (That's what I mean!)

For the information this Example is Just for information, It can produce lots of other errors

Continued.... (Going for dinner) Come with monte-CarloSimulation
Now really going for dinner...

Ok Now really thing isย  we need to take things in real life, Like how to use Cython when You want to do real code in Python as well.

So Writeย  a .pyx file with simple Python code.

p = [i*i for i in xrange(number_range)]
return sum(p)

So this is simple Python thing, save it hellocython.pyx

NEVER SAVE ITย  “cython.pyx” file.

$ easycython hellocython.pyx

It will generate hellocython.c file and then also compile that into .so file.

Nextslide> So we only have Python code but Cython does understand it well.

nxtSlide> Let’s make code more faster:

def sum_text(int number_range):
cdef int i
p = [i*i for i in xrange(number_range)]
return sum(p)

This above is not even 100% pure Cython function butย  it is 2.5 times faster.๐Ÿ˜€ with .so file.

nxtslide> Now we can easily import this into our regular Python call.

create normal file.

import hellocython

print hellocython.sum_text(100000)

Now we can call Our results both Cython = C+Python

[Next is Cython using Multi-threaded] AND [Convert it into presentation] Add more Cython examples and make GitHub repository…

A reusable function

def fetch_uids(address,password,folder,d):
mail = IMAP4_SSL(‘’)
mail.login(address, password)
interval = (“%d-%b-%Y”)
result, data = mail.uid(‘search’, None,'(SENTSINCE {date})’.format(date=interval))
return data



Now I can define variables according to my project and using the function call I can make my function more reusable:

for daily analysis inbox I can call:



for daily analysis sentbox I can call:


Same as I can change the value of ‘days’ which make more sense.



ElasticSearch and Python

Ok elasticsearch: A search engine on steroids. Yeah that’s really true all the time. O it should be. I am thinking about making my own search engine to create damn awesome things. GOOGLE is so lame in these days,๐Ÿ˜›

Ok let%s talk about various things we need to know about elasticsearch.
It is as easy as abc

Read more of this post

Welcome to Human Race, You will never win, It never Ends :P

It’s kind of quite funny all the time we see people around us telling you what to do, what are you, Who you think you are but you are not that,…….,

Pretending to be like they like you or sometimes they love you.

It nice feeling all the time even when someone is saying with bad words and you know how bad those could be.

I find myself super-curious about things, Super duper and trupper.
My curiosity leads me to various things those I never thought would be so beautiful or so ugly, It seems this is life, simple,cool,nice,bumpy or just Lifeeeeeeeeeeeeeeeeeeeeeeeeeeeee………………………………….

Why sometimes we think about past, it never exist anymore,
why we even think about about Future,,,,,,,,,,,,,,,,,,?
It does not, Real thing is Present, Yes, Present!
If future is now! Just right there in-front of my eyes, then with who in this whole world we are competing? With ourselves or with Outsiders(it could be anyone)

if we are competing with outsiders that could make sense at some level, for example If I say Albert Einstein did great inventions even in the age of 24 or 25 and I am 25 and I have not done anything great yet, Oh may be that thought could help me to work hard moe=re? ummmmmmm at some level, but Einstein never learned to drive(bike or car) in his whole life, I was only 14 when I was Damn! good drivers, At this Age I might have been completed thousands of KMS by self. Now we can also consider that we can’t compare driving and Science, Yeah we can’t,๐Ÿ˜› Mad drivers kill less people than mad Scientists who have done mad inventions.(Guns,Nuclear many more…..) Even driving, cars is the invention of science. So my real point was that we can’t compete with anyone at any way.

Now other form of competition comes is compete with your self, How even I can do that? I and me both are same. I have only one soul and one body so How Can I compete myself. Is it something like improve yourself, Break your own records or do your stuff? Oh that’s really more crazy I guess,But I enjoy that! wow, Writing all the bull shit that lives in your brain on Blog is awesome.๐Ÿ˜€๐Ÿ˜€๐Ÿ˜€๐Ÿ˜›๐Ÿ˜›๐Ÿ˜›

Just a post

To many days has been passed and I have not written a single thing, That’s Rude!

Ok I am enjoying my journey of life and and as much as I can, I am learning.
Now there are few things I need to complete to achieve my Goals more securely and fast.

1. Proper Daily Schedule(Includes Exercise/Fun/Programming)
2. Balanced Diet.
3. A Daily Game, Physical Activity.
4. A new Network with Entrepreneurs.
5. A very Much Working BIM Software
6. The Great Career!

This Hostapd hotspot works for me

Flask for vitualenc

Today something happened it can be considered as bug also.
In the virtual env when I install flask after activation of virtual environment it goes to the installation successfully but when I try to “import flask” does not come up, May be problem in virtualenv of flsk bug but when I do following things do work.

You may need/not-need to use Sudo according to the Nature of your environment.

$ flask/bin/pip install flask
$ flask/bin/pip install flask-login
$ flask/bin/pip install flask-openid
$ flask/bin/pip install flask-mail
$ flask/bin/pip install flask-sqlalchemy
$ flask/bin/pip install sqlalchemy-migrate
$ flask/bin/pip install flask-whooshalchemy
$ flask/bin/pip install flask-wtf
$ flask/bin/pip install flask-babel
$ flask/bin/pip install guess_language
$ flask/bin/pip install flipflop
$ flask/bin/pip install coverage
OMG after writing too much post I did not even made smiely, here it is.๐Ÿ˜€๐Ÿ˜€๐Ÿ˜€

Instantiation Python classes

Ok I wrote a great article in instanseation Python classes but I guess it is deleted somehow.๐Ÿ˜ฆ๐Ÿ˜›

Following was the refrence for Future:

Docker and it’s promises (Only hello world)

This is quite on the way thing about Docker,

You just become about the Technology that you know you are going to use a lot for rest of your life,

Ok Lets Dock…!!

Running Docker+Django on Production is bit different then running on Development server.

At production we need WSGI, But Why Wsgi.. ? Security?

Well Security is not the only thing, But it makes lot of Sense when using WSGI, Because all the Python things does not come with Development server, They may come But having WSGI with you is far better to Play anything on Apache, Nginx or on whatever, Ok WSGI is fine to have right now..


At present I don’t want to make things not complicated for me.

When usingย  Docker there are many thing those we need to look after to build our Docker Image, But if there are already available images then we can work on that and have fun to use them for our goodness.

This Guy is awesome:

He provides everything you need to know about Docker and WSGI with Django all the time…

So WSGI is just like writing your Python scripts and run those on browser,..

A simple WSGI:file


def application(environ, start_response):
 status = '200 OK'
 output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
 ('Content-Length', str(len(output)))]
 start_response(status, response_headers)
return [output]


Create a <strong>new directory</strong> and save above file as in that directory.

Now time for <strong>Dockerization</strong>

Now in the same directory Create Dockerfile. To avoid confusion I mean to say $ nano Dockerfile

yes Dockerfile is a text file.

and add following two line:


FROM grahamdumpleton/mod-wsgi-docker:python-2.7-onbuild
CMD [ "" ]


The above lines of code say many things itself, (at least I believe that)

then run following two commands one by one: obviously๐Ÿ˜‰


docker build -t my-python-app .
docker run -it --rm -p 8000:80 --name my-running-app my-python-app


The Hello World WSGI application will now be accessible by pointing your browser at port 8000 on the Docker host.



Docker compose Docker 1.6

Ok I deployed Django Project on Server in just 50 seconds and it is as much as secore,robust and as fast as possible as it could be in real life.

There are things we need to discuss first.

Docker 1.6 uses docker-compose to deploy Django Application on the server:

What is Docker-Compose?

Compose is a tool for defining and running multi-container applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.

Ok let’s tune for more. Dockerโคโค


Get every new post delivered to your Inbox.

%d bloggers like this: