25. February 2017

How to limit amount of data downloaded by Windows 10 Updates?

Windows 10 often downloads a large volume of updates. This is not a problem when you have good connectivity. When you’re on some slower network like ADSL it might lead into problems with connectivity.

One option how to limit the amount of downloaded data by Windows 10 update is to set a connection as Metered connection.

Search for Change Wi-Fi settings in start menu:

In Wi-Fi section scroll down below list of available networks and click Advanced options.

Flip the toggle Set as metered connection to On.

Windows will limit the amount of downloaded data and it will download only necessary stuff.

20. February 2017

How to send command from Python via MQTT to RGB LED connected to ESP8266

I’ve described how to send server load as a number to MQTT in the previous article. The number could be then translated via Node-RED to command for LampESP with RGB LED. The result is simple. LED indicates server load by displaying different colors.

The other option is to deliver color command directly from the server using Python.

Just install paho-mqtt:

pip install paho-mqtt

Here is small snippet of Python code (publish_server_load.py):

#!/usr/bin/env python3

import paho.mqtt.publish as publish
import os

color = 'red'
load = os.getloadavg()[0]
if load < 0.7:
    color = 'black'
elif load < 1.5:
    color = 'blue'
elif load < 3:
    color = 'green'
elif load < 7:
    color = 'orange'

publish.single('/server/monitoring/command', color, hostname='iot.sinusgear.com')

ESP should listen to /server/monitoring. Code of LampESP 0.3 is available at GitHub.

Put this code into crontab

* * * * * /usr/local/bin/publish_server_load.py

If you’re using virtualenv the command should be:

* * * * * /opt/my-python-env3/bin/python /usr/local/bin/publish_server_load.py

18. February 2017

How to configure Two-Finger Scrolling in openSUSE KDE to behave the same way like Apple MacBook

Two-Finger scrolling in openSUSE – KDE has same default configuration like Windows 10 on Lenovo. This configuration came from old days when users were using only mouse to navigate on the web. When using touchpad it’s natural to expect that it would behave similarly to a tablet or Apple MacBook. Apple made the switch in the direction some time ago to make it more natural. For some reasons developers keep the old style on Linux and even on Windows. Luckily it is possible to change the configuration very easily.

Go to System Settings and click Hardware – Input Devices

Select Touchpad from left pane, Scrolling from the tabs and check option Reverse scrolling – Vertical. Then click Apply.

15. February 2017

GitHub unable to clone repository – Permission denied (publickey)

After upgrade to new version of SSH you may experience the following problem with return code 255:

Permission denied (public key).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

This happened to me after upgrade from Linux Mint 17 to 18.

How to diagnose the problem?

Run following command:

ssh -v git@github.com

You will see several lines of output and one of them is typically the reason. In my case it was:

...
debug1: SSH2_MSG_NEWKEYS received
debug1: Skipping ssh-dss key ~/.ssh/id_dsa - not in PubkeyAcceptedKeyTypes
...

DSA keys were disabled in SSH 7. Solution is to generate new key with different type, for example RSA.

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub

Replace your key at GitHub by newly generated one. You can re-run “ssh -v” command to check whether the communication was established correctly:

PTY allocation request failed on channel 0
Hi georgik! You've successfully authenticated, but GitHub does not provide shell access.
...
debug1: Exit status 1

That’s a good sign. The connection was established and now you can try to clone a repo.

14. February 2017

Manual import of activities to Garmin Connect

Garmin is constantly improving Garmin Connect service.

One change which occurred on February 14, 2017, was that possibility for manual upload disappeared from Activities. This feature is sometimes very handy.

It took me a while to figure out where is the new place for manual upload.

Garmin moved it to the sidebar with Profile under Import data.

They also improved the feature and now you can drag’n’drop multiple files for upload. New uploader is much more advanced.

Good job Garmin. Just next time I recommend to display changelog or small hint about changes.