How to use Docker to Deploy Jupyter with Nginx

Become a Datascience Pro – Host your own Jupyter Notebooks

“To say goodbye is to die a little.” ― Raymond Chandler, The Long Goodbye

1. Introduction

Docker is pretty cool when it comes to deployment of software. It isolates the deployed software from the host system. It does this by running a lighter version of an OS inside a container and deploying the software on top of this OS.

Continue reading “How to use Docker to Deploy Jupyter with Nginx”

Run Python Web Application in Docker using Nginx and uWsgi

Learn how to configure these components to host a python web application

“Pressure is something you feel when you don’t know what the hell you’re doing.” ― Peyton Manning

1. Introduction

Developing a web application is a major task by itself. It has many pieces that need to fit together – front-end HTML, styling in CSS and browser scripting in Javascript. In addition, the back-end also needs to be developed in a suitable server-side framework.

Continue reading “Run Python Web Application in Docker using Nginx and uWsgi”

Python Regular Expressions Tutorial – Part 2

Learn about Character Classes in python regular expressions.

“Anyone who says he can see through women is missing a lot.” ― Groucho Marx

1. Introduction

New to regular expressions? Start here.

In the last article, we covered some beginning aspects of regular expressions in python. We now continue to examine details of character classes.

Continue reading “Python Regular Expressions Tutorial – Part 2”

Python Regular Expressions Tutorial – Part 1

A Gentle Introduction to Python Regular Expressions

“Suspect each moment, for it is a thief, tiptoeing away with more than it brings.” ― John Updike, A Month Of Sundays

1. Introduction

Regular Expressions are a powerful mechanism for specifying a pattern to match a string. You can target specific segments you are interested in, and specify what it should include or exclude. In spite of all the power it provides, regular expressions are rather easy to pick-up and master. Almost every modern programming language, including python, perl, java, c/c++, javascript, etc. provide support for string manipulation using regular expressions. In this article, we show you python’s regular expression syntax with examples.

Continue reading “Python Regular Expressions Tutorial – Part 1”

Python Crypto Basics for Building a Blockchain

Basics of building a blockchain using python, part 1

“Even if you are on the right track, you’ll get run over if you just sit there.” ― Will Rogers

1. Introduction

A Blockchain is all the craze right now. With the Bitcoin price on a runaway track, everyone wants in on the bitcoin bandwagon. While buying and selling bitcoin and other cryptocurrencies is good (or bad, depending on your finances!), let us learn the basics of the technology behind these cryptocurrencies. In the process we will also attempt to come up with the building blocks of the technology starting from scratch.

Continue reading “Python Crypto Basics for Building a Blockchain”

Python How to Check if File can be Read or Written

Collection of Checks for Readable and Writable Files.

“Education is the most powerful weapon which you can use to change the world.” ― Nelson Mandela

1. Introduction

It can be a bit cumbersome at times to check for read or write permission on a file. The check might succeed but the actual operation could fail. Also, quite a few edge cases need to be covered to get a reasonable answer from such a check. In this article, we cover some issues with regards to checking read and write permission on a file.

Continue reading “Python How to Check if File can be Read or Written”

Using AES for Encryption and Decryption in Python Pycrypto

Easily incorporate strong AES encryption into your programs.

“Believe in your infinite potential. Your only limitations are those you set upon yourself.” ― Roy T. Bennett, The Light in the Heart

1. Introduction

Pycrypto is a python module that provides cryptographic services. Pycrypto is somewhat similar to JCE (Java Cryptography Extension) for Java. In our experience JCE is more extensive and complete, and the documentation for JCE is also more complete. That being said, pycrypto is a pretty good module covering many aspects of cryptography.

Continue reading “Using AES for Encryption and Decryption in Python Pycrypto”

Python itertools – ifilter, islice, imap, izip

Make your life easier with these itertools when dealing with iterables

“A lie gets halfway around the world before the truth has a chance to get its pants on.” ― Anonymous

1. Introduction

Python provides the itertools package which provides convenience functions for many common iterator operations. We have covered count(), cycle() and chain() in the first part of this series, and compress(), dropwhile(), and groupby() in the second part. In this article, we present a few examples of ifilter(), islice(), imap() and izip().

Continue reading “Python itertools – ifilter, islice, imap, izip”

Python HTTP Client using urllib2

More on downloading HTTP URLs using urllib2.

“I like the night. Without the dark, we’d never see the stars.” ― Stephenie Meyer, Twilight

1. Introduction

Python provides the well-regarded urllib2 module for opening URLs. Let us investigate some of the capabilities of this module, shall we? Note that most use cases are better served by using the higher level Requests module. However, you should know about the available options.

Continue reading “Python HTTP Client using urllib2”

Python String Formatting Examples

Learn about all the facilities available with python string formatting

“The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom.” ― Isaac Asimov


1. Introduction

String formatting in python is somewhat complicated by the fact that there are a lot of flags and options. Let us learn about them.

Continue reading “Python String Formatting Examples”