s32. Enable shutdown option via policykit

To enable a given user account to shutdown and reboot in Mate or XFCE, add

# sudo nano /usr/local/etc/polkit-1/rules.d/51.restart-shutdown.rules

polkit.addRule(function (action, subject) {
  if ((action.id == "org.freedesktop.consolekit.system.restart" ||
      action.id == "org.freedesktop.consolekit.system.stop")
      && subject.isInGroup("priyadarshan")) {
    return polkit.Result.YES;
  }
});

# In case of laptop with working suspen/resume

polkit.addRule(function (action, subject) {
		   if (action.id == "org.freedesktop.consolekit.system.suspend"
      && subject.isInGroup("priyadarshan")) {
    return polkit.Result.YES;
  }
});


[s32.Read

gnome-keyring blocking ssh access

I had to connect to our servers to perform daily maintenance, but suddendly I was getting error:

ssh arc
[...]

Received disconnect from zzz.zzz.zzz.zzz port 1234:2: Too many authentication failures

# and also

sign_and_send_pubkey: signing failed: agent refused operation

I was able to login using password, with:

ssh -p 1234 -i ~/.ssh/id_rsa_id.pub -o PubkeyAuthentication=no  root@$IP

But I was unable to use our keys.… Read

Display total number of posts in WP

Display total number of posts in WordPress by shortcode [ published-posts-count ]

Add to your theme’s functions.php

// Display the total number of published posts using the shortcode [ published-posts-count ]

function customprefix_total_number_published_posts($atts) {
    return wp_count_posts('post')->publish;
}

add_shortcode('published-posts-count',
	      'customprefix_total_number_published_posts');

For pages use [ published-pages-count ]:

// Display the total number of published pages using the shortcode [ published-pages-count ]
function customprefix_total_number_published_pages($atts) {
    return wp_count_posts('page')->publish;
}

add_shortcode('published-pages-count',
	      'customprefix_total_number_published_pages');
Read

FreeBSD and Bhyve

As of 27th May 2016, bhyve UEFI now supports a frame buffer device which is accessible using VNC: https://svnweb.freebsd.org/base?view=revision&revision=300829

Good tool to manage bhyve: https://github.com/churchers/vm-bhyve

Windows install: https://people.freebsd.org/~grehan/bhyve_uefi/windows_install.txt

Interesting article: http://justinholcomb.me/blog/2016/05/28/bhyve-uefi-gop-support.htmlRead