Optimize linux battery life

Ubuntu/Debian : sudo apt install tlp

to start it : sudo tlp start

to show stat : sudo tlp stat

Long time no see wordpress ! been busy lately.

Ruby spaceship operator <=>

The spaceship operator is general comparison operator. The <=> operator compares 2 values and returning -1, 0, or 1 depending on whether the first value is less than, equal, or greater than the second.

Example in irb.

This operator is used on ruby range operation , objects must implement <=> and succ method to perform range operation. Lets test the a numeric value for these methods.

Keep learning ruby on 2021.

Sqlite3 slow commit solution

Sqlite3 is a great database to work with prototyping or simple web application. Recently i notice that insert to database is slow event if only inserting 1 – 10 rows. Turn out i need to change PRAGMA synchronous setting of the database which is default to 2 or FULL. In FULL mode database will issue sync command to the disk for each transaction to ensure that data is safely written. This in some case is slow.

In a modern world that a power failure is rare we dont need that all the time sync to disk things. To minimize the sync we can set to 1 or NORMAL, so sqlite will sync less often than FULL mode.

To set to NORMAL mode, execute sql command below.

PRAGMA synchronous = NORMAL;


PRAGMA synchronous = 1;

unar : Extract multipart zip files on linux

Its a shock knowing that the unzip program available on linux cant easily extract multipart zip files with ease. There is alternative program unar also available to do this task efficiently.

If u have multipart zip files as follow archive.zip.001, archive.zip.002archive.zip.003 then just execute unar archive.zip.001 and extraction will begin.

To install unar on debian/ubuntu based linux : sudo apt install unar.

Soon enough goodbye november and welcome december, go away pandemic.

Vim : change current working directory

When we work with vim, usually it will start with our current home directory. If we want to change global working directory of vim to the current edited file, we can do by executing :cd %:p:h and it will show the directory it changed to. To change only for the current window we can do :lcd %:p:h. I like to use :split command to edit minimal 2 file and :lcd will come handy if we will work on multiple directory also.

Thats all. Keep it simple. Step by step.

OpenBSD 6.8 released !

Hi OpenBSD 6.7 users lets fire up our sysupgrade command !

Seamless upgrade experience once more time from OpenBSD.

Happy 25th Anniversary to OpenBSD.