Category Archives: Tips

Make Gnome Title Bar Small Again

Sometimes in life greater is not always better. Here’s a config which I used to make the Gnome 3 title bar smaller.

Create a file in ~/.config/gtk-3.0/gtk.css:

headerbar.default-decoration {
    padding-top: 3px;
    padding-bottom: 3px;
    min-height: 0px;
    font-size: 0.7em;
}

headerbar.default-decoration button.titlebutton {
    padding: 0px;
    min-height: 0px;
}

Here’s how the title bar looks like before and after applying the custom css file:

Default title bar size

Default title bar size

Small title bar

Small title bar

All credits go to the folks from these links:

How to remove a user password

Sure, you Linux gurus must be laughing at me to see this post. However, this is my 2nd time needing to remove a user’s password and I had to Google for it! So here is just a quick tip to mind your truly:

# passwd -d your_username

In case you’re wondering why I need to remove a password for an account, it’s for my 4 year old daughter who enjoys playing supertuxcart. She wants to have her own user account on a Fedora 24 box without a password.

Ref: https://ask.fedoraproject.org/en/question/47102/how-to-remove-user-password/

បង្កើត RSS feeds ពី SoundCloud និង iTunes urls

ខ្ញុំ​​ចូល​ចិត្ត​ស្តាប់ ផត់ខាស់​ណាស់ ពីព្រោះវាមាន​អត្ថប្រយោជន៍​ជាច្រើន។ តើផត់ខាស​បានការអ្វី​ខ្លះ? បើសិន​ជាអ្នក​ចង់ដឹង សូម​សួរ​ក្នុង​ខំម៉ិន​ខាង​ក្រោម។

ថ្ងៃ​នេះ ខ្មុំ​ចង់ប្រាប់​របៀបបង្កើត RSS feeds ពីផត់ខាស់​ដែល​ត្រូវការ អាយធូន​ដើម្បីស្តាប់បាន។ ជាមួយ RSS feeds យើង​អាច​ប្រើ​កម្មវិធី​ផ្សេងៗ​ដូចជា អាម៉ារ៉ុក។

មុន​ដំបូង​ យើងត្រូវ​ចំលងលិង អាយធូន ហើយ​ចូល​ទៅ http://getrssfeed.com/ និង​បិទលិងនោះ។ វិបសាយ​ getrssfeed.com និង​ផ្តល់​លិងថ្មី ដែល​ជា RSS feed.

វិធីខាងលើអាច​ប្រើជាមួយ​ SoundCloud urls ផងដែរ៕

Resizing an LVM logical volume

One of the logical volumes on my desktop is running out of space. I want to add 200GB to that volume. Here is one way to achieve this task.

First a bit of warning. Don’t, or never, just copy and paste what you see here if you want to apply it to your own system. You may accidentally destroy your precious data.

# lvs
  LV      VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  backup  data   -wi-ao---- 200.00g                                                    
  scratch data   -wi-ao----   1.00t                                                    
  home    system -wi-ao----  90.00g                                                    
  root    system -wi-ao---- 100.00g                                                    
  swap    system -wi-ao----  16.00g                                                    
  tmp     system -wi-a-----   4.00g                                                    
  var     system -wi-ao----  20.00g  

Let’s check the available disk space of volume groups we can use:

# vgs
  VG     #PV #LV #SN Attr   VSize   VFree  
  data     1   2   0 wz--n-   1.82t 639.01g
  system   1   5   0 wz--n- 232.38g   2.38g

I want to resize ‘scratch’, which sits on ‘data’ volume group. There are about 639GB free on ‘data’.
Let’s give ‘data’ another 200GB.

# lvresize -rL +200G /dev/data/scratch
  Size of logical volume data/scratch changed from 1.00 TiB (262144 extents) to 1.20 TiB (313344 extents).
  Logical volume scratch successfully resized.
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mapper/data-scratch is mounted on /srv/scratch; on-line resizing required
old_desc_blocks = 64, new_desc_blocks = 77
The filesystem on /dev/mapper/data-scratch is now 320864256 (4k) blocks long.

Very the change:

# lvs data
  LV      VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  backup  data   -wi-ao---- 200.00g                                                    
  scratch data   -wi-ao----   1.20t                                                     

Now ‘scratch’ has a total of 1.20TB.

grep: error while loading shared libraries: libpcre.so.0

I have a server running CentOS 6 successfully upgraded to CentOS 7.

The only problem I encountered so far is that ‘grep’ doesn’t work.

[root@zilla ~]# grep
grep: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory
[root@zilla ~]# ldd /usr/bin/grep
        linux-vdso.so.1 =>  (0x00007ffc0b639000)
        libpcre.so.0 => not found
        libc.so.6 => /lib64/libc.so.6 (0x00007f6be1c6c000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f6be2038000)

