Category Archives: Guides

Check Tensorflow Version – Raspbian

Hey everyone,

Just a quick post on how to check the Tensorflow version on Raspbian with a one-liner (assumes Python 3.x):

python3 -c 'import tensorflow as tf; print(tf.__version__)'

Check out this Stackoverflow post for more info:

Check if String Contains a Substring – Python

Hey everyone,

Just a quick post on how to check if a string contains a string in python:

if "STRINGTOFIND" in "testtesttestSTRINGTOFINDtestesttest":
# continue

Thanks to this stackoverflow post:

Arduino GPS – Ublox NEO-M8N Flight Controller GPS w/Protective Shell for PIX PX4 Pixhawk

Hey everyone,

I recently purchased this GPS unit on ebay:

Unfortunately, I didn’t do a lot of research before getting it and had a bit of trouble finding any spec sheets or documentation. Just in case anyone else has the same problem I’ve listed out everything I needed to get it running below.

This is the wiring info you’ll need for an Arduino:
– VCC: red
– GND: black
– TXD: yellow
– RXD: white
– SCL: green
– SDA: blue

And while this post is mostly targetting Arduino, the following wiring can be used for a RaspberryPi3:
– VCC: red => pi 3.3v
– GND: black => pi gnd
– TXD: yellow => pi rx (GPIO15/Pin #10)
– RXD: white => pi tx (GPIO14/Pin #08)
– SCL: green => pi scl (GPIO3/Pin #5)
– SDA: blue => pi sda (GPIO4/Pin #7)

The default baud rate was 38400.

This is the example I ended up using to get a quick test up and running. Ensure that you map the rx and tx pins correctly (arduino tx to gps rx, arduino rx to gps tx).

This sample sketch demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
static const int RXPin = 11, TXPin = 10;
static const uint32_t GPSBaud = 38400;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()

Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F("by Mikal Hart"));

void loop()
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
if (gps.encode(

if (millis() > 5000 && gps.charsProcessed() < 10) { Serial.println(F("No GPS detected: check wiring.")); while(true); } } void displayInfo() { Serial.print(F("Location: ")); if (gps.location.isValid()) { Serial.print(, 6); Serial.print(F(",")); Serial.print(gps.location.lng(), 6); } else { Serial.print(F("INVALID")); } Serial.print(F(" Date/Time: ")); if ( { Serial.print(; Serial.print(F("/")); Serial.print(; Serial.print(F("/")); Serial.print(; } else { Serial.print(F("INVALID")); } Serial.print(F(" ")); if (gps.time.isValid()) { if (gps.time.hour() < 10) Serial.print(F("0")); Serial.print(gps.time.hour()); Serial.print(F(":")); if (gps.time.minute() < 10) Serial.print(F("0")); Serial.print(gps.time.minute()); Serial.print(F(":")); if (gps.time.second() < 10) Serial.print(F("0")); Serial.print(gps.time.second()); Serial.print(F(".")); if (gps.time.centisecond() < 10) Serial.print(F("0")); Serial.print(gps.time.centisecond()); } else { Serial.print(F("INVALID")); } Serial.println(); }

Output should be something like this:

A simple demonstration of TinyGPS++ with an attached GPS module
Testing TinyGPS++ library v. 0.92
by Mikal Hart

Location: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.40
Location: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.40
LocatiaonfTGS+wh atahdSmlesiTiGS+bay .2b a at
ain Da/ie/ ai .Da/Te 1tion: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.60
Location: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.60
LocaS+bay .2b a at
ain Da/ie/ ai .Da/Te 1tion: -.aeTm1.
ti:.atTm:7cation: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:21.80
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:21.80
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.00
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.00
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.20
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.20
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.40
Locat/Te:/ an:3aTi: /1ain.atTm:7atn 3Dtie 1.cto.3teim 1.
ti: .aTim1aton: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.40
Location: -27.427368,153.028945 Date/Time: 9/10/2017 06:04:22.60
Location: -27.427368,153.028945 Datn 3Dtie 1.cto.3teim 1.

One final thing to note is that the blue light will start to flash once the GPS has a lock. You'll need a pretty open space, mine didn't work inside but got a lock within 60 seconds outside.

Let me know if you have any questions or links to better doco!

Rename all files in a directory with Sequential Numbers

Hey guys,

Just a batch script I came across that allows you to rename all files in a directory with sequential numbers. Really handy for things like tensorflow. All you need to do is create a batch file in the directory containing the following:

@echo off
setlocal EnableDelayedExpansion
set i=0
for %%a in (*.jpg) do (
    set /a i+=1
    ren "%%a" "!i!.new"
ren *.new *.jpg


Thanks to this stackoverflow post:

Using FFMPEG to create an image for every second of a video

Hey guys,

Just a quick command I found on stackoverflow to take a still image/thumbnail out of a video every second:

ffmpeg -i video.avi -r 0.01979 -f image2 output_%05d.jpg

Thanks to this stackoverflow post:

Start a Script on Startup – Raspberry Pi

Hey guys,

Just thought I’d leave a couple of links to some guides I came across for setting up boot scripts on a raspberry pi.

Quick guide on how to get them running:

How to delay the boot process until the network is available:

Running ReadTheDocs on Windows

Hey everyone,

This is a quick guide on how to setup your own readthedocs server on Windows.

Install Python 2.7:

Install virtual env using pip via command prompt (run as administrator):
c:\Python27>python.exe scripts\pip.exe install virtualenv

Create a virtual environment:
c:\Python27>scripts\virtualenv.exe c:\readthedocs
(readthedocs) c:\readthedocs\Scripts>

Create a folder and clone the repository:
(readthedocs) c:\readthedocs\Scripts>md checkouts
(readthedocs) c:\readthedocs\Scripts>cd checkouts
(readthedocs) c:\readthedocs\Scripts\checkouts>git clone
Cloning into ''...
remote: Counting objects: 47896, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 47896 (delta 19), reused 0 (delta 0), pack-reused 47843
Receiving objects: 100% (47896/47896), 37.91 MiB | 8.76 MiB/s, done.
Resolving deltas: 100% (31783/31783), done.
Checking connectivity... done.

Get and install dependencies using pip:
(readthedocs) c:\readthedocs\Scripts\checkouts>cd
(readthedocs) c:\readthedocs\Scripts\checkouts\>git clone

Ran into the following error: no module named (probably caused by having two version of python installed)
(readthedocs) c:\readthedocs\Scripts\checkouts\>c:\Python27\python.exe c:\readthedocs\Scripts\pip.exe install django --upgrade
Collecting django
Using cached Django-1.10.2-py2.py3-none-any.whl
Installing collected packages: django
Successfully installed django-1.10.2
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm

Build the database:
(readthedocs) c:\readthedocs\Scripts\checkouts\>c:\Python27\pytho
n.exe C:\readthedocs\Scripts\checkouts\\ syncdb
Operations to perform:
Synchronize unmigrated apps: allauth, messages, django_extensions, django_grav
atar, rest_framework, annoying, textclassifier, corsheaders, copyright, privacy,
django_countries, humanize, rtd_tests, haystack, doc_builder, staticfiles, rest
api, bitbucket_oauth2, bitbucket, notifications, djangosecure, pagination, githu
b, djcelery, payments
Apply all migrations: core, account, builds, gold, sessions, admin, guardian,
tastypie, messages_extends, comments, sites, contenttypes, redirects, auth, tagg
it, oauth, bookmarks, donate, projects, socialaccount
Synchronizing apps without migrations:
Creating tables...
Creating table corsheaders_corsmodel
Creating table celery_taskmeta
Creating table celery_tasksetmeta
Creating table djcelery_intervalschedule
Creating table djcelery_crontabschedule
Creating table djcelery_periodictasks
Creating table djcelery_periodictask
Creating table djcelery_workerstate
Creating table djcelery_taskstate
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying account.0001_initial... OK
Applying account.0002_email_max_length... OK
Applying admin.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying taggit.0001_initial... OK
Applying projects.0001_initial... OK
Applying builds.0001_initial... OK
Applying projects.0002_add_importedfile_model... OK
Applying bookmarks.0001_initial... OK
Applying builds.0002_build_command_initial... OK
Applying comments.0001_initial... OK
Applying core.0001_initial... OK
Applying core.0002_make_userprofile_user_a_onetoonefield... OK
Applying core.0003_add_banned_status... OK
Applying donate.0001_initial... OK
Applying donate.0002_dollar-drop-choices... OK
Applying donate.0003_add-impressions... OK
Applying donate.0004_rebase-impressions-on-base... OK
Applying donate.0005_add-geo-filters... OK
Applying donate.0006_add-geo-data... OK
Applying donate.0007_add-impression-totals... OK
Applying gold.0001_initial... OK
Applying guardian.0001_initial... OK
Applying messages_extends.0001_initial... OK
Applying sites.0001_initial... OK
Applying socialaccount.0001_initial... OK
Applying socialaccount.0002_token_max_lengths... OK
Applying oauth.0001_initial... OK
Applying oauth.0002_combine_services... OK
Applying oauth.0003_move_github... OK
Applying oauth.0004_drop_github_and_bitbucket_models... OK
Applying oauth.0005_add_account_relation... OK
Applying oauth.0006_move_oauth_source... OK
Applying oauth.0007_org_slug_nonunique... OK
Applying projects.0003_project_cdn_enabled... OK
Applying projects.0004_add_project_container_image... OK
Applying projects.0005_sync_project_model... OK
Applying projects.0006_add_domain_models... OK
Applying projects.0007_migrate_canonical_data... OK
Applying projects.0008_add_subproject_alias_prefix... OK
Applying projects.0009_add_domain_field... OK
Applying projects.0010_migrate_domain_data... OK
Applying projects.0011_delete-url... OK
Applying projects.0012_proper-name-for-install-project... OK
Applying projects.0013_add-container-limits... OK
Applying projects.0014_add-state-tracking... OK
Applying projects.0015_add_project_allow_promos... OK
Applying projects.0016_build-queue-name... OK
Applying projects.0017_add_domain_https... OK
Applying redirects.0001_initial... OK
Applying sessions.0001_initial... OK
Applying taggit.0002_auto_20150616_2121... OK
Applying tastypie.0001_initial... OK

Starting the readthedocs server:

(readthedocs) D:\Users\ChrisO>c:\Python27\python.exe C:\readthedocs\Scripts\chec
kouts\\ runserver
Performing system checks…

System check identified no issues (1 silenced).
October 21, 2016 – 11:16:17
Django version 1.8.3, using settings ‘’
Starting development server at
Quit the server with CTRL-BREAK.

Create a new readthedocsproject:
I followed this guide:

Creating the new project:
C:\readthedocs>md whatibroke
C:\readthedocs>cd whatibroke
Welcome to the Sphinx 1.3.5 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Installing a theme – sphinx_rtd_theme (optional step):
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>pip install sphinx_rtd_theme

In your file (C:\readthedocs\whatibroke\
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Building your output:
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>make html
Running Sphinx v1.3.5
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded.

Build finished. The HTML pages are in _build/html.

Thanks to the following stackoverflow post for a lot of the information here:

Unable to Access RDS Database from Elastic Beanstalk Application

Hey everyone,

I ran into a bit of an issue today where I was unable to access my RDS SQL Express instance from my .NET Elastic Beanstalk instance. I was receiving the following error:

The server was not found or was not accessible.

The solution turned out to be fairly simply thanks to this StackOverflow post:

Get your server instance security group:
– Log into AWS
– Navigate to elastic beanstalk
– Open your application instance
– Open configuration
– Open instances
– Find “server” on the page and copy the value in the “EC2 security groups” field

Add your server instance security group to your rds rules:
– Navigate to the RDS Dashboard
– Open your RDS instance
– Click on view details (left hand side or top)
– Find Security and Network
– Click on the rds-launch-wizard under security groups
– Click on inbound rules (very bottom currently)
– Add a new inbound rule with the copied security group as the source

How to Add a FontAwesome Icon using :after

Hey everyone,

Just a quick post on how to add a fontawesome icon using :after:

content: '\f00d';
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
margin: 0px 0px 0px 10px;
color: #555;
font-size: 85%;
text-decoration: none;

See this stackoverflow post for more info: