http://tinkerman.cat/rpi3_iot_server.pdf (Catalan)
- download the latest image
http://tinkerman.cat/rpi3_iot_server.pdf (Catalan)
| MIT LICENSE | |
| Copyright 2018 Steve Cope | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
Using
ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20161214-ami-d8bdebb8
Prerequisities:
If running MacOS, docker-nvidia is not available, therefore you need a first host machine.
| import subprocess | |
| def uptime(): | |
| raw = subprocess.check_output('uptime').replace(',','') | |
| days = int(raw.split()[2]) | |
| if 'min' in raw: | |
| hours = 0 | |
| minutes = int(raw[4]) | |
| else: | |
| hours, minutes = map(int,raw.split()[4].split(':')) |
This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.
Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.
Use the Raspberry Pi Configuration tool or sudo raspi-config to:
##Run install_syncthing.sh
$ curl -s https://gist.githubusercontent.com/hdml/7b079c114d3e20bf69f1/raw/1cd3647b1db4f80726c145fba725e27993a7fcdb/install_syncthing.sh | sudo bash
Start syncthing
$ syncthing
Wait until you get something like:
| import thread, mosquitto, random, time | |
| # mosquitto reference and download can be found here: http://mosquitto.org/documentation/python/ | |
| class mqtt(): | |
| def __init__(self, broker = "127.0.0.1", port = 1883, clientID = None): | |
| self.__broker = broker | |
| self.__port = port | |
| self._client = None | |
| self.__subscriptionsList = [] | |
| self.__pendingSubscriptionsList = [] |
| #!/usr/bin/python | |
| """Example of MQTT client (subscriber) using Mosquitto | |
| Authored by Daniel Shih <hotingwow@gmail.com> | |
| """ | |
| from mosquitto import Mosquitto | |
| from sys import argv | |
| from socket import gethostname |
| #!/usr/bin/python | |
| # | |
| #simple app to read string from serial port | |
| #and publish via MQTT | |
| # | |
| #uses the Python MQTT client from the Mosquitto project | |
| #http://mosquitto.org | |
| # | |
| #Andy Piper http://andypiper.co.uk | |
| #2011/09/15 |