First thing I tried was to reinstall pcre package which provides libpcre.so*. It still didn’t work. Fortunately, someone has posted a solution as the following:

[root@zilla ~]# link /usr/lib64/libpcre.so.1 /lib64/libpcre.so.0
[root@zilla ~]# grep --version
grep (GNU grep) 2.20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see .

Credit: update to Centos 7; libpcre.so.0 No such file or directory

Create bootable USB Fedora 24

Every time there is a new release of Linux distro, I need to create a bootable USB. And, I forgot how I did it last time. So, I tried by using the “Startup Disk Creator” program installed on my Ubuntu workstation, only to find out that it didn’t even work.

After a while I remember, it was just a matter of using dd command to copy the ISO image to the USB.

Here is how I did it last time for Fedora 24:

My USB is showed up as /dev/sdx, and the ISO image is: Fedora-Workstation-Live-x86_64-24-1.2.iso.

$ sudo dd if=./Fedora-Workstation-Live-x86_64-24-1.2.iso of=/dev/sdx bs=8M status=progress oflag=direct
[sudo] password for kenno: 
1541406720 bytes (1.5 GB, 1.4 GiB) copied, 648.041 s, 2.4 MB/s 
183+1 records in
183+1 records out
1541406720 bytes (1.5 GB, 1.4 GiB) copied, 650.655 s, 2.4 MB/s

That’s all I had to do. A few words of warning; make sure you double check the name of USB device detected by your counter. In my case, it was /dev/sdc, but I used /dev/sdx as an example.

For more details check out https://fedoraproject.org/wiki/How_to_create_and_use_Live_USB

How to remove a newline at end of file

Those who know me know that I don’t like Perl. Sometimes in life the thing you don’t like could be best tool/friend.

I need to remove a newline character from a text file: layouts/partials/pagination.html.

git diff layouts/partials/pagination.html
diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html
index 00c1124..d8dd981 100644
--- a/layouts/partials/pagination.html
+++ b/layouts/partials/pagination.html
@@ -15,4 +15,4 @@
         
         {{ end }}
     {{ end }}
-
\ No newline at end of file
+

The easiest way to do this is to run the following command:

$ perl -pi -e 'chomp if eof' layouts/partials/pagination.html

Thanks Perl and this Stack Overflow question.

Fedora 23/24 gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1

While updating Ansible pip package on Fedora 24 today, I got the following error message

gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory

I believe I came across this problem before when I installed a ruby gem on Centos 6 a short while back. Unfortunately, I already forgot how I’d solved it. So here’s a note to remind myself or anyone who’s having the same issue.

We need to install a package called: redhat-rpm-config.

Ref:

Installing Pip with Python 3.5 on FreeBSD

Here is a quick note serves as a self-reminder on how to get pip working or installed on FreeBSD 10.3.

# pkg install python35

There is no package for pip, at least at the time of this writing, on FreeBSD. To have it install, run the following command:

# python3.5 -m ensurepip

While you’re at it, you might as well update pip:

# pip3.5 install --upgrade pip

Thanks to this post in the FreeBSD forum: https://forums.freebsd.org/threads/52702/.

របៀបប្តូរ​ time zone ពីខំម៉ាន​ឡាញ​ក្នុង​អ៊ូប៊ុនធូ

ថ្ងៃ​នេះ ខ្ញុំ​បានទទួល Odroid-C2 ដែល​បាន​ទិញ​ពី​ Hardkernel កាលពីអាទិត្យ​មុន។ OS ដែល​អាច​ដើរលើ​វាបាន​ក្នុង​ពេលនេះ​​ មាន​តែ Ubuntu Mate 16.04 LTS ដែល​ជាបេតានៅឡើយ។

Time zone ដែល​មាន​ស្រាប់ជាដើម​គឺ EST (American Eastern Standard Time)។​ ខ្ញុំ​ត្រូវការ AEST (Australian Eastern Standard Time) ព្រោះខ្ញុំ​នៅ​ស៊ីដនី។ នេះ​ជាខំម៉ាន​ដែល​អាចផ្តូរ Time zone បានដោយ​វាយពីធើរមិណល់។

មុន​ដំបូង ឆែក​មើលមុនសិន៖

odroid64:~# date
Fri Mar 11 08:13:04 EST 2016

ប្រើខំមាន នេះ​ដើម្បី​ប្តូរ​ time zone៖

odroid64:~# dpkg-reconfigure tzdata

ជ្រើសយក​ប្រទេស រួច​ទីក្រុង។​ នេះជាលទ្ធផល៖

Current default time zone: 'Australia/Sydney'
Local time is now:      Sat Mar 12 00:13:57 AEDT 2016.
Universal Time is now:  Fri Mar 11 13:13:57 UTC 2016.

Ref: http://askubuntu.com/questions/3375/how-to-change-time-zone-settings-from-the-command-line