Install and uninstall gnome shell extensions

Install:

sudo apt-get install chrome-gnome-shell

Now go to https://extensions.gnome.org/
Install required extensions after downloading the browser extension. In case of firefox, you may need to disable extension compatibility checking.
You can control extensions and their settings from gnome-tweak-tool

In case of serious issues preventing booting:

apt-get install --reinstall gdm3 gnome gnome-shell

You may also want to move everything from ~/.local/share/gnome-shell/extensions

The lower left corner legacy icons are an irritation. To move them, install the GNOME shell extension TopIcons. This moves the legacy tray icons shown in this bar to the main GNOME bar, up in the top right by the menu.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Extend wordpress-notification-bar wordpress plugin

So.. I was using this nice plugin called wordpress-notification-bar to show a..yea, you guessed it.. a notification bar. My use was to show the bar to tell users that to download premium content, they need to login. Unfortunately, the plugin didnt offer such an option. So I decided to extend it.

First, I tapped into the Settings page and added an option to put a checkbox to allow users to choose whether they wanted such an option:

$seed_wnb->options[ ] = array(
    "type" => "checkbox",
    "id" => "disabledloggedin",
    "label" => __( "Disable for Logged in", 'wordpress-notification-bar' ),
    "desc" => __( "Check if you want to disable the notification bar if the user is logged in.", "wordpress-notification-bar" ),
    "option_values" => array(
        '1' => __( 'Yes', 'wordpress-notification-bar' )
    )
);

Next I needed to check whether the option was enabled, and the user was logged in, and disable the bar in such a case:

if ( isset($options['disabledloggedin']) && is_user_logged_in() ) {
  return false;
}

The final patch is this:

 #diff -rupN wordpress-notification-bar wordpress-notification-bar-patched
diff -rupN wordpress-notification-bar/inc/class-plugin.php wordpress-notification-bar-patched/inc/class-plugin.php
--- wordpress-notification-bar/inc/class-plugin.php     2013-05-29 17:56:26.000000000 +0530
+++ wordpress-notification-bar-patched/inc/class-plugin.php     2016-08-20 23:10:43.000000000 +0530
@@ -17,7 +17,10 @@ class SeedProd_WordPress_Notification_Ba
                $options = get_option('seed_wnb_settings_1');


