How to toggle between buffers in Vim with vim-airline

First if you haven’t yet heard about vim-airline plugin, and you’re a Vim user, you owe it to yourself to check it out.

By default vim-airline displays the opening buffers on the top part of the window.

So how to navigate between those buffers? Well, according to this, it seems those buffers are for visual only. To navigate between them, we can use :bp for previous buffer, and :bn for next buffer. Alternatively, we can use :ls to list all buffers, then navigate to a particular buffer by running :number (substitute number with an actual number).

However, if you know any better or more elegant ways to switch between the opening buffers, please do share!

Changing a User’s Password on FreeBSD

Before getting into how to change a user’s password on FreeBSD, let’s have a quick revision on how that can be done on a Linux system.

As a user we can change the password by typing:

$ passwd
Changing password for user kenno.
Changing password for kenno.
Current password: 
...

Or with a root account, we can change/set the password for another user:

# passwd kenno
Changing password for user kenno.
New password: 
...

How about a FreeBSD? It should be the same way as how it’s done on Linux right? Right? Well, not quite.

On a FreeBSD system, in addition to run the passwd command, we also need to generate the password databases to be “in sync” with the plain text files.

# pwd_mkdb /etc/master.passwd

You can learn more about both passwd and pwd_mkdb, by running:

$ man passwd
$ man pwd_mkdb

Ref: Can’t change user password

FreeBSD 11 Blank Screen After Login via SLiM

After rebooting my FreeBSD 11.0, I wasn’t able to login to Mate desktop manager via SLiM (Login Manager).
I spent sometimes to try to fix it, but failed. I’ll try it again later when I have a bit of free time.

Here’s a quick note of a work around, so I won’t forget what I’ve done.

1) Disable loading slim on start up by editing /etc/rc.conf and commented out the following line:

...
#slim_enable="YES
...

2) Run this command manually to start mate-session:

$ xinit mate-session

So, it appears SLiM is the culprit here since Mate-session can be started up manually.

Zpool Not Automatically Mounted on Boot on Fedora

I love ZFS, but there is something that has annoyed me for quite sometimes – the zpool doesn’t get automatically mounted on boot. To work around this, I had to login as root and run:

# zpool import tank

to import tank pool before I login with my normal user account.

Well, I finally found a solution. This is what’s written on zfsonlinux/zfs WIFI about Fedora specifically:

Systemd Update:

When upgrading to the zfs-0.6.5.8 release it’s recommended that users manually reset the zfs systemd presets. Failure to do so can result in the pool not automatically importing when the system is rebooted.

systemctl preset zfs-import-cache zfs-import-scan zfs-mount zfs-share \
zfs-zed zfs.target

Okay, here’s how I fix my issue. First, ensure that a pool that I want to automatically mounted is manually mounted first. Then just run that lengthy command shown above:

# zpool import tank
# systemctl preset zfs-import-cache zfs-import-scan zfs-mount zfs-share zfs-zed zfs.target
Created symlink /etc/systemd/system/zfs-mount.service.wants/zfs-import-cache.service → /usr/lib/systemd/system/zfs-import-cache.service.
Created symlink /etc/systemd/system/zfs.target.wants/zfs-import-cache.service → /usr/lib/systemd/system/zfs-import-cache.service.
Created symlink /etc/systemd/system/zfs-share.service.wants/zfs-mount.service → /usr/lib/systemd/system/zfs-mount.service.
Created symlink /etc/systemd/system/zfs.target.wants/zfs-mount.service → /usr/lib/systemd/system/zfs-mount.service.
Created symlink /etc/systemd/system/zfs.target.wants/zfs-share.service → /usr/lib/systemd/system/zfs-share.service.
Created symlink /etc/systemd/system/zed.service → /usr/lib/systemd/system/zfs-zed.service.
Created symlink /etc/systemd/system/zfs.target.wants/zfs-zed.service → /usr/lib/systemd/system/zfs-zed.service.

Now, that makes me a much happier ZFS user!

Ref: zfsonlinux/zfs

របៀប​លុប​អត្ថបទ​ចម្រៀង​​ចេញ​ពី​ mp3

ខ្ញុំ​មាន​បទ​ចម្រៀង mp3 ពីរ​ឬបី​ដែល​មាន​អត្ថបទ​ចម្រៀង​ភ្ជាប់ជាមួយ (embedded lyric)។ ខ្ញុំ​ចង់លុប​អត្ថបទ​នោះចេញ។

នេះ​ជា​វិធី​មួយ​ដែល​អាច​សម្រេច​បំណង​ខាងលើ ដោយប្រើកម្មវិធី​ឈ្មោះ id3v2 នៅ​លើហ្វេដ័ររ៉ា។ ឧទាហរណ៍​ថា​ ចម្រៀង​ដែល​ខ្ញុំ​ចង់លុប​អត្ថបទភ្ជាប់​នោះ​ មាន​ឈ្មោះ​ថា “01 love you.mp3” ខំម៉ានដែល​យើង​ត្រូវ​វាយ ដូច​ខាង​ក្រោម​នេះ៖

$ id3v2 --remove-frame 'TEXT' 01\ love\ you.mp3
  • --remove-frame – លុប​ id3v2 frame
  • 'TEXT'

បើសិន​ជា​យើង​មាន​ mp3 ច្រើន​ក្នុង​ directory តែ​មួយ​ ហើយយើង​ចង់​លុប​​ ‘TEXT’ frame ចេញ យើង​អាច​ប្រើ​ខំម៉ាន​ដូច​នេះ៖

$ for i in *.mp3; do id3v2 -r 'TEXT' $i; done
Deleting Frame TEXT in file 01 love you.mp3 ...
Deleting Frame TEXT in file 02 Ima demo Aitai yo….mp3 ...
Deleting Frame TEXT in file 03 Brand New World.mp3 ...

សូម​កត់​សំគាល់​ថា ក្នុង​ខំម៉ាន​ខាង​លើ ខ្ញុំ​ប្រើ -r ជំនួស​អោយ​ --remove-frame។ អផសុន​ (options) ទាំង​ពីរ​នោះ វា​ដូច​គ្នា​ទេ៕