OK, so TensorFlow is the popular new computational framework from Google everyone is raving about (check out this year’s TensorFlow Dev Summit video presentations explaining its cool features). Of course, a fun way to learn TensorFlow is to play with it on your own laptop, so that you can iterate quickly and work offline (perhapse build a hot dog recognition app). In these cases a GPU is very useful for training models more quickly. There used to be a tensorflow-gpu package that you could install in a snap on MacBook Pros with NVIDIA GPUs, but unfortunately it’s no longer supported these days due to some driver issues. Luckily, it’s still possible to manually compile TensorFlow with NVIDIA GPU support. I’ve hunted through a lot of different tutorials (1, 2, 3, 4 – this last one helped me the most) to bring you this hopefully complete description of how to set everything up correctly and get deep into learning (and I know, in 2 months probably become just another one in that list of outdated tutorials, but that’s life 🙂 ).
For the sake of verbosity, I’m using a MacBook Pro 10,1 with an NVIDIA GT 650M and OS X 10.12. Hopefully, though, it will work on a couple of other configurations as well. In any case, let’s start…
Continue reading Compiling TensorFlow with GPU support on a MacBook Pro
This post was adapted from my Stack Overflow answer to a question about using single page applications (SPAs) with Django on Heroku.
Update: check out my django-spa package for a ready-to-use solution for serving SPAs from Django.
Here’s how to set up Django to serve your static files and index.html on / while still having the possibility to use Django views for the admin dashboard, registration etc.:
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.views import serve
from django.views.generic import RedirectView
urlpatterns = [
# / routes to index.html
# static files (*.css, *.js, *.jpg etc.) served on /
# (assuming Django uses /static/ and /media/ for static/media urls)
# other views still work too
Continue reading Simple way to set up Django and a SPA frontend on Heroku
We are all a bit lazy in this post-holiday period, so what better project to work on during these relaxed evenings at home, but on a home automation system. Having Docker containers on a physical device that has access to all other IoT devices in our network with exposed APIs like TVs, speakers or maybe even droids and being able to iteratively upgrade these containers gives us ample opportunity to play.
I love the elegance of resin.io’s Docker container deployment & upgrade method, so I use it a lot for hobby projects & freelance work. In this tutorial, I’ll show you how to create a Python Flask app with periodic Celery tasks for controlling your TV via the Chromecast API. All of the source code can be found in this repo. So, go get a hot cup of tea, clone the repo and let’s get started…
Source: Home automation using Python, Flask & Celery
Just trying out resin.io which is a nice new service that enables you to deploy apps to Raspberry Pi devices in a Heroku-like workflow:
git push resin master
In this post I’ll explain how I deployed a simple app that recites “N green bottles” written in Node.js to my Raspberry Pi via resin.io – without having to ssh to the Pi even once. Continue reading A talking Raspberry Pi using Resin.io
For some time now, I had a pending task of converting the latin1-encoded MySQL database powering this site into utf8. I finally managed to do it after getting some advice from the kind people at a Vienna WordPress meetup.
The essence is that out of all the methods suggested in the official documentation, what worked best for me was dumping all the data to a text file, marking up and encoding it as utf-8 in a text editor and then importing it into a new database (instead of working on the production DB) that we point the wp-config.php file to after everything is verified.
Continue reading Changing MySQL database encoding