+
        if(!empty($options)){
+
+

                if(isset($options['enabled'])){
                        add_action( 'wp_enqueue_scripts', array(&$this,'render_notification_bar') );
@@ -32,6 +35,13 @@ class SeedProd_WordPress_Notification_Ba
     function render_notification_bar($hook){
        global $seed_wnb;
         $options = $seed_wnb->get_options();
+       /* Code added by Joel G Mathew, to disable notification bar if user is logged in\
+       // Dont show bar if user is logged in
+       */
+               if ( isset($options['disabledloggedin']) && is_user_logged_in() ) {
+                       return false;
+               }
+       // End of Code to disable bar if logged in

         if($hook == 'settings_page_seed_wnb' || ! is_admin() && isset($options['enabled'])){
                $button_target = '_self';
@@ -51,7 +61,7 @@ class SeedProd_WordPress_Notification_Ba
         }
     }

-    function render_css(){
+    function render_css(){
        global $seed_wnb;
        $options = $seed_wnb->get_options();

diff -rupN wordpress-notification-bar/inc/config.php wordpress-notification-bar-patched/inc/config.php
--- wordpress-notification-bar/inc/config.php   2015-10-02 13:08:38.000000000 +0530
+++ wordpress-notification-bar-patched/inc/config.php   2016-08-20 22:56:35.000000000 +0530
@@ -70,7 +70,19 @@ $seed_wnb->options[ ] = array(
         '1' => __( 'Yes', 'wordpress-notification-bar' )
     )
 );
-
+/* Code added by Joel G Mathew, to disable notification bar if user is logged in\
+        // Dont show bar if user is logged in
+        */
+$seed_wnb->options[ ] = array(
+    "type" => "checkbox",
+    "id" => "disabledloggedin",
+    "label" => __( "Disable for Logged in", 'wordpress-notification-bar' ),
+    "desc" => __( "Check if you want to disable the notification bar if the user is logged in.", "wordpress-notification-bar" ),
+    "option_values" => array(
+        '1' => __( 'Yes', 'wordpress-notification-bar' )
+    )
+);
+// End of Code to disable bar if logged in

 $seed_wnb->options[ ] = array(
     "type" => "textbox",

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Extending wordpress-notification-bar to hide notification bar if user is logged in

So I needed a notification bar to warn users that they were not logged in. This plugin was useful but it didnt have an option to hide the bar for logged-in users. So I edited it to add this functionality:

diff -rupN wordpress-notification-bar/inc/class-plugin.php wordpress-notification-bar-patched/inc/class-plugin.php
--- wordpress-notification-bar/inc/class-plugin.php 2016-08-20 20:44:25.000000000 +0530
+++ wordpress-notification-bar-patched/inc/class-plugin.php 2016-08-20 20:42:23.000000000 +0530
@@ -30,6 +30,15 @@ class SeedProd_WordPress_Notification_Ba
}

function render_notification_bar($hook){
+ /* Code added by Joel G Mathew, to disable notification bar if user is logged in\
+
+ // We need to disable in this function.
+ // Dont show bar if user is logged in
+ if ( is_user_logged_in() ) {
+ return false;
+ }
+ */
+
global $seed_wnb;
$options = $seed_wnb->get_options();

You can patch with patch -1


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Reset a forgotten Windows 7 administrator password

This post describes how to reset a forgotten Windows 7 administrator password:

First create a Windows 7 installation disc or pen drive. For pen drive, you can use Rufus.

Once you have an installation medium, boot off it. You may need to tweak the bios settings at boot to enable booting from this.

Once installation starts, choose “Repair your computer” option. Get to the command prompt, and execute the following command:

copy c:\windows\system32\sethc.exe c:\
copy c:\windows\system32\cmd.exe c:\windows\system32\sethc.exe

Reboot PC. Start windows, get to the login screen, and press Shift key 5 times to get an admin (elevated permissions) command prompt. Execute the following:

net user myuser newpwd

to change the password for the user “myuser”.

If you dont have an admin user installed, create one now:

net user /add [username] [password]

This creates the user account.

Add the new user to Admin group:

net localgroup administrators [username] /add

As a security precaution (even though Windows is inherently a security risk), always set a bios password to prevent novices from accessing your system internals. Of course, they could always open the chassis, reinsert the battery to disable the bios password. 😉


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

Unable to send email to an external mail server whose domain is configured in domain

I was facing a peculiar issue where I need to send mail to [email protected] eyrie.in was one of the virtual servers enabled in Virtualmin. So when I tested email from command line (mutt/postfix), I got this in /var/log/mail.info:

tac /var/log/mail.info | less:
May 6 07:49:55 server postfix/bounce[19314]: 26C8F41C45: sender non-delivery notification: 4D37341CD0
May 6 07:49:55 server postfix/cleanup[19312]: 4D37341CD0: message-id=<[email protected]>
May 6 07:49:55 server postfix/error[19313]: 26C8F41C45: to=, relay=none, delay=0.22, delays=0.14/0.01/0/0.07, dsn=5.1.1, status=bounced (User unknown in virtual alias table)
May 6 07:49:55 server postfix/qmgr[19274]: 26C8F41C45: from=, size=802, nrcpt=1 (queue active)

After a variety of tests, I found that the reason was because virtualmin enabled user aliases lists for all domains configured in it. There was an option hidden in to disable mail for those domains from within virtualmin. So go here:

Virtualmin > Domain > Edit virtualserver > Enabled features
Untick the following:
Mail for domain enabled?
Virus filtering enabled?
Spam filtering enabled?

Unless the latter two are disabled, you wont be able to disable mail for that domain. Once this is done, reload postfix with:

/etc/init.d/postfix reload

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.
How to disable/change new Google Chrome bookmark manager

How to disable/change new Google Chrome bookmark manager

For many, the new Chrome bookmark manager is a menace.

MWSnap004 2015-05-04, 14_03_11

For one, it’s slow. On my Fujitsu dual core Laptop, it takes 8-10 seconds to pop up after I press the star (bookmark) button on Google Chrome. If you were wondering how to disable or change back from the new Google Chrome bookmark manager, you’ve come to the right place.

Enter the following in the Chrome address bar: chrome://flags/
Search for Enable Enhanced Bookmarks Mac, Windows, Linux, Chrome OS, Android
MWSnap005 2015-05-04, 14_06_39

Change the option from Default to Disabled.
Restart your browser.

You’ll notice that you have successfully fixed the issue and changed from the new Google Chrome bookmark manager to the old one.
MWSnap006 2015-05-04, 14_09_08
Reference


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.