Calculate ETA of swapoff


#!/bin/bash

COUNTER=0
SUM=0
while true; do
start=$(free | grep Swap | awk '{print $2}')
sleep 1
end=$(free | grep Swap | awk '{print $2}')
SUM=$((SUM+start-end))
COUNTER=$((COUNTER+1))
AVG_SPEED=$((SUM/COUNTER))
ETA=$((end/AVG_SPEED))
echo "Current speed: $((start-end))/kbps || Freed total: $SUM || Left: $end || Averate speed: $AVG_SPEED/kbps || ETA: $(($ETA / 3600))h $(($ETA / 60))m $(($ETA % 60))s."
done

Recovering OnePlus3, when you are not able to decrypt the device from TWRP or CM13 complains, that the password is wrong

To make TWRP work again, you need to change the encryption password using following commands:

supolicy --live 'allow vdc devpts chr_file {read write getattr ioctl}'
vdc cryptfs changepw password (the UI you want) <CURRENT_PIN(PASSWORD/PATTERN)> <NEW_PASSWORD>

Verify your password using

vdc cryptfs verifypw <NEW_PASSWORD>

Source: https://github.com/nelenkov/cryptfs-password-manager/issues/14#issuecomment-230399731

And if you are not able to unlock System UI using your password, just execute this command over adb:

rm /data/system/locksettings.db*

This will take down the lockscreen settings.

Welcome to the yet another IT blog!

Previous version of this blog was created few years ago, a lot of things changed from that time, and because of that, and because I moved to new server recently, I decided to reactivate it.

This blog will be my notepad. I think it’s a good place to put some notes about IT (mostly Linux and programming) stuff I am currently dealing with, so you will find here some explanations how thing works, bunch of useful links and command line snippets etc.