Posts

Showing posts from March, 2019

A command-line tool to turn web pages into beautifully formatted PDFs

Image
Installation   percollate  needs Node.js version 8.6.0 or later, as it uses new(ish) JavaScript syntax. If you get  SyntaxError: Unexpected token  errors, check your Node version with  node --version . You can install  percollate  globally: # using npm npm install -g percollate # using yarn yarn global add percollate To keep the package up-to-date, you can run: # using npm, upgrading is the same command as installing npm install -g percollate # yarn has a separate command yarn global upgrade --latest percollate Usage  Run  percollate --help  for a list of available commands. For a particular command,  percollate <command> --help  lists all available options. Available commands Command What it does percollate pdf Bundles one or more web pages into a PDF percollate epub Not implemented  yet percollate html Not implemented  yet Available options The  pdf ,  epub , and  html  commands have these options: Option What it does -o, -

All algorithms implemented in Python (for education)

Image
All algorithms implemented in Python (for education) These implementations are for demonstration purposes. They are less efficient than the implementations in the Python standard library. Sorting Algorithms Bubble Sort Bubble sort , sometimes referred to as  sinking sort , is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. Properties Worst case performance O(n 2 ) Best case performance O(n) Average case performance O(n 2 ) Source:   Wikipedia View the algorithm in   action Bucket   Bucket sort , or  bin sort , is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting al