Tag: python

30 Mar

BrickNil - Control LEGO Bluetooth Sensors and Motors with Python

BrickNil [*] provides an easy way to connect to and program LEGO® Bluetooth hubs (including the PoweredUp Passenger Train 60197 and Cargo Train 60198 sets, and the Lego Duplo Steam Train 10874 and Cargo Train 10875 ) using Python on OS X and Linux. This work was inspired by this EuroBricks thread ...

30 Mar

Setting up a Raspberry Pi with Python 3.7+ using Ansible

Here's a set of Ansible playbook files to do an unattended compile of Python 3.7+ with SSL on a headless wifi-connected Raspberry Pi. A recent project of mine (bricknil) uses 3.7, and it was a little frustrating to get the default 3.5 upgraded on my Raspbian ...

28 Sep

Part 3 - Building a Fast Event-Driven Simulator for Concurrent Systems of Hardware Processes Using Curio and Python 3.6

This is the third in my series on using Curio to build an event-driven simulator for hardware processes. The first two parts can be found here: Part 1, Part 2. We're going to use the simulator framework to implement a distributed and concurrent hardware palindrome checker in less than ...

27 Sep

Part 2 - Building a Fast Event-Driven Simulator for Concurrent Systems of Hardware Processes Using Curio and Python 3.6

This is the second in my series on using Curio to build an event-driven simulator for hardware processes. (see Part 1 for the first article)

1   Enhancing the Simulator Framework

Now, we're going to make this framework a little bit more robust and less verbose when defining the system ...

22 Sep

Part 1 - Building a Fast Event-Driven Simulator for Concurrent Systems of Hardware Processes Using Curio and Python 3.6

In this post, the first in a series of three, I'm going to show you how to build an elegant simulator of a concurrent system using the amazing Curio library from David Beazley that's built on Python 3.6's async coroutine features. I hope it'll provide ...

28 Nov

How to use Python to generate extensions with a GUI for Moneydance 2017

This post describes some of my experiences writing a python extension for Moneydance, a cross-platform personal finance manager (an alternative to Intuit Quicken). I was originally attracted to this product because it runs on a Mac (albeit using a Java look and feel), uses Direct Connect to download transactions from ...

07 Nov

PhotoKeeper: Usage guide

This script will take a source directory (say the contents of a flash card from a camera), scan all the image/video file EXIFs, and sort them into date-based folders in a user-specified directory. It will optionally only copy files that have not already been copied (deduplication per folder). Photo ...

13 Oct

FundsGather -- A starter framework for scraping financial information

Currently, this program supports downloading transactions from Maryland's 529 College Savings plans and exporting to QIF, for import into your financial software like Quicken, Banktivity, or MoneyDance. An OFX/QFX plugin is also in the works.

23 Jun

Elegant command line parsing in Python using docopt, schema, and yaml

Both for my work and personal use, I tend to develop many command-line Python scripts that are very data-driven and configurable. In Python, it's pretty trivial to use argparse to support complex argument and option structures, and then use the integration with configparser to allow one to write files ...

07 Apr

OneResumé - Usage Guide

OneResumé is a data-driven resumé generator for text and Microsoft Word documents. Write your resumé content in YAML and quickly and easily generate multiple versions and formats of your resumé using this program.

30 Mar

Detecting color vs greyscale and blank pages during scanning

Recently, I needed a way to detect if a color scanned image was actually color or just contained greyscale/BW content. I also wanted to detect if an image was "blank", or just a continuous shade of one color. I couldn't really find a simple solution on the web ...

30 Mar

ScanPDF - Usage guide

If you're looking for a simple way to use a multi-page scanner and get your document into a PDF in Linux without any proprietary or commercial software, then ScanPDF might be the solution. I wrote it to quickly take the Linux SANE scanner system output image files, and process ...

24 Mar

Getting around Xcode 5.1 clang -mno-fused-madd error

Recently updated to Xcode 5.1 on my Mavericks install, and when I went to update a few Python PyPI packages like reportlab and fabric, I started hitting this error on the compile step:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

After a little bit of googling, it seems like the ...

10 Jan

AirFrame: Usage guide

Download images from an authenticated Flickr account (or local filesystem) and push them wirelessly to a Toshiba FlashAir Wifi SD card mounted in a digital photo frame.


  • Authenticates to Flickr to get ...

09 Jan

AirFrame: Hacking together a WiFi photo frame with a Toshiba FlashAir SD card and Flickr

I'm going to describe AirFrame, a Python script I wrote that's available on GitHub under ASL2 open-source, that can automatically pull photos matching a given set of tags from an authorized Flickr account, and wirelessly push them to a WiFi enabled SD card sitting inside an inexpensive digital ...

14 Nov

Starting a simple Flask app with Heroku

Flask and Heroku

Inspired by this article on Python Weekly, I thought I'd look into deploying a simple hello world application to Heroku, built on the Flask micro framework.

Here's my workflow:

  • Create a new directory and Python virtualenv (make sure virtualenvwrapper is installed!):

    cd ~/dev
    mkdir proj
    cd proj
    mkvirtualenv ...

04 Nov

Creating new notes and attaching files using Evernote's Python API

Documents to Evernote

I managed to piece together how to attach a new PDF file to an Evernote note using their Python API, so I thought it might be useful to have a post that has all of this information together in one place.  I've put together a complete example that will ...

04 Sep

PyYAML: Include yaml files within yaml files

The official YAML spec doesn't support embedding external files inside a YAML file, a feature that can be extremely useful for maintenance of long/complex YAML files. I found this great code snippet yaml-include-snippet for including other YAML files in your top-level YAML.

However, the code above assumes the ...

16 Aug

Reading and writing Microsoft Word docx files with Python


I've been wanting to script simple text scanning and substitution in Microsoft Word documents for a while now, and after a little digging, it turns out, it's fairly straight-forward to read and edit .docx (OpenXML) or the ECMA-376 original standard, and now under ISO as ISO/IEC 29500 ...

23 Jul

PyPDFOCR - Guide to Usage

  • Take a scanned PDF file and run OCR on it (using the Tesseract OCR software from Google), generating a searchable PDF
  • Optionally, watch a folder for incoming scanned PDFs and automatically run OCR on them
  • Optionally, file the scanned PDFs into directories based on simple keyword matching that you specify ...

© Virantha Ekanayake. Built using Pelican. Modified svbhack theme, based on theme by Carey Metcalfe