How to remove the first or last page of a .pdf using a Mac

I needed to remove the first and last pages of a hold lot of .pdf files on a Mac. It wasn’t that easy to find solutions and so I thought I would document the process: 1 – Install pdftk server which rather helpfully has a Mac installer: https://www.pdflabs.com/tools/pdftk-server/ Run the commands To remove the first … Read more

How to split a .pdf every 2 pages using Python

I’ve just scanned in some old copies of Trail walking magazine. I had around 150 .pdf files in a directors and needed to break the split them every two pages. I thought my python script might be useful to someone. It used pypdf which you easierly install using: The script is as follows: I hope … Read more

paramiko.SSHException: Incompatible ssh peer (no acceptable kex algorithm) ubuntu 14.04

I was trying to sftp some files using Python Paramiko on Ubuntu 14.04 and got the following error: “paramiko.SSHException: Incompatible ssh peer (no acceptable kex algorithm)”. It turns out that there is an incompatibility issue with OpenSSH 6.7 and Paramiko with a version less than 1.15.1. At the time of writing (November 2014) Ubuntu 14.04 … Read more

ImportError: No module named interactive Paramiko

If you have cut a pasted the demo.py script from Paramiko to test is working on your server then you might get this error: There isn’t a python module called interactive – you need to download the interactive.py file which is included in the same folder as the demo application.

How to setup Python Twitter Tools

I’m just playing around with Python Twitter Tools but given that I am new to Python, I can’t work out to set it up. Step 1: Download and unzip the files from: https://github.com/sixohsix/twitter Step 3: Install python-pip on your computer which is a tool for installiing Python software: apt-get install python-pip Step 4: Browse the … Read more

How to pipe Apache logs to a python script

I wanted to pipe the output of my Apache’s error logs to a Python script. To do this you need to set the a CustomLog directive in your Apache Config. Edit /etc/apache2/sites-available/default and add the following line: To read the input into Python you need to setup a non-blocking read from stdin. Obviously, this script … Read more