Peter's sandbox
to develop skills, share ideas and experience, etc

Volume Steps+ Magisk module

In medias res, OnePlus limits the steps of in call volumes to 7. So each step represents ~14.3% volume increase or decrease. Even on the lowest level everybody around me heard the person I had a discussion over the phone with. I searched for solutions and found I should edit the build.prop file, add 2 lines, restart the phone and done. But with Android 10 it doesn’t work that way. I can copy the mentioned file to my laptop, but can’t send it back. Internal protection mechanism. First, the system partition is read only, but even if I remounted it to have RW permissions, I got a “no space left on device” message when I tried to copy back to the original location. But there must be a way. And there is.
I found an old Magisk project, called Volume Steps Plus that is intended to do what I wanted. But it isn’t maintained anymore, the last commit was done on the 1st of January in 2019. So a few weeks ago I refurbished it and applied to be present in Magisk. Unfortunately it seems the only man who could accept it, topjohnwu, is unavailable.
In any case, if you want to add more media- or in-call volume steps on your Android device and your phone is rooted with Magisk, download Volume Steps+ and install it. Want more info? Head to README, it should tell you everything you want to know.

Symmetric and Asymmetric Encryption

Almost everybody use encryption day by day, but most of us unaware of it. Every time you open a website with HTTPS (the S stand for Secure), (after a host validation) your data is encrypted between your device and the server. But why? And how?

The reason

It’s very simple. Only you and the other party who you “talk with” should be able to read your messages, nobody else. Every data you send or receive (the text on websites, messages, pictures, videos) go through a lot of network devices until they reach their destination, and unencrypted communication can be breached by any device or person between source and the target. For example, you want to check your bank account. Naturally, you don’t want to share those details with the world; this is why every bank’s website accessible only with HTTPS (the S stands for Secure) and not pure HTTP; after your browser or application validates you are connected to the machine you really wanted to, it builds up a tunnel where every exchanged bit masked, encrypted.

What is what?

Cryptography is the method of using mathematical principles to transmit or store data securely, so only those whom are intended to have access can read and process it. The process that encodes the messages you’ll transfer into a format that cannot be understood nor read by any other device between the two parties who communicate called encryption.
The sender encrypts the date and the receiver must decrypt the message to be able to process it. For the this process, keys are being used. There are different type of keys in cryptography, but now I’ll focus how the key is shared between the parties.

Symmetric encryption

Imagine you create a password protected ZIP file. Only the one who knows this password will be able to unzip it and access the real data. If you share the file with somebody, you must share the password as well; and everybody who has that secret key is able to decrypt and encrypt. This is why it isn’t so widely used on the internet; in case somebody catches the key (the password, in this example), the data isn’t protected anymore and if you change the password you must re-share that with everybody. This is the simplest kind of encryption.

Asymmetric encryption

This cryptography uses 2 related keys, a public and a private key. Anybody can encrypt data with the public key, but only the one with the private key can decrypt that. You must protect only the private key, the public can be shared on a network because one key can be used only to encrypt or decrypt, and only the other can do the opposite. Due to this, asymmetric cryptography is widely used on the internet, especially while browsing websites (pages with HTTPS uses it, for example) or communicating (in privacy aware chat platforms) because every time you initiate a connection with a service, you can share the public key with the other party through the network and even if somebody catches that, cannot decrypt the messages you receive as long as the private key is protected.

Wrist-based or chest strap HR monitoring?

There are a lot of questions on different forums if it worth to buy an HR monitoring chest strap or the wrist-based is enough. My answer usually depends on two factors:

  1. Do you have some extra money to buy the strap?
  2. How accurate data do you want to get about your training?

If the answer is yes and accurate, my reply is: yes, definitely.

How they work?

Newer and newer watches with wrist-based HR monitoring are being released every day, and they deliver more and more accurate sensors. In their User Manual they ask you to tighten the wristband around your wrist, keep the sensors clear, unscratched, and, of course, don’t wear anything between the watch and your skin. The problem is that even if you comply with all of this, there’s a chance the watch will move, your skin get wet, things you can’t avoid when you train or run. It also worth to know the OHRM (Optical Heart Rate Monitor) checks the blood flow dynamics changes by measuring the amount of light that is scattered by the blood in your veins. It means, if the above conditions aren’t met, it’ll deliver inaccurate data.
On the other hand, the chest strap uses ECG that checks the electrical activity of the heart; it should be placed as close to your heart as possible, but due to the nature of our skin, it can read electrical changes well a few centimeters away too, and, for the same reason, even if it moves a bit the collected information is more accurate.

So, the OHRM isn’t trustworthy?

That is trustworthy, however, simply it has much more factors that can interfere the sampling and with that, the result.
I’m training for a long time now, I feel when my pulse is above 100 beats per minute. Last week I was in the gym, doing resistance training. For this sessions I don’t bring my chest strap. I checked my watch and it showed my heart beats 104 times per minute. 5 seconds later only 78 times. 2 seconds and 85 times. Then 75, and short after that 110 times. Pushing weights doesn’t require knowing your HR, but having inaccurate records for your runs may mislead you with your required sessions.

If you want to know more

Hide iTerm2's zsh notification

The preinstalled Terminal application on a Mac is very basic, at least for me. Thus, I installed iTerm2 that provides a lot of features and functions I was missing; but for a long time now, the default shell in iTerm2 is Z shell. However, I already configured my Bash and I don’t plan to switch. So, what I need to do to avoid the notification “The default interactive shell is now zsh” every time I start a new session?
The solution is very easy:
1.) open the .bash_profile in your home directory:
vi ~/.bash_profile
2.) add the below line:
export BASH_SILENCE_DEPRECATION_WARNING=1

If you ever want to see the message again, just open the above file again and delete the extra line you just added.

Silence?

In the recent 3 months 21 days I didn’t write anything here. It is because there a few things that going on. I changed role within the company, from Customer Operation Engineer I became a Software Engineer for the Hadoop project, sustaining the released versions, backporting fixes for issues and bugs, so nowadays I learn the tricks and hows of coding, Jenkins, build systems and so on.
In June we started to renew a big part of our house, with all the dis/advantage of it: dust, trash, broken tiles, missing parts of different things, reorders, new and fresh look, et cetera. Soon it’ll be done, the next is repainting the walls and when that is also finished, I’ll return and continue writing. I have ideas and a few drafts I must work on :)