Skip to content
June 17, 2016 / Pratik

Creating Bookmarks in Emacs

I stumbled across a helpful video on how to make bookmarks in Emacs.

May 27, 2015 / Pratik

Building Flask’s Documentation

For those who don’t know, Flask is a micro framework for making web sites. One day, I went to Flask’s website and I encountered a 404 when I was trying to download the documentation in zipped HTML form. From time to time, I feel it is really convenient to have offline documentation. Since, I feel it’s important to have documentation offline I went off to build the documentation from Flask’s tarball. Here are the steps to build Flask’s documentation in Arch Linux.

Create a Virtual Environment for Flask and activate it

$ virtualenv2 flask-env
$ source flask-env/bin/activate

Install sphinx in that virtual environment

(flask-env)$ pip install sphinx

Install Flask in “Development Mode”

(flask-env)$ tar -zxvf Flask-0.10.1.tar.gz
(flask-env)$ cd Flask-0.10.1
(flask-env)$ python develop

Make the Documentation

(flask-env)$ make -C docs html

Go to the Freshly Built Documentation

(flask-env)$ xdg-open docs/_build/html/index.html
August 12, 2014 / Pratik

Archiving a Podcast

I wanted to archive all the episodes of a video podcast. The podcast listed all the episodes in it’s own rss feed, but didn’t include the episode number in the filename. So, I wrote a quick python script that generates a bash script, which downloads the listed episodes. That python script also adds the episode number in each filename. I went with the approach creating a bash script, to make it easier to review each filename and what’s going to be downloaded. I need to review these things, because downloading a lot of files could take a lot of time and there is a risk of naming things the wrong way.

#!/usr/bin/env python3

import xml.etree.ElementTree as etree
import math
import sys

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print('Usage ' + sys.argv[0] + ' location_of_downloaded_rss_file ')

    tree = etree.parse(sys.argv[1])
    root = tree.getroot()
    channel = root[0]
    urls = []
    current_episode_number = 0
    total_episodes = 0
    maximum_number_of_digits = 0

    for item in channel.iter('item'):
        enclosure = item.find('enclosure')

        if enclosure != None:

    total_episodes = len(urls)
    maximum_number_of_digits = int(math.log10(total_episodes))+1

    while len(urls) != 0:
        url = urls.pop()
        urlList = url.split('/')
        filename = urlList[-1]
        current_episode_number += 1
        current_episode_number_padded = str(current_episode_number).zfill(maximum_number_of_digits)

        print("wget '" + url + "' -O '" + current_episode_number_padded + '_' + filename + "' ")
August 8, 2014 / Pratik

Interesting Links

July 31, 2014 / Pratik

Interesting Links

August 11, 2013 / Pratik

Observations of Culture

I guess I’m not alone in that observation

“Obama bemoans ‘change in culture’ (and Kardashians)” USA Today

July 2, 2013 / Pratik

Directly URL of Specific Pages In PDF Files

I learned that it is possible to link to specific pages within a PDF file while looking at documentation on the Toastmasters website. The url in href attribute will use a fragment identifier. Here is an example url that will explain how to use that specific fragment identifier that identifies the page to go to:

Using this will be convenient for creating notes and other situations that involve referencing an individual page within a pdf file.


Get every new post delivered to your Inbox.