SOHO : Small Office Home Office
Freeware - Opensource software tips, tricks, tweaks & fixes for managing, securing, improving the performance of SOHO Desktop, Laptop, Networks

Friday, July 26, 2013

Hide post time stamp blogger homepage

Post status : incomplete

How to hide post date, time stamp and author from blogger home page only.

This can be done using conditional tags to
<span class='post-author vcard'>
<span class='post-timestamp'>
<span><data:post.dateHeader/></span>

Conditional tag syntax

<b:if cond='PUT_CONDITION_HERE'>
</b:if>
It is made up of a <b:if> tag, with a  cond attribute added. Condition is entered as the value of the cond attribute. Each (opening) <b:if> tag need to be closed with a closing </b:if> tag.

The below conditional tag is specific to homepage. I only list the opening tags here. Just make sure you include the closing </b:if> tag when applying a conditional in your template. (More list of conditional tags -- todo)
<b:if cond='data:blog.url == data:blog.homepageUrl'>

Applying conditional tag

To apply a conditional tag to a content, simply put the content between the opening <b:if cond…> and the closing </b:if>, like so:
<b:if cond='data:blog.pageType == "item"'>
CONTENT (TO BE EXECUTED IF CONDITION IS TRUE)
</b:if>
In the example above, the content will only appear on post pages.
If you want to specify a alternate content (when the condition is false), you need to insert a <b:else/> tag followed by the content, like this:
<b:if cond='data:blog.pageType == "item"'>
CONTENT 1 (TO BE EXECUTED IF CONDITION IS TRUE)
<b:else/>
CONTENT 2 (TO BE EXECUTED IF CONDITION IS FALSE)
</b:if>
You can place the conditional anywhere in your template HTML, except inside a section or inside a widget content box. The content can be a div, a section, a style tag, another conditional tag etc.

Reversing a condition
A condition can be reversed simply by replacing the comparison operator from == (is equal to) to != (is not equal to), like so:
<b:if cond='data:blog.pageType != "item"'>
CONTENT (TO BE EXECUTED IF CONDITION IS TRUE)
</b:if>
In the example above, the content will only appear on pages other than post pages (i.e. removed/hidden from post pages). This method is not applicable to Label-search and First Post conditionals.

Editing the template

Go to Dashboard > Template > edit HTML
Make sure to backup a copy before you make changes.

Search for <span class='post-timestamp'>
<span class='post-timestamp'>
                <b:if cond='data:top.showTimestamp'>
                  <data:top.timestampLabel/>
                  <b:if cond='data:post.url'>
                    <meta expr:content='data:post.canonicalUrl' itemprop='url'/>
                    <a class='timestamp-link' expr:href='data:post.url' rel='bookmark' title='permanent link'><abbr class='published' expr:title='data:post.timestampISO8601' itemprop='datePublished'><data:post.timestamp/></abbr></a>
                  </b:if>
                </b:if>
              </span>
Modifiy the code as below

<span class='post-timestamp'>
                <b:if cond='data:top.showTimestamp'>
                  <data:top.timestampLabel/>

                  <b:if cond='data:blog.url != data:blog.homepageUrl'>
                    <meta expr:content='data:post.canonicalUrl' itemprop='url'/>
                    <a class='timestamp-link' expr:href='data:post.url' rel='bookmark' title='permanent link'><abbr class='published' expr:title='data:post.timestampISO8601' itemprop='datePublished'><data:post.timestamp/></abbr></a>
                  </b:if>
                </b:if>
              </span>
Search for <span class='post-author vcard'>
<div class='post-footer-line post-footer-line-1'>
              <span class='post-author vcard'>
 <b:if cond='data:blog.url != data:blog.homepageUrl'>
                <b:if cond='data:top.showAuthor'>
                  <b:if cond='data:post.authorProfileUrl'>
                    <span class='fn' itemprop='author' itemscope='itemscope' itemtype='http://schema.org/Person'>
                      <meta expr:content='data:post.authorProfileUrl' itemprop='url'/>
                      <a expr:href='data:post.authorProfileUrl' rel='author' title='author profile'>
                        <span itemprop='name'><data:post.author/></span>
                      </a>
                    </span>
Modify the code as below
<div class='post-footer-line post-footer-line-1'>              <span class='post-author vcard'> <b:if cond='data:blog.url != data:blog.homepageUrl'>                <b:if cond='data:top.showAuthor'>                  <b:if cond='data:post.authorProfileUrl'>                    <span class='fn' itemprop='author' itemscope='itemscope' itemtype='http://schema.org/Person'>                      <meta expr:content='data:post.authorProfileUrl' itemprop='url'/>                      <a expr:href='data:post.authorProfileUrl' rel='author' title='author profile'>                        <span itemprop='name'><data:post.author/></span>                      </a>                    </span>

Search for data:post.dateHeader

To remove the date stamp above your post and only from home page, edit the template, find the below code
<b:if cond='data:post.dateHeader'>
          <h2 class='date-header'><span><data:post.dateHeader/></span></h2>
        </b:if>

 Modify it to

<b:if cond='data:blog.url != data:blog.homepageUrl'>
<b:if cond='data:post.dateHeader'>
          <h2 class='date-header'><span><data:post.dateHeader/></span></h2>
        </b:if>
</b:if>
Continue Reading...

Wednesday, July 3, 2013

Remove offending RSA key in ~/.ssh/known_hosts file with one line command

When you ssh to a server where the host key (RSA) has changed then you will get an error message as shown in the image:



The error in the above example :
Offending RSA key in /home/username/.ssh/known_hosts:8

Looking in to the error message, we can find the offending RSA key and its position in the known_hosts file. In the above example image the offending key is at  line 8. (marked with red line). This can be fixed by deleting the offending key so that ssh lets you to connect after accepting the new key. This offending RSA key from the known_hosts file can be removed using `sed` with the following parameters:

$ sed -i '8d' ~/.ssh/known_hosts

The parameters
-i   :  For inplace editing
8d : Offending RSA key at line no 8
~/.ssh/known_hosts : path to and file known_hosts.
Continue Reading...

Remote shutdown one line ssh command

Q.) How to shut down / restart  a remote linux server from ssh ?

A.)  ssh -t user@hostname 'sudo shutdown -P now'

In the above example
-t  : forces the allocation of a tty for the command.
-P : stands for power off.
-r  : to reboot.
-h : to halt. 

Also all the shutdown arguments can be passed along. To know more about shutdown options run command.
shutdown --help

Continue Reading...