Minimum Profit : A Programmer Text Editor

Minimum Profit is a text editor for programmer available to download from https://triptico.com/software/mp.html. I accidentally found this software from article related to OpenBSD and the author is the creator of this mp editor. The downloads are available in source and windows executable (Wow).

I managed to compile mp 5.38 on debian 10 using ncursesw driver which is already available on my laptop. Compilation step as follow.

Continue reading “Minimum Profit : A Programmer Text Editor”

Upgrade OpenBSD 6.6 to 6.7

This is my first time upgrading OpenBSD. Usually i do full reinstall but it just too time wasting, so i tried these step.

  1. sysupgrade
  2. pkg_add -u

sysupgrade will update your OpenBSD by rebooting and download installation package from internet (i think). Then pkg_add -u will update all of installed program (take a long time). Its a successful upgrade. Thanks to OpenBSD developer who make it so seamless and work beautifully. Great work.

Postgresql/Mysql : Selecting random rows

Let say we have a table containing famous quote and we want to show a random quote. How do that in postgresql ? Try this.

Select * from quote order by random() limit 1;

for Mysql use rand instead.

Select * from quote order by rand() limit 1;

 

Playing with Emacs – Open file, edit, save file.

Emacs is an editor, but not just it. Thats what i read on internet. Emacs like in a battle with Vim, another editor. I have play with vi so many years ago, but with emacs  it is just recently i learned to use it basic function.

Install it on ubuntu we can choose GUI or terminal version. I like the terminal version because it will be handy during my engagement with VM/Cloud which only can use terminal to manage it.

Open Emacs by typing on terminal emacs and press enter, it will show a welcome page like below.

We can move cursor to a hyperlink and press enter to go to particular subject, like tutorial or manual. Tutorial can also accessed using key combination C-h t, which mean press Ctrl and hold then press h, release keys, then press t. C is Ctrl and M is Meta (Alt/Esc).

Continue reading “Playing with Emacs – Open file, edit, save file.”

Digest Gem Ruby 2.6

Digest gem on ruby 2.6 is part of standard library. No need to do “gem install digest” anymore ! Here is proof on NetBSD 9.

Sinatra Ruby web app server on NetBSD 9

To host sinatra ruby web application on NetBSD 9 we need to install apache http server, ruby, and passenger.

To install ruby 2.6, login as root and do pkgin install ruby. This will automatically install ruby version 2.6. After installed, install sinatra and your other gems using gem install sinatra.

Next is to install apache http server. On terminal execute pkgin install apache. Copy rc.d script from /usr/pkg/share/examples/rc.d/apache to /etc/rc.d folder (this step just following after install message). Edit /etc/rc.conf and add a line containing apache=YES to enable auto start of apache on system start up.

Install passenger module to apache by executing pkgin install ap24-ruby26-passenger. After install edit /usr/pkg/etc/httpd/httpd.conf and add as follow.

LoadModule passenger_module lib/httpd/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/pkg/lib/ruby/vendor_ruby/2.6.0/phusion_passenger/locations.ini
  PassengerRuby /usr/pkg/bin/ruby26
</IfModule>

Create text file with ed

Unix alike system have ed for editing text file which is i feel strange at first. I learned some time ago to create small text file out of curiosity.

Lets try by creating a text file containing 3 lines.

  1. type ed on terminal
  2. type a then enter (a is append command in ed)
  3. type your text file content.
  4. To end input mode type . then enter on a line.
  5. Type w filename.txt then enter to save to a file.
  6. Type q to quit from ed.

Here we will show in a terminal.

OpenBSD Virtualization in Action

BSD’s recently have progress for things called virtualization. FreeBSD have BHyve, NETBSD have NVMM and OpenBSD have VMM. OpenBSD VMM have been around for 1-2 years maybe and i decided to try it now. My laptop running OpenBSD 6.6 with 4GB of RAM which is having enough spare RAM to launch a VM. First thing i download OpenBSD 6.6 ISO image. My first VM will be OpenBSD guest to make things simple.

Next, we need to enable VMD through /etc/rc.conf.local by adding “vmd_flags=”. We can also start vmd immediatelly using “rcctl start vmd”.