Quickly searching in bookmarks and history using address bar in Chrome

Technical
  1. Access the Chrome address bar and type chrome://settings/searchEngines.
  2. Locate the “Other search engines” section and hit the “Add” button to the right.
  3. Fill
    1. Bookmarks” into the field “Search engine“.
    2. b” into the field “Keyword“.
    3. chrome://bookmarks?q=%s” into the field “URL with %s in place of query“.
  4. Hit the “Add” button and now you get a quick bookmarks search shortcut in the address bar.
  5. To search bookmarks, access the Chrome address bar and type “b <search keyword>” and you will invoke the bookmarks search feature.
  6. Repeat steps 2 to 4 for history by filling:
    1. History” into the field “Search engine“.
    2. h” into the field “Keyword“.
    3. chrome://history?q=%s” into the field “URL with %s in place of query“.
  7. To search history, access the Chrome address bar and type “h <search keyword>” and you will invoke the history search feature.
Advertisements

Renaming a Bluetooth device in Win10

Technical

See the reply of the post dated 1/7/2016 2:34:26 AM by Hikevint.

You need to have the device connected to change the name but it will not change until you turn off the connected blue tooth device. Once it is changed it will stay until you change it again.

Shrink an LVM volume

Technical, Technology

First, boot your machine up using a SystemRescueCD.  Then follow the command sequence below.

# Make any logical volume available to Linux
vgchange -a y
# Force a filesystem check for the target volume
e2fsck -f /dev/mapper/vg_server1-lv_root
# Resize the filesystem (a safer measure is to resize it to 10% less than your target size)
resize2fs /dev/mapper/vg_server1-lv_root 90G
# Reduce the LV size (to your target size)
lvreduce -L 100G /dev/mapper/vg_server1-lv_root
# Resize the inner filesystem to fit the LV
resize2fs /dev/mapper/vg_server1-lv_root
# If you have a few LVs and you do the above for all, chances are you are left with a PV having a few fragmented LVs
# The command below sees how the LVs are arranged
pvs -v --segments /dev/sda2
# Move the fragmented LVs back to the front
pvmove --alloc anywhere /dev/sda2:<src-from>-<src-to> /dev/sda2:<dest-from>-<dest-to>
# Shrink the PV
pvresize --setphysicalvolumesize 64G /dev/sda2
# Then use GPartEd in X-windows to resize the partition
startx

References: [1] [2]

Setting savedefault option for grub in Ubuntu 13.04

Technical, Technology

Thank to kstevens.

You need to have both of these lines in /etc/default/grub:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then run sudo update-grub.

Check the entries in /boot/grub/grub.cfg and they should look something like:

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        savedefault
        insmod ext2
        set root='(hd0,5)'
        search --no-floppy --fs-uuid --set c23bb931-2d60-4f48-9086-c8dbdc7fdca6
        linux   /boot/vmlinuz-2.6.32-22-generic root=UUID=c23bb931-2d60-4f48-9086-c8dbdc7fdca6 ro splash vga=786  quiet splash
        initrd  /boot/initrd.img-2.6.32-22-generic
}

The most important line to note is savedefault.  It indicates that this menu entry will save itself as the default when selected.  Verify that this line appears under each menu entry.

Un-revoke certificate in OpenVPN

Technical, Technology

First of all, “un-revoking” is not an official term. And in PKI practice, a certificate should never be un-revoked.

However, there are cases that things get wrong and you do not want to complicate things by creating new certs.  You may consider this method.

  1. cd <whatever directory your openvpn configs are in, e.g. /etc/openvpn>/easy-rsa/keys
  2. Backup the files crl.pem and index.txt.
  3. There should be an index.txt, with certificate IDs in it. The ones starting with “V” are valid, and ones with “R” are revoked. You can edit that file, and fix the first char to “V”, and delete the third column (the revocation date). If you have more then one certificate, you should see the pattern (sequential number comes in the third column now, etc).
  4. Delete crl.pem
  5. cd ..
  6. . ./vars
  7. openssl ca -gencrl -out "crl.pem" -config "$KEY_CONFIG"
  8. You should find a new crl.pem generated in the current directory. Copy this file to the sub-folder keys.  Done!

Quick script – start VirtualBox VM in headless mode at boot time

Technical, Technology
#! /bin/sh
# /etc/init.d/StartVM
#

#Edit these variables!
VMUSER=ico
VMNAMES='browserkiosk01 browserkiosk02 browserkiosk03 browserkiosk04'
POWEROFF=acpipowerbutton
case "$1" in
 start)
 echo "Starting VirtualBox VM..."
 for vmname in $VMNAMES
 do
 sudo -H -b -u $VMUSER /usr/bin/VBoxVRDP -s "$vmname"
 sleep 30
 done
 ;;
 stop)
 echo "Saving state of Virtualbox VM..."
 for vmname in $VMNAMES
 do
 sudo -H -u $VMUSER /usr/bin/VBoxManage controlvm "$vmname" $POWEROFF
 sleep 10
 done
 ;;
 *)
 echo "Usage: /etc/init.d/StartVM {start|stop}"
 exit 1
 ;;
esac
exit 0

http://askubuntu.com/questions/57220/start-vboxheadless-vm-at-startup

Check if async I/O is enabled in CentOS

Technical, Technology

First, the command:

grep kio /proc/slabinfo

It gives output similar to this:

kioctx 24 60 384 10 1 : tunables 54 27 8 : slabdata 6 6 0
kiocb 7 15 256 15 1 : tunables 120 60 8 : slabdata 1 1 0

Look at the column header in the first line of /proc/slabinfo:

# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail>

To distinguish if async I/O is enabled, check first and second columns.  If they are non-zero, that means async I/O is enabled (disabled if all zeros).

To drill a little bit more:

  • Slab allocation is a kernel memory management mechanism to kernel memory usage more efficient, hence improving performance (http://en.wikipedia.org/wiki/Slab_allocation);
  • /proc/slabinfo stores statistics about the Slab allocation;
  • There are many data structures in /proc/slabinfo storing different statistics;
  • Among them, kioctx and kiocb are 2 data structures used to store statistics for async I/O.  Hence, if they are non-zero number of objects for <active_objs> and <num_objs>, async I/O is being used (http://chenguangblog.wordpress.com/2011/03/09/async-io/).

Quick Recipe – restoring a corrupted SVN master repo with the slave repo

Technical, Technology

With svnsync, you could set up a replica of your SVN repository.  Apart from load balancing, the slave repo is also a backup of your master repo.

When in times you’d like to recover the master (we call it the original master) from the slave, you could follow these steps:

  1. Ensure no one is committing to SVN.
  2. Trigger svnsync in all SVN slaves.
  3. Stop the master’s SVN service.
  4. Duplicate your slave repo.  We call the duplicate the new repo.
  5. Change the UUID of the new repo to that of the original master.
    svnlook uuid <path to master repo> # Gives the master's UUID
    svnadmin setuuid <path to new repo> <master's UUID>
    svnlook uuid <path to new repo> # Check if it is set correctly
  6. In physical file system, backup and move away the original master.  Move and rename the new repo to exactly that of the path of the original master.
  7. Remove the hook for the slave (in my case, the file <repo>/hooks/pre-revprop-change).
  8. Add back the hook for the master (in my case, the file <repo>/hooks/post-commit).
  9. Restart the SVN service.

References:

  1. Section “svnsync Bookkeeping” of svnbook
  2. Managing Repository UUIDs