I have a few Python applications in development in a custom 'projects' directory. I want to be able to run these using 'python -m [appname]'. The easiest way to do this is by adding a .pth file to the site-packages folder of my Python environment (for me '/[userdirpath]/anaconda3/envs/[projectname]/lib/python3.5/site-packages/'). For example, I added a file called 'custom.pth' that … Continue reading Quickpost: Adding a Custom Path to Conda Environment
Starting a Python Project with Anaconda
It just so happens that on a few systems I have been using Anaconda to allow painless Python coding. For example, on Windows or non-Debian Linux I have struggled to compile packages from source. Anaconda provides a useful wrapper for the main functionality that just works on these operating systems (on my Ubuntu machine or the … Continue reading Starting a Python Project with Anaconda
Quick Post: Structuring a Python Program
One thing I've found hard about programming in Python is the jump from small scripts or iPython (now Jupyter) notebooks to fully functional programs. Many examples and online tutorials only require a single ".py" file or a series of command line or notebook entries. However, as you get more advanced and start looking at complete Flash applications or … Continue reading Quick Post: Structuring a Python Program
Quick Post: Recursive Function to Search Multi-Level Dictionary
Many APIs return JSON that is converted into a multilevel dictionary (e.g. EPO OPS). The following code snippet helps find a key (e.g. "id") that is nested within the dictionary. The function is based on this answer. To find more than the first occurrence "return" may be converted to "yield".
Twitter Robots on a Raspberry Pi
Or how to get very quickly write-restricted by Twitter. This is a short guide to playing around with the Twitter API using Python on a Raspberry Pi (or any other Linux machine). Overview The process has four general steps: - Setup a new Twitter account and create a new Twitter app; Setup the Raspberry Pi … Continue reading Twitter Robots on a Raspberry Pi
(Near) Infinite Budget iPad Karaoke
It turns out my 3-year old daughter is a big karaoke fan. She does a marvellous version of Lionel Richie's "Hello". It just so happened that this beautiful Arbiter karaoke machine was in one of our local charity shops for the princely sum of £10. (Aside: turns out Ivor Arbiter was quite an interesting fellow.) Lightbulb: … Continue reading (Near) Infinite Budget iPad Karaoke
Memory Mapping – Thoughts from the Shower
"Thoughts" can be likened to massively parallel webs of self-sustaining activation among the neural circuits of the brain. One characteristic of the brain, which enables rich across-domain representations, is the ability to arbitrarily link the results of different neuronal sub-processes. For example, when we think of "an orange" we combine at least visual, auditory, and … Continue reading Memory Mapping – Thoughts from the Shower
Git / GitHub Workflow for Raspberry Pi
A quick aide-memoire for using GitHub: Create directory with 'Project Name' in Dropbox directory (extra layer of automated backup) cd 'Project Name' git init Create / copy initial files Create .gitignore file for Project git add [Files - if all can use .] git status [Check correct] git commit -m "First Commit" Go to github.com … Continue reading Git / GitHub Workflow for Raspberry Pi
First Steps into the Quantified Self: Getting to Know the Fitbit API
Today I have been experimenting with the Fitbit API. Here are some rather amateurish steps for getting data from Fitbit's "cloud". Simple Client Setup for Public Data 1. Get and setup a Fitbit product. I have access to a set of Fitbit scales (the "Aria"). The Fitbit Force looks quite good; I may get one … Continue reading First Steps into the Quantified Self: Getting to Know the Fitbit API
Charting Energy Use with Flask
I have developed a version of the Energy Monitor from this post that instead uses Python to display the data on an internal network. The code can be found here: https://github.com/benhoyle/FlaskEnergyMeter. I use Flask to render a basic template to obtain search parameters: The code on the back-end then connects to my SQLite3 database and extracts the data … Continue reading Charting Energy Use with Flask
