Using launchd agents to schedule scripts on macOS

Even though launchd has been around for quite some time now, I was still using crontab for scheduling some of my scripts until recently. Since launchd LaunchAgents can do much more and don’t expect your computer to be running at all times, it’s time to start using them more 😎. Let’s see how we can easily set up a LaunchAgent to run a Python script for the current user in regular intervals: ...

March 13, 2018

Load password protected Excel files into Pandas DataFrame

When trying to read an Excel file into a Pandas DataFrame gives you the following error, the issue might be that you are dealing with a password protected Excel file. pd.read_excel(PATH) [...] XLRDError: Can't find workbook in OLE2 compound document There seems to be no way of reading password protected files with xlrd. xlwings for the rescue Fortunately, there is xlwings, which lets you interact with the Excel application itself (via pywin32 or appscript). ...

February 21, 2018

Bokeh plots with Flask and AJAX

During the weekend, I discovered Bokeh, a Python visualization library for the web. The samples looked nice, so I played around a bit, mostly following the accessible Quick Start guide. Eventually, I decided to build a small dashboard with Bokeh for an existing Flask application and wanted the plots to automatically fetch data updates using AJAX requests. This meant fiddling around a bit and reading more documentation. If you plan on doing something similar, the following write-up hopefully saves you some time and pitfalls. ...

February 11, 2018

The basics of Logarithms – with examples

Logarithms are widely used in computer science (e.g. for algorithm analyses, floating point number limitations, scaling data, feature transformations). Not coming from a mathematics background (I don’t!) logarithms can seem confusing at first. Let’s look at the very basics of logarithms to get an understanding of how they can be broken apart, some of the properties that can be utilized, and why they work. What is a Logarithm? $$\log_{b}(x)$$The logarithm is defined as the inverse operation to exponentiation. To get the logarithm of a number, we need to find out, to what exponent another number, called the base, needs to be raised to produce that first number. ...

February 6, 2018

Using vi commands in your bash shell

Entering a long shell command and then moving the cursor around to correct parts of it always felt a bit clunky to me. I remembered some of the <ctrl>/<alt> key bindings but would often just end up using arrow keys or alt-click to navigate to a certain position. Today I learned that you can easily get a vi-style command line interface in bash, giving you insert and normal mode and allowing you to use a basic subset of vi commands. ...

January 28, 2018