Show Calendar On A Terminal/Shell

If there is a need to show calendar on terminal/shell we can use cal command.

Here is how to show current month and any month on same year with current month.

Show future and past calendar can too

Wow … usefull huh … and to show current date we can use date command …

 

JVM Heap Size

if you get low memory error when running java program then try to look heap size flags with this command.

java -XX:+PrintFlagsFinal -version | grep HeapSize

To see all JVM flags just run the command without the grep.

play with doas system utility

Openbsd have doas to enable user execute program as another user. This is similar to linux’s sudo but actually doas is much simpler because most user dont use 99% of sudo features ( i read that on internet …)

man page for doas (man doas)

doas need configuration files /etc/doas.conf

man doas.conf to see detail and sample

i set my user to be able to execute all program as root in my doas.conf

test the setting by doing ls to /root

without doas, ls /root will fail with error message permission denied.

with doas, ls /root will run just OK.

so is it the same like sudo or not ?

hmmmm …

 

My H2 database server setup on OpenBSD

im using h2 database, a pure java database to some of my project.

i like to put h2 database file to a folder under my home.

i also create a file to start the server. Dont forget to chmod the file as executable.

see screen capture below for detail

try to start h2 server as below

h2 server process will automatically call default browser showing login screen

try to connect using tcp method to localhost

its work !

Activate apmd

OpenBSD 6.1 dont activate apmd by default.

To enable it at start edit your /etc/rc.conf.local and add apmd_flags setting.

example above, apmd option -L used to set performance to low performance.

after restarting our computer, we can see it effect by using apm command

done. good night.

Mengubah Tanggal di OpenBSD (Set Date Time )

Mengubah tanggal dan waktu di OpenBSD melalui shell bisa menggunakan perintah sbb :

date yyyyMMddhhmm

misalkan mau mengubah ke tanggal 25 may 2017 jam 15:27 maka lakukan sbb :

su digunakan untuk mendapatkan wewenang root supaya perintah date tidak gagal. Asumsinya kita login menggunakan user biasa ya …

simple !

fswebcam

Berawal dari penasaran apakah bisa OpenBSD 6.1 mengenali webcam yang ada di laptop acer 1810TZ keluaran 2007 ( jadul ).

Saya coba lihat dulu keluaran dmesg dan cari apakah ada terdeteksi webcam dan ternyata ada.

Ternyata webcam nya buatan Chicony.

Kemudian install fswebcam dengan pkg_add

Langkah selanjutnya adalah mencoba program fswebcam itu setelah baca-baca dulu caranay di man fswebcam

Capture dan simpan gambarnya di file jpg sbb :

Coba buka file hasil capture webcam

Kurang cahaya ….

Selesai

Howto connect my Wifi

If you have a wifi on your laptop you can connect manually by :

  1. login as root or do su
  2. ifconfig [device] nwid [network name] wpakey [password]
  3. dhclient [device]

Device example is iwn0, vlan0,alc0 (see man ifconfig for detailed option available)

To automatically connect after boot we need to do as follow :

  1. edit /etc/hostname.[device name]
  2. set parameter
  3. save file

pretty easy huh …

Run cmd.exe under the local system account

Some time we need to debug a program which run using cmd.exe under system account(NT AUTHORITY\SYSTEM).

We can use psexec program from sysinternals’ PsTools to achieve this.

To use it, put pstools folder on your system path and execute

psexec -i -s cmd.exe

where arguments -i if for interactive and -s is for system account