Skip to content

Instantly share code, notes, and snippets.

View wordcount.py
input_file = open('hello.txt','r')
input_text = input_file.readlines()
total_words = sum([len(line.split()) for line in input_text])
all_words = [word for word in line.split() for line in input_text]
all_unique_words = set(all_words)
occurence = {word:all_words.count(word) for word in all_unique_words}
print occurence
@vatsalparekh
vatsalparekh / maze-solver.py
Created Apr 16, 2017
Recursive maze solver in Python
View maze-solver.py
from tabulate import tabulate
maze = [['_', '_', '#', '_', '#'],
['_', '#', '_', '_', '_'],
['_', '#', '_', '#', '_'],
['_', '_', '_', '_', '_'],
['#', '#', '#', '_', 'G']
]
maze_x = len(maze) - 1
maze_y = len(maze[0]) - 1
@vatsalparekh
vatsalparekh / wkhtmltopdf.md
Last active Jan 25, 2018
How to Install Wkhtmltopdf with patched Qt?
View wkhtmltopdf.md

The current distribution of wkhtmltopdf in apt-get is not patched with latest version Qt, hence there are many issues in wkhtmltopdf. To solve this, we can manually install updated wkhtmltopdf from official website itself.

First, install from apt-get itself, (sudo) apt-get install wkhtmltopdf

Next, download the updated file from http://wkhtmltopdf.org/downloads.html

After extracking it, copy the binary from downloaded file, to the /usr/bin, (sudo) cp /bin/wkhtmltopdf /usr/bin/