How Install htop on Oracle Linux

Now that I would like to monitor resources on Oracle Linux for this blog host, I wanted to install htop. top does its job but I prefer htop. htop has more features I would like to utilize.

First add the yum repo that has htop.

sudo rpm -Uvh

And then install htop.

sudo yum install htop

So here is what it looks like.

From what I see, I guess there are 2 cores in one CPU and memory is 687 MB though the OCI UI says 1 GB. That said, this site is running OK without resource contention.

New Server

I’ve migrated my blog to yet another host on OCI‘s free tier host. It was much easier this time because I had all my contents into one zip file and expanded it on the new host. By Dockerizing the whole site, it completely separates data and server and makes the migration so much easier.

As a blogger (though a mediocre one) who maintains the whole thing by himself, I cannot live without this anymore. It’s really convenient and much more maintainable.

How to Setup Passwordless SSH

You may have hosts that you SSH into often and you get tired of typing password every time. You can skip typing password by having hosts remember your public key.

Make sure you’ve already created key pair by using ssh-keygen on your client machine, which generates id_rsa (private key) and (public key) under ~/.ssh directory.

Next, execute the following command to have the host remember your public key.

 cat ~/.ssh/ | ssh amaterasu48@linux-mint 'cat >> .ssh/authorized_keys'

The command above writes out the public key generated on the client machine to the remote hosts’s ~/.ssh/authorized_keys file. If you just try to SSH into the host again, you won’t be promoted to enter password again.

ssh amaterasu48@linux-mint

This is how you can setup passwordless SSH!

How to Insert Data into Sqlite Database from Python

sqlite3 module provides nice ways to deal with Sqlite database. We will cover a way to create a table and pump data into the table with a right way.

I’d recommend this nice tool called DB Browser for SQLite. This tool is very useful when you browse the data in the database and execute SQL scripts.

First, let’s create a sample table.

    def create_table_hoge(self, conn):
        cur = conn.cursor()
        cur.execute('''CREATE TABLE HOGE (
        col1 text,
        col2 VARCHAR(10)

We will pump bunch of dummy data into the table using the following code.

conn = sqlite3.connect(self.db_name)
        cur = conn.cursor()
        for i in range(1000):
            cur.execute('''INSERT INTO HOGE (col1, col2)
            VALUES (?, ?);
            ''', (f"test{i}",f"test{i+1}"))

Note that cursor.execute method takes SQL statement and the parameter values as tuple. You can see the values are being accepted with question marks and actual values are in the tuple. I haven’t tried it but it probably prevents SQL injection rather than using a straight SQL like INSERT INTO HOGE (col1, col2) VALUES (‘test1’, ‘test2’).

When I browse HOGE table with DB Browser for SQLite, it looks like the following.

How to Execute Functions Dynamically in Python

There may be times when you want to dynamically execute functions in Python.

If you want to execute function depending on conditions, you’d normally write the following code.

import unittest
class test01(unittest.TestCase):
    def test_helloworld(self):
        function_to_execute = 'foo'
        if function_to_execute == 'foo':
        elif function_to_execute == 'bar':

    def foo():
        print('hello from foo')

    def bar():
        print('hello from bar')

Writing code like that easily gets unmanageable when there are many conditions. It’s better to dynamically call functions.

import unittest

class test01(unittest.TestCase):
    def test_helloworld(self):
        function_to_execute = 'foo'
        func = getattr(test01, function_to_execute)

    def foo():
        print('hello from foo')

    def bar():
        print('hello from bar')

You might have quite a bit of functions to manage, the calling method would not be so bad by dynamically calling functions.

OCI Free Tier Means Free

This tech blog has been hosted at OCI free tier for a few weeks and Oracle has not changed me a dime. It really has been free. My WordPress site is much faster on OCI than being hosted at now.

One caveat is that I still have to pay for my own domain and hosting at but it’s a cheap service so it doesn’t hurt me too much.

It has been running very well on all Dockerized components, so this is very cool. Much faster and I have control over every single details of my site. As an engineer, this is exactly what I wanted. Though it was quite a bit of work to figure out how to get it to work, it has been totally worth it.