Check server fingerprint for scaleway

Run curl -H 'X-Auth-Token: <YOUR_TOKEN>' https://cp-ams1.scaleway.com/servers/<YOUR_SERVER_ID>/user_data/ssh-host-fingerprints compare output with results of ssh <YOUR_USER>@<YOUR_SERVER_IP> cp-ams1 needs to be changed if you use non amsterdam based server. Sources: community.online.net Scaleway API documentation

January 4, 2017 · SergeM

Raspberry Pi Links

I2C interface Description of I2C interface Raspberry Pi SPI and I2C Tutorial Continuous deployment (Russian) Непрерывная кросс компиляция на Raspberry PI Controlling motors Brushless motor Control brushless motor with ESC. Without additional controllers With PCA9685 PWM Board (stackexchange thread) One more thread Controlling multiple servos To control multiple servos you can use PCA9685 controller. Connection is shown below. It’s better to connect VCC of the controller (red wire) to +5V or raspberry or to external power supply....

December 31, 2016 · SergeM

Run docker as pytest fixture

I need to test external API or perform integration test for my application. The extenal application can be accessible through docker image. I want to write a test that has docker run as set-up step docker stop/docker rm as tear down step As an example lets consider Seaweedfs as external API. SeaweedFS is a simple and highly scalable distributed file system. To run it you need to run master and slave images....

December 19, 2016 · SergeM

Installing java 8 on linux mint 17.3

Download JDK for Java 8 from Oracle’s web-site. Unpack archive to let’s say /usr/lib/jvm/jdk1.8.0/ Update java alternatives: sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0/bin/javaws" 1 Select alternatives: sudo update-alternatives --config java Select an option corresponding to new path. Do the same for sudo update-alternatives --config javac sudo update-alternatives --config javaws Update JAVA_HOME using gksudo gedit /etc/environment Don’t forget to rerun terminal or reboot....

December 7, 2016 · SergeM

Testing json responses in Flask REST apps with pytest

Testing is an essential part of software developmnet process. Unfortunately best prictives for python are established not as good as for example in Java world. Here I try to explain how to test Flask-based web applications. We want to test endpoints behaviour including status codes and parameters encoding. It means testing of handler functions for those endpoints is not enough. Tests for endpoints can be considered/used as high-level acceptance tests....

November 27, 2016 · SergeM

Set up Travis CI for building personal page on Github Pages with Pelican

I host my notes on github pages and I use Pelican for building html content from Markdown format. Tracis CI can be used to automate building and publishing changes. Registration on https://travis-ci.org/ is straightforward. I have only public free accounts on github. Thus I need two repositories: one containing sources and another containing html. The latter is rendered automatically via Github Pages. If I would have paid hithib account I could have only one repo with two branches: master for sources and gh-pages for html....

November 27, 2016 · SergeM

Refactoring python code. Extracting variables and other.

Pycon2016 talk by Brett Slatkin Example 1: Extract variable import random month = random.choice(MONTHS) if (month.lower().endswith('r') or month.lower().endswith('ary')): print('%s is a good time to eat oysters' % month) elif 8 > MONTHS.index(month) > 4: print('%s is a good time to eat tomatoes' % month) else: print('%s is a good time to eat asparagus' % month) Becomes: class OystersGood: def __init__(self, month): month = month month_lowered = month.lower() self.ends_in_r = month_lowered.endswith('r') self....

October 8, 2016 · SergeM

Useful python links

Books Test-Driven Development with Python Harry Percival Python Testing with unittest, nose, pytest : eBook Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing link . Videos Outside-In TDD Harry Percival, PyCon 2016 Докеризация веб приложения на Python, Антон Егоров Thinking about Concurrency, Raymond Hettinger, Python core developer Tutorials Разработка идеального pypi пакета с поддержкой разных версий python (Rus), 2020. The Little Book of Python Anti-Patterns - an awesome collection of best practices with examples....

October 8, 2016 · SergeM

How to fix google search suggestions in Firefox in Linux Mint

there are plenty of discussions about it. I didn’t find full solution. You can add google as a search engine. But suggestions don’t work for me. My approximate solution remove standard firefox: sudo apt-get remove firefox remove search addons. Source. I am not sure if this step actually helped. TODO: Check if it is required. sudo apt-get remove mint-search-addon delete file (or rename to have a backup): ~/.mozilla/firefox/<SOMETHING>.default/search.json.mozlz4 and contents of the directory:...

September 29, 2016 · SergeM

podcasts

Soft Skills Engineering don’t speak spotlightradio

August 14, 2016 · SergeM