GIT Notes: Recording Changes

GIT Succinctly – free eBook from Synfusion Chapter 3 Recording Changes A ‘snapshot’ is a complete record of state of files, not of differences between other states. ‘staging’ allows you choose what changes go into the commit. To stage files, $ git add (can multiple files be listed here?) or to stage all, $ git…Read More

GIT Notes: Overview & Configuration

GIT Succinctly – free eBook from Synfusion Chapter 1 Overview working directory staging commited history development branch Chapter 2 Configuration Configuration file in home directory, $ cat ~/.gitconfig To git init a directory, $ git init &ltpath-to-directory&gt Omit path to git init current directory. Includes a directory ‘.git’. ‘clone’ downloads a complete copy of repo….Read More

Hardening SSH

SSH created key-pair More information on this topic at securing-your-server. On your local machine, create a 4096-bit RSA key-pair, $ ssh-keygen -b 4096 If you get a message to say that this already exists or to over write a file, then do not proceed, unless you want to create a new key-pair. If one exists,…Read More

Raspberry Pi 3 Express Application (part 8)

Check Node and npm are installed, $ node –version v7.4.0 $ npm –version 4.0.5 Install Express generator globally, $ npm install express-generator -g Check it, $ express –version 4.14.0 Create a new directory inside /opt/nodeserver $ mkdir tempGraph This will create several folders as well as the package.json file with all dependencies. Next install these…Read More

Raspberry Pi 3 DS18B20 Temperature Sensor (part 6)

Open /boot/config.txt $ sudo nano /boot/config.txt and add dtoverlay=w1-gpio to the end of the file. Reboot the system, $ sudo reboot Then run, $ sudo modprobe w1-gpio $ sudo modprobe w1-therm The change directory /sys/bus/w1/devices/ and list its contents, Change directory into 28-000006c87ee2 and then ‘cat w1_slave’. The ‘t=16125’ this a temperature reading of 16.125…Read More

Raspberry Pi 3 Node Server & systemd (part 5)

Run a simple Node server. Create the file and path, /opt/nodeserver/server.js const http = require(‘http’); const hostname = ‘’; // listen on all ports const port = 8080; http.createServer((req, res) => { res.writeHead(200, { ‘Content-Type’: ‘text/plain’ }); res.end(‘Hello people, I am a server \n’ + new Date().toISOString()); }).listen(port, hostname, () => { console.log(‘Server running at…Read More

Raspberry Pi 3 Static IP Address & No-ip setup (part 3)

To set up a static IP address on the Pi 3 which will remain constant inside you LAN open /etc/dhcpcd.conf $ sudo nano dhcpcd.conf Add to the bottom of this file, interface eth0 static ip_address= static routers= static domain_name_servers= interface wlan0 static ip_address= static routers= static domain_name_servers= Here is the static ip address I…Read More

Setting up gh-pages

Login to and create a new reporitory. Copy the link for this repository. It will look like this,<user-name>/<repo-name>.git On your local machine create a new directory, $ mkdir testGHpages cd into it $ cd testGHpages git init this directory $ git init Add a simple index.html file to this directory. <!doctype html> <html…Read More

D3.js Basic json Graph

Basic example of graphing using D3.js version 3 Useful links used for this post: <!DOCTYPE html> <html lang=’en’> <head> <meta charset=’utf-8′> <script src=”” type=”text/javascript”></script> <script type=”text/javascript” src=””></script> <script src=”” type=”text/javascript”></script> <script src=”” type=”text/javascript”></script> <script src=”” type=”text/javascript”></script> <link rel=”stylesheet” href=””> <link rel=”stylesheet” href=”css/tempGraph.css”> <link href=”” rel=”stylesheet” type=”text/css”> <script src=””></script> <script src=””></script> <script src=””></script> <script…Read More

Django: Multiple Pagination in a single Template

Assuming you would like to display two models in the same template each with their own pagination, here’s how to do it. def myview(): Model_one = Model.objects.all() paginator = Paginator(Model_one, 6) page = request.GET.get(‘page1’) try: Model_one = except PageNotAnInteger: Model_one = except EmptyPage: Model_one = Model_two = Model_other.objects.all() paginator = Paginator(Model_two,…Read More

Django-allauth Installation

There is a useful django-allauth video tutorial at Create third party Facebook login in Django. The document below simply follows that but only adds facebook social authentication. Documentation can be found at django-alluth documentation. django-allauth can also be installed by cloning from I am running Django 1.9.5 and will install django-allauth 0.25.2 Setup a…Read More

Part 7: Django Login, Logout & Registration

Login form: Adapted from the login tutorial at techand startup. Create a new app called ‘accounts’ $ python startapp accounts Add ‘accounts’ to INSTALLED_APPS = [ ‘accounts’, ‘django.contrib.admin’, ‘django.contrib.auth’, …………. Go to crudProject/ and add to the top of the file, from django.shortcuts import render_to_response Below that add, def loggedin(request): return render_to_response(‘registration/loggedin.html’) If you…Read More

Part 6: Django CRUD, Update

Continued from Part 5: Django CRUD, Delete Full code on We may wish to update the model ‘Members’. Let us start by adding an edit icon to the table in ‘index.html’. <td><a href=”{% url ‘edit_new’ %}”><span class=”glyphicon glyphicon-pencil”></span></a></td> If you are not using Bootstrap replace the span tags with ‘edit’. <td><a href=”{% url ‘edit_new’…Read More

Part 3: Django CRUD, Display Models

Continued from Part 2: Setting up Django, URL’s & Views Full code on Add to the crudapp/ file from django.db import models In the same file create a model called ‘Members’ with columns for ‘first_name’, ‘last_name’ and ‘description’. This is equivalent to a table called ‘Members’ with fields for ‘first_name’, ‘last_name’ and ‘description’. class Members(models.Model): first_name =…Read More

Python Dictionary into HTML Template

The following Python code will find instances of {body} in a file template.html and replace it with a string. Then a new file index.html is created with this change. with open(‘template.html’,’r’) as template_file: template = tokens = {‘title’: ‘My Title in a Dictionary’, ‘header’:’Stuff for heading’, ‘body’: ‘The body stuff’, ‘footer’: ‘This is…Read More

Simple Python into HTML

The following Python code will find instances of {body} in a file template.html and replace it with a string. Then a new file index.html is created with this change. with open(‘template.html’,’r’) as template_file: template = content = template tokens = {‘body’: ‘Body stuff can go here’} replaced = ‘Body stuff can go here.’…Read More