We all strive for safety, prosperity, comfort, long life, and dullness.
Aldo Leopold
Author: abhijit
PM2 – the best process manager
In the past, on my server I’ve installed Fossil, Syncthing, Bitwarden, Inlets. All these require some form of Process Management. These programs / processes / services need to be always running, so they are restarted in case they get terminated. Also, on a system restart these need to start up automatically.
I’ve mostly used Systemd or Supervisor to all these things.
However, I recently came across PM2 and I was really blown out of my mind as to how simple it was to set it up.
Continue readingUpgrading Wallabag from 2.3 to 2.4
I had upgraded PHP from 7.2 to 7.3 on my server and suddenly Wallabag stopped working!
I got some weird error like –
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
I guessed it had something to do with the PHP upgrade. So, I decided to upgrade Wallabag as well.
That’s when the problems started!
Continue readingSimplest JavaScript & CSS minifier – YUI Compressor
I was looking for a simple JavaScript / CSS minifier. Essentially, a program which will
- minify – remove empty lines
- obfuscate – shorten variable names
There are many online tools available of course. Of the new ones, Parcel was the best. However, the resulting files had some extraneous code which I could do without.
Then I remembered about YUI Compressor, which I think is one of the first ones introduced many, many years ago.
Continue readingRuby Tips 1
There are numerous tips in Ruby but I seem to keep forgetting them and having to search for them every time. So high time I started documenting them out.
This one I learnt from 10 Tips & Tricks from Drifting Ruby. I’m only going to keep to Ruby specific ones.
Continue readingSQLite load test for concurrent transactions using JMeter and JDBC Connection
I came across this article via a Hacker News post. This mentioned that SQLite was able to handle –
400 write transactions per second, and thousands of reads
I’ve recently started implementing applications with SQLite and with journal_mode set to WAL so that multiple concurrent writes could be done. However, I was curious to confirm the concurrent transactions number.
Earlier, I have used SQLite for development but usually on production we would face challenges with the notorious Database is locked error, we would move to Postgres or MySQL. However, I’ve always felt that for 90% of the applications we create don’t require these and was keen to back it up with numbers.
So, I decided to use Apache JMeter to try load testing a sample application.
Continue readingVSCode terminal tab completion issue
I had logged into my server using VSCode the Remote-SSH extension, and had opened the terminal.
When I enter the ls
command and tab
, the files and directories auto-complete. However, when I give the mv
command, tab completion fails.
After some googling, this Stackoverflow answer helped.
In my .bashrc
file, I had to add the following lines –
# enable bash completion in interactive shells if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi
moving from LastPass to bitwarden using vaultwarden (bitwarden_rs)
I have been using LastPass for password management since like forever.
I became a paid customer in 2014. It was initially $1/month. Then it got hiked to $2/month and currently it stands at $3/month. That’s $36/year which was working out too much for me.
Furthermore, the free option is limited to a single type of device. Since I wanted to use it across desktops and mobiles, there was no option except for the $3/month plan.
I had been looking at bitwarden for quite some time now but read that it’s too resource heavy. I then came to know of biwarden_rs which is a rewrite of bitwarden in Rust and compatible with upstream Bitwarden clients. I had then forgotten about this for some time until I head the news of it being renamed to vaultwarden via a Reddit thread.
Continue readingnginx: [emerg] SSL_CTX_use_PrivateKey_file failed for GoDaddy SSL
I got this weird error while deploying an SSL certificate from GoDaddy
nginx: [emerg] SSL_CTX_use_PrivateKey_file failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: ANY PRIVATE KEY error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib)Continue reading
ruby – difference between system, exec and backticks
There are multiple ways to run system commands from Ruby.
They are system
, using backticks (‵), using %x(),
using exec
, or the more advanced option of using Open3
. All of them behave in different ways.
system
The system method calls a system program. You have to provide the command as a string argument to this method. For example:
>> system("date") Sat 4/10/2021 9:11:38 => true
Note: In Windows, the date
command also takes the input to change the system date after displaying the current system date. Press Enter
to continue
The invoked program will use the current STDIN
, STDOUT
and STDERR
objects of your Ruby program. In fact, the actual return value is either true
, false
or nil
. In the example the date was printed through the IO object of STDIN
. The method will return true if the process exited with a zero status, false if the process exited with a non-zero status and nil if the execution failed.