Thursday, August 20, 2015

Snippets

Git


clone with with username from Github:

git clone https://username@github.com/username/repository.git

Monday, July 27, 2015

Mqtt

MQTT

Protocol with QoS and low bandwidth requirements

Client

E.g. sensor connected to a Raspberry Pi. The client registers with the Broker over TCP on ip:port

Broker

The relay in the middle that sends the messages to the right recipients
The Client registers with broker and the Subscriber registers with the broker too.
The broker forwards the messages from the the client/sensor to the Subscriber

Install on Raspberry Pi

If you just run the following commands on the Raspberry Pi the broker will be installed:

sudo apt-get install mosquitto

sudo update-rc.d mosquitto defaults

sudo /etc/init.d/mosquitto start

Now the mosquitto server runs on port 1883 on localhost

Subscriber

The unit that needs the data from the sensor to perform the action


Python

Python uses the Paho implementation and the Mosquitto version has been deprecated, get the current Paho implementation from pip:

https://pypi.python.org/pypi/paho-mqtt

Install:

sudo pip install paho-mqtt


Saturday, January 18, 2014

Git and svn commands

Git

Local configuration file

Keep local changes in e.g. a configuration file and avoid showing it on git status

Set the bit: git update-index --skip-worktree FILENAME
remove the bit: git update-index --no-skip-worktree FILENAME

To list all files with this bit set:

git ls-files -v | grep ^S

Clone with username

git clone https://username@github.com/username/repository.git


Git svn


To push changes to repo:
git svn dcommit

to pull changes from repo:
git svn rebase