<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>code.btbytes.com</title>
  <link href="http://code.btbytes.com/atom.xml" rel="self"/>
  <link href="http://code.btbytes.com"/>
  <updated>2012-09-05T21:07:29-04:00</updated>
  <id>http://code.btbytes.com/</id>
  
  <author>
    <name>Pradeep Gowda</name>
    <email>pradeep+code@btbytes.com</email>
  </author>
  
  
  <entry>
    <title>Import Textpattern to Jekyll</title>
    <link href="http://code.btbytes.comtextpattern-to-jekyll.html"/>
   <updated>2012-09-05T00:00:00-04:00</updated>
   <id>http://code.btbytes.com./import-textpattern-to-jekyll</id>
   <content type="html">&lt;p&gt;A python script to import blog posts from &lt;a href='http://textpattern.com'&gt;textpattern&lt;/a&gt; to &lt;a href='http://jekyllrb.com'&gt;Jekyll&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Requires: &lt;a href='http://webpy.org'&gt;web.py&lt;/a&gt;&lt;/p&gt;
&lt;script src='https://gist.github.com/3637166.js'&gt; &lt;/script&gt;</content>
  </entry>
  
  <entry>
    <title>Google Chrome startup switches</title>
    <link href="http://code.btbytes.com/Chrome/2011/08/22/chrome-startup-switches.html"/>
   <updated>2011-08-22T00:00:00-04:00</updated>
   <id>http://code.btbytes.com/Chrome/2011/08/22/chrome-startup-switches</id>
   <content type="html">&lt;h1&gt; Google Chrome startup switches&lt;/h1&gt;&lt;pre&gt;
startup switches runtime
-disable-dev-tools
-disable-hang-monitor
-disable-images
-disable-java
-disable-javascript
-disable-logging
-disable-metrics
-disable-metrics-reporting
-disable-plugins
-disable-popup-blocking
-disable-prompt-on-repost

about page url
about:memory
about:plugins
about:network
about:histograms
about:dns
about:cache
about:version
about:stats
about:crash
&lt;/pre&gt;
&lt;p&gt;&lt;a href='https://plus.google.com/u/2/114723964985237592593/posts/MmGQendQgyf'&gt;Source&lt;/a&gt;&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>Backup all the git repositories managed by gitosis</title>
    <link href="http://code.btbytes.com/bash/git/shell/2011/08/19/backup-git-repos-gitosis.html"/>
   <updated>2011-08-19T00:00:00-04:00</updated>
   <id>http://code.btbytes.com/bash/git/shell/2011/08/19/backup-git-repos-gitosis</id>
   <content type="html">&lt;h1&gt;Datestamped backup of git repositories managed by gitosis&lt;/h1&gt;&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&lt;span class='c'&gt;#!/bin/bash&lt;/span&gt;

&lt;span class='s1'&gt;&amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
&lt;span class='s1'&gt;A script to backup all the git repositories managed by gitosis&lt;/span&gt;
&lt;span class='s1'&gt;and create a date stamped tarball.&lt;/span&gt;

&lt;span class='s1'&gt;Pradeep Gowda&lt;/span&gt;
&lt;span class='s1'&gt;2011-08-19&lt;/span&gt;
&lt;span class='s1'&gt;&amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;

&lt;span class='nv'&gt;GITOSISADMIN&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;&lt;span class='nv'&gt;$HOME&lt;/span&gt;/mycompany/gitosis-admin
&lt;span class='nv'&gt;GITSERVER&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;git@gitserver.mycompany.com&amp;quot;&lt;/span&gt;
&lt;span class='nv'&gt;TODAY&lt;/span&gt;&lt;span class='o'&gt;=&lt;/span&gt;&lt;span class='sb'&gt;`&lt;/span&gt;date +%Y-%m-%d&lt;span class='sb'&gt;`&lt;/span&gt;

mkdir gitbackups-&lt;span class='nv'&gt;$TODAY&lt;/span&gt;
grep ^writable &lt;span class='nv'&gt;$GITOSISADMIN&lt;/span&gt;/gitosis.conf | cut -d&lt;span class='o'&gt;=&lt;/span&gt; -f 2 | tr &lt;span class='s2'&gt;&amp;quot;\\n&amp;quot;&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot; &amp;quot;&lt;/span&gt; | tr &lt;span class='s2'&gt;&amp;quot; &amp;quot;&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;\\n&amp;quot;&lt;/span&gt;  | sort  | uniq | xargs -I &lt;span class='o'&gt;{}&lt;/span&gt; git clone &lt;span class='nv'&gt;$GITSERVER&lt;/span&gt;:&lt;span class='o'&gt;{}&lt;/span&gt;.git gitbackups/&lt;span class='o'&gt;{}&lt;/span&gt;
tar czf gitbackups-&lt;span class='nv'&gt;$TODAY&lt;/span&gt;.tgz gitbackups
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href='https://gist.github.com/1157115'&gt;Updates on gist.github.com&lt;/a&gt;&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>a simple demonstration emacs keyboard macros</title>
    <link href="http://code.btbytes.com/emacs/2011/03/26/emacs-kbd-macro.html"/>
   <updated>2011-03-26T00:00:00-04:00</updated>
   <id>http://code.btbytes.com/emacs/2011/03/26/emacs-kbd-macro</id>
   <content type="html">&lt;h1 id='a_simple_demonstration_of_emacs_keyboard_macros'&gt;A simple demonstration of emacs keyboard macros&lt;/h1&gt;

&lt;p&gt;you need to remember three keyboard shortcuts to use keyboard macros in emacs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;C-x (&lt;/code&gt; &amp;#8211; start-kbd-macro&lt;/li&gt;

&lt;li&gt;&lt;code&gt;C-x )&lt;/code&gt; &amp;#8211; stop-kbd-macro&lt;/li&gt;

&lt;li&gt;&lt;code&gt;C-x e&lt;/code&gt; &amp;#8211; call-last-kbd-macro&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Type, &lt;code&gt;C-x (&lt;/code&gt; &lt;code&gt;hello&lt;/code&gt; &lt;code&gt;C-x )&lt;/code&gt; &lt;code&gt;C-x e&lt;/code&gt; &lt;code&gt;C-x e&lt;/code&gt;. You will have &amp;#8220;hellohellohello&amp;#8221;.&lt;/p&gt;

&lt;p&gt;Let&amp;#8217;s do something more useful like converting a list of words in to a HTML list of links. That is, given two words&lt;/p&gt;
&lt;pre&gt;
        contact
     about
&lt;/pre&gt;
&lt;p&gt;convert them into &lt;pre&gt;&lt;code&gt;
&amp;lt;li&amp;gt;&amp;lt;a href=&quot;/contact.html&quot;&amp;gt;contact&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a href=&quot;/about.html&quot;&amp;gt;about&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Position the cursor in the first column of &amp;#8216;contact&amp;#8217; and&lt;/p&gt;
&lt;pre&gt;
C-x ( -- start recording
M-x just-one-space -- remove preceding white-space 
C-SPC -- set mark
C-e -- go to end of line 
M-w -- yank selected text 
C-a -- go the beginning of the line  and type &amp;lt;li&amp;gt;&amp;lt;a href=&quot;/
C-y -- paste the text and type .html&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
C-a -- go back to column 0
C-n -- go to next line
C-x ) -- stop recording
&lt;/pre&gt;
&lt;p&gt;To play back the record on subsequent lines, press &lt;code&gt;C-x e&lt;/code&gt; as many number of times you want. To execute the macro &lt;code&gt;n&lt;/code&gt; times, say 5, press &lt;code&gt;C-u 5 C-x e&lt;/code&gt;.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>Keep honest</title>
    <link href="http://code.btbytes.com/keephonest.html"/>
   <updated>2011-03-15T00:00:00-04:00</updated>
   <id>http://code.btbytes.com/keephonest</id>
   <content type="html">&lt;h1 id='keep_honest'&gt;Keep Honest&lt;/h1&gt;

&lt;p&gt;An objective method to monitor how much productive you &lt;em&gt;truly&lt;/em&gt; are.&lt;/p&gt;

&lt;p&gt;It is quite easy to get lost in the &amp;#8220;social media&amp;#8221; storm, even if the social media is technical and often relevant to the work. (eg:N, Reddit, Twitter etc.,). The cost of engaging in constant stream of information is that it is quite easy to get distracted.&lt;/p&gt;

&lt;p&gt;The first step to get rid of a habit is to measure and assess it&amp;#8217;s true impact.&lt;/p&gt;

&lt;p&gt;One way to do this is to look back at your workscreen over the span of a day and see how much of it was spent in distractions.&lt;/p&gt;

&lt;p&gt;We will be needing an application called &lt;code&gt;scrot&lt;/code&gt;, which takes screenshots of the desktops from the shell.&lt;/p&gt;

&lt;p&gt;Install &lt;code&gt;scrot&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo apt-get install scrot &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Create a directory to store the screenshots&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ mkdir ~/keephonest&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Call &lt;code&gt;scrot&lt;/code&gt; every minute and save the image to a folder.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ crontab -e&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Add the second line to the crontab&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# m h  dom mon dow   command
* * * * * env DISPLAY=:0 /usr/bin/scrot /home/USERNAME/keephonest/screen\%F-\%T.png &amp;gt; /dev/null&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let crontab+scrot record your screen for an entire day. Play the screenshots using a GUI application (eg: Eye of Gnome &amp;#8211; eog) to see where most of your time was spent.&lt;/p&gt;</content>
  </entry>
  
</feed>

