Skip to content

Instantly share code, notes, and snippets.

View vatsalparekh's full-sized avatar
🐶

Vatsal Parekh vatsalparekh

🐶
View GitHub Profile
@vatsalparekh
vatsalparekh / wordcount.py
Created February 8, 2018 20:14
word count
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 April 16, 2017 19:16
Recursive maze solver in Python
from tabulate import tabulate
maze = [['_', '_', '#', '_', '#'],
['_', '#', '_', '_', '_'],
['_', '#', '_', '#', '_'],
['_', '_', '_', '_', '_'],
['#', '#', '#', '_', 'G']
]
maze_x = len(maze) - 1
maze_y = len(maze[0]) - 1
@vatsalparekh
vatsalparekh / wkhtmltopdf.md
Last active January 25, 2018 05:13
How to Install Wkhtmltopdf with patched Qt?

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/