<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>timer &#8211; Accidents Happen</title>
	<atom:link href="https://ah.thameera.com/tag/timer/feed/" rel="self" type="application/rss+xml" />
	<link>https://ah.thameera.com</link>
	<description>In the dark</description>
	<lastBuildDate>Wed, 30 Oct 2013 15:11:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">56521109</site>	<item>
		<title>Countdown timer shell script</title>
		<link>https://ah.thameera.com/countdown-timer-shell-script/</link>
					<comments>https://ah.thameera.com/countdown-timer-shell-script/#respond</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Wed, 30 Oct 2013 15:11:43 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[timer]]></category>
		<guid isPermaLink="false">http://ah.thameera.com/?p=509</guid>

					<description><![CDATA[I made a small countdown script for the shell. It goes as follows: Some tricks used in the script include: echo -ne "blah blah \r" was used to write in the same line over and over That 19800 is the time difference from GMT 0.0 in seconds. In Sri Lanka, it&#8217;s 5.30 hrs. Yes, we&#8217;re [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I made a small countdown script for the shell. It goes as follows:</p>
<style>.gist table { margin-bottom: 0; }</style><div style="tab-size: 8" id="gist7234017" class="gist">
    <div class="gist-file" translate="no" data-color-mode="light" data-light-theme="light">
      <div class="gist-data">
        
<div class="js-gist-file-update-container js-task-list-container">
      <div id="file-countdown" class="file my-2">
    
    <div itemprop="text"
      class="Box-body p-0 blob-wrapper data type-shell  "
      style="overflow: auto" tabindex="0" role="region"
      aria-label="countdown content, created by thameera on 02:54PM on October 30, 2013."
    >

        
<div class="js-check-hidden-unicode js-blob-code-container blob-code-content">

  <template class="js-file-alert-template">
  <div data-view-component="true" class="flash flash-warn flash-full d-flex flex-items-center">
  <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
    <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
    <span>
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      <a class="Link--inTextBlock" href="https://github.co/hiddenchars" target="_blank">Learn more about bidirectional Unicode characters</a>
    </span>


  <div data-view-component="true" class="flash-action">        <a href="{{ revealButtonHref }}" data-view-component="true" class="btn-sm btn">    Show hidden characters
</a>
</div>
</div></template>
<template class="js-line-alert-template">
  <span aria-label="This line has hidden Unicode characters" data-view-component="true" class="line-alert tooltipped tooltipped-e">
    <svg aria-hidden="true" data-component="Octicon" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert">
    <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path>
</svg>
</span></template>

  <table data-hpc class="highlight tab-size js-file-line-container" data-tab-size="4" data-paste-markdown-skip data-tagsearch-path="countdown">
        <tr>
          <td id="file-countdown-L1" class="blob-num js-line-number js-blob-rnum" data-line-number="1"></td>
          <td id="file-countdown-LC1" class="blob-code blob-code-inner js-file-line">#!/bin/bash</td>
        </tr>
        <tr>
          <td id="file-countdown-L2" class="blob-num js-line-number js-blob-rnum" data-line-number="2"></td>
          <td id="file-countdown-LC2" class="blob-code blob-code-inner js-file-line">
</td>
        </tr>
        <tr>
          <td id="file-countdown-L3" class="blob-num js-line-number js-blob-rnum" data-line-number="3"></td>
          <td id="file-countdown-LC3" class="blob-code blob-code-inner js-file-line"># USAGE</td>
        </tr>
        <tr>
          <td id="file-countdown-L4" class="blob-num js-line-number js-blob-rnum" data-line-number="4"></td>
          <td id="file-countdown-LC4" class="blob-code blob-code-inner js-file-line"># ./countdown &lt;num of seconds&gt; &lt;msg&gt;</td>
        </tr>
        <tr>
          <td id="file-countdown-L5" class="blob-num js-line-number js-blob-rnum" data-line-number="5"></td>
          <td id="file-countdown-LC5" class="blob-code blob-code-inner js-file-line"># eg:</td>
        </tr>
        <tr>
          <td id="file-countdown-L6" class="blob-num js-line-number js-blob-rnum" data-line-number="6"></td>
          <td id="file-countdown-LC6" class="blob-code blob-code-inner js-file-line"># ./countdown 300 Time to rock!</td>
        </tr>
        <tr>
          <td id="file-countdown-L7" class="blob-num js-line-number js-blob-rnum" data-line-number="7"></td>
          <td id="file-countdown-LC7" class="blob-code blob-code-inner js-file-line">
</td>
        </tr>
        <tr>
          <td id="file-countdown-L8" class="blob-num js-line-number js-blob-rnum" data-line-number="8"></td>
          <td id="file-countdown-LC8" class="blob-code blob-code-inner js-file-line">date1=$((`date +%s` + $1));</td>
        </tr>
        <tr>
          <td id="file-countdown-L9" class="blob-num js-line-number js-blob-rnum" data-line-number="9"></td>
          <td id="file-countdown-LC9" class="blob-code blob-code-inner js-file-line">shift</td>
        </tr>
        <tr>
          <td id="file-countdown-L10" class="blob-num js-line-number js-blob-rnum" data-line-number="10"></td>
          <td id="file-countdown-LC10" class="blob-code blob-code-inner js-file-line">
</td>
        </tr>
        <tr>
          <td id="file-countdown-L11" class="blob-num js-line-number js-blob-rnum" data-line-number="11"></td>
          <td id="file-countdown-LC11" class="blob-code blob-code-inner js-file-line">while [ &quot;$date1&quot; -ne `date +%s` ]; do</td>
        </tr>
        <tr>
          <td id="file-countdown-L12" class="blob-num js-line-number js-blob-rnum" data-line-number="12"></td>
          <td id="file-countdown-LC12" class="blob-code blob-code-inner js-file-line">  echo -ne &quot;$(date --date @$(($date1 - `date +%s` - 19800 )) +%H:%M:%S)\r&quot;;</td>
        </tr>
        <tr>
          <td id="file-countdown-L13" class="blob-num js-line-number js-blob-rnum" data-line-number="13"></td>
          <td id="file-countdown-LC13" class="blob-code blob-code-inner js-file-line">done</td>
        </tr>
        <tr>
          <td id="file-countdown-L14" class="blob-num js-line-number js-blob-rnum" data-line-number="14"></td>
          <td id="file-countdown-LC14" class="blob-code blob-code-inner js-file-line">
</td>
        </tr>
        <tr>
          <td id="file-countdown-L15" class="blob-num js-line-number js-blob-rnum" data-line-number="15"></td>
          <td id="file-countdown-LC15" class="blob-code blob-code-inner js-file-line">notify-send &#39;Timer finished&#39; &quot;$*&quot;</td>
        </tr>
        <tr>
          <td id="file-countdown-L16" class="blob-num js-line-number js-blob-rnum" data-line-number="16"></td>
          <td id="file-countdown-LC16" class="blob-code blob-code-inner js-file-line">zenity --info --title &quot;Timer finished&quot; --text &quot;$*&quot;</td>
        </tr>
  </table>
</div>


    </div>

  </div>

</div>

      </div>
      <div class="gist-meta">
        <a href="https://gist.github.com/thameera/7234017/raw/badb35da2f87d8c462c53e2e58c544060a53c21b/countdown" style="float:right" class="Link--inTextBlock">view raw</a>
        <a href="https://gist.github.com/thameera/7234017#file-countdown" class="Link--inTextBlock">
          countdown
        </a>
        hosted with &#10084; by <a class="Link--inTextBlock" href="https://github.com">GitHub</a>
      </div>
    </div>
</div>

<p>Some tricks used in the script include:</p>
<ol>
<li><code>echo -ne "blah blah \r"</code> was used to write in the same line over and over</li>
<li>That 19800 is the time difference from GMT 0.0 in seconds. In Sri Lanka, it&#8217;s 5.30 hrs. Yes, we&#8217;re dealing with epoch time here, but still trying to figure out why we need to offset the time difference.  <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f615.png" alt="😕" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </li>
<li><code>notify-send</code> sends a desktop notification</li>
<li><code>zenity --info</code> pops up a message box</li>
</ol>
<p>You can also add a sound to play with <code>mplayer</code>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/countdown-timer-shell-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">509</post-id>	</item>
	</channel>
</rss>
