Installing IPython Notebook on OS X

If you do not know what is IPython Notebook, please checkout the link here – IPython is an awesome tool that allows you to combine Python codes with rich text to create meaningful & interactive contents.

Here’s a quick demonstration:

In this post, I am going to share what I did to setup IPython Notebook on my OS X. These are the commands I used. Homebrew was used to install libraries/dependencies. Pip was used to install Python packages.

If you use the same commands and everything works fine, you will have a working installation of IPython Notebook. You can launch the notebook web server using the following command:

This will launch the server and open your default web browser :) Please note that the notebook will use your current directory as the root while displaying the files and directories. I created a dedicated directory inside my Google Drive to store my notebooks. So I created an alias for always starting the notebook server pointed to that directory. I put this in my .zshrc:

Now from any place, I can issue this command to run the server:

I am currently playing with both IPython and the IPython Notebook. Both are awesome :)

Tessel: Review

Tessel is a micro controller that runs JavaScript. It is NodeJS compatible – that means you can take advantages of npm and all the NodeJS awesomeness with it. The key attraction for me was the built in Wifi, makes it very easy to connect to the internet. Tessel has a good collection of modules which you can connect to the board to extend it’s functionality. The modules are listed here: Each module has a dedicated npm package. You just have to install the package and require it to interact with the module. Cool, no?

I ordered a Tessel from their website on June 14. I got the board at hand today, July 20. They shipped via DHL global mail.

Here’s the tessel main board:

Tessel Main Board

I also purchased a GPRS module to interact with mobile networks. Here’s a photo of the module connected to the main board:

Tessel with GPRS Module

Setting It Up

Setting up was easy. I already has NodeJS installed. I installed the tessel command line tool.

After tessel is installed, I tried listing the devices:

Then I copied the example blinking codes and tried them out. All worked fine. So my tessel was working! Then I tried listing the available wifi networks:

I connected to my home wifi:

It connected to the Wifi just like that! Awesome!

Then I tested out the instructions on the “Tweet” section which uses the recently connected WiFi to send out a tweet.

The WiFi is working excellent!

The GPRS Module

Now I connected the GPRS module and tested out the sample codes. I used a spare Banglalink SIM to send out the SMS. It turns out that you don’t need to type the number in international format. The 017******** format works too :)


Just a quick note: If you follow the official example (it sends a text on gprs.ready event), and then kill the process by hitting Ctrl + C, you might have issues controlling the GPRS module without restarting it. So I think for testing, we can use the Tessel REPL from the command line:

Moving Your PHP Projects to Vagrant

If you have read my last blog post, I have chosen to use one Linux box to locally develop web applications. In the last post, I discussed how I setup the Python/Django environment. In this one, I’m going to talk about PHP.

As usual, I installed the LAMP server:

I have all my PHP projects in “~/Sites”, I wanted to serve them from there. So removed the www directory.

Then I added my ~/Sites directory as a synced folder to be mounted as /var/www in the linux guest box. www-data is the user and group permission on these directories so Apache has no issues handling them.

My updated vagrant file:

Upgraded PHP to PHP 5.5 and installed PHPMyAdmin:

Updated my /etc/hosts to update the local dev domains to the IP address of the vagrant box :)

Python and Django on Vagrant

Well, this is going to be another straight forward post with loads of shell commands. The background is simple, I love OS X for the many apps it offers but at the same time I always had the joy of developing on a Linux machine. I decided to use Vagrant to have one central box for my projects. I use separate vagrant boxes for complicated projects. But didn’t like the idea of having individual boxes for simple ones.

I work on Python and Django a lot. So in this post I am going to document my setup.

Vagrant File:

# I have assigned a private IP to the box
# I have assigned a hostname to it.
# I am using Ubuntu Precise Pangolin 64 bit as my base box (which I already have added)

Hosts File (/etc/hosts):

After I setup the box, I logged in using SSH:

Now, the usual Ubuntu setup.

Bash Profile in the Ubuntu machine:

# To make the Django built in server available from outside the box I need to run it on so that it listens on all interfaces. So I added a handy alias.

# Added the virtualenv stuff to the profile

Bootstrapping a project:

Now the app would be available on:

I also modify the ~/.virtualenvs//bin/postactivate script to cd into the project source directory. Saves time when I hit “workon env_name”

That’s it :)