Scala: links

Functional programming

Building a Scala Sequence in a Functional Style


Which shoe fits you? Comparing Akka Streams, Actors, and Plain Futures

Scala – Execution Order when Mapping Over Twitter Futures


To trait, or not to trait?
Scala traits implementation and interoperability. Part I: Basics
Scala traits implementation and interoperability. Part II: Traits linearization
Scala Trait and Mixin – Points to Remember
Is Traits in Scala an Interface or an Abstract Class?

Sealed traits

Everything You Ever Wanted to Know About Sealed Traits in Scala
More on Sealed Traits in Scala
Sealed Traits & Functions Referencing Sub-classes?

Typesafe Config

Configuration library for JVM languages
Typesafe Config Features and Example Usage
Environment aware configuration with Typesafe Config



WordPress: changing permalink settings and 404 page not found

Taken from:

To be able to change permalink settings you might need to change access rights of the /var/www/html/<blogfolder>/.htaccess from 644 to 666:

### On your web server
$ cd /var/www/html/<blogfolder>
$ sudo chmod 666 .htaccess
### Do not forget to change back to 644 after you are done with permalinks
$ sudo chmod 644 .htaccess

If after changing WordPress permalink settings you get notorious “404 page not found” then check that the bold options in the <Directory /var/www/> section in the /etc/apache2/apache.conf file look like this:

<Directory /var/www/>
 Options Indexes FollowSymLinks
 AllowOverride All
 Require all granted

OpenSSL hints

  • Ubuntu 16.04 LTS
  • OpenSSL 1.0.2g 1 Mar 2016
Download server certificate
### Show certificate
$ openssl s_client -connect host:port -showcerts
### Download certificate
$ echo | openssl s_client -connect host:port 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > server.crt.pem
2-way TLS authentication test

Say, we’ve downloaded server certificate and generated your client private key and certificate. Now we want to test if everything works:

$ openssl s_client -connect hostname:port -CAfile server.crt.pem -cert client.crt.pem -key client-private.key.pem

If you private key is protected with a password you’ll be prompted to enter the password.





Raspberry Pi: Flower Care (aka MI Flower) sensor

  • Raspberry Pi 3 Model B
Flower Care sensor


Looks and feels very nice:

Be aware that there are two versions of the sensor – Chinese and  international. I saw complains on internet about chinese sensor that were bricked after software upgrade when used outside of China. It is not quite clear what exactly was bricked – mobile phone app or the sensor itself.

Python demo on Raspbery Pi

Details see on GitHub.

$ git clone
$ cd miflora/
$ . ./ 
$ python3 build
$ sudo python3 install
$ python3 C4:7C:8D:xx:xx:xx
Getting data from Mi Flora
FW: 2.7.0
Name: Flower care
Temperature: 18.3
Moisture: 27
Light: 105
Conductivity: 59
Battery: 100


Raspberry Pi: installing Mosquitto MQTT broker

  • Raspberry Pi 3 Model B

Taken from: YouTube.

$ sudo apt-get update
$ sudo apt-get dist-upgrade
### Install mosquitto
$ sudo apt-get install mosquitto
### Install mosquitto clients
$ sudo apt-get install mosquitto-clients
### Console 1
$ mosquitto_sub -t "hellomosquitto"

### Console 2
$ mosquitto_pub -t "hellomosquitto" -m "Hello, Mosquitto!"

### Console 1 will print
Hello, Mosquitto!


Raspberry Pi: cross-compile Boost libraries

  • Ubuntu 16.04 LTS
  • arm-linux-gnueabihf (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  • Raspberry Pi 3 Model B
Install toolchain

See C++ cross-compiling.

Download boost source code

Boost source on Sourceforge. In my case boost_1_63_0.tar.bz2.


Say, we need boost-iostreams, installation folder /usr/local/boost:

# Unpack the archive
$ tar --bzip2 -xf boost_1_63_0.tar.bz2
$ cd boost_1_63_0
$ ./
# In the project-config.jam file replace
# using gcc ;
# by
# using gcc : arm : arm-linux-gnueabihf-g++ ;
$ sudo ./bjam install toolset=gcc-arm --prefix=/usr/local/boost --with-iostreams


Eclipse: slow start – speed up

  • Ubuntu 16.04 LTS
  • Eclipse Neon.3 Release 4.6.3 (Eclipse IDE for C/C++ Developers)

A couple of advices from Stackoverflow work quite well – startup time reduced from tens of seconds to less than 10 seconds and HDD became much more quiet during startup.

Eclipse preferences

In Window > Preferences > General > Startup and Shutdown disable Plug-ins (if you do not use them) activated on startup:

  • Eclipse Automated Error Reporting
  • Marketplace Client
  • Mylyn Tasks UI
  • Mylyn Team UI
  • RSE UI
  • UI Responsiveness Monitoring

Add at the bottom the bold text:


The verify option enables/disables validation of all the .class files that Eclipse loads on startup.

Android Studio and IntelliJ IDEA

The verify option seems to reduce startup time of Android Studio and IntelliJ IDEA too.

Android Studio
$ cp ${ANDROID_STUDIO_DIR}/bin/*.vmoptions ~/.AndroidStudio1.5/config

Then add the verify option to the copied files as described above.

IntelliJ IDEA
$ cp ${INTELLIJ_IDEA_DIR}/bin/*.vmoptions ~/.IdeaIC2017.1/config

Then add the verify option to the copied files as described above.