<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Linux Tidbits</title>
	<atom:link href="http://linuxtidbits.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxtidbits.wordpress.com</link>
	<description>Every letter has its place</description>
	<lastBuildDate>Thu, 26 Jan 2012 10:08:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='linuxtidbits.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/5ad9566326fdd6b7f4e8af74375a3cac?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Linux Tidbits</title>
		<link>http://linuxtidbits.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://linuxtidbits.wordpress.com/osd.xml" title="Linux Tidbits" />
	<atom:link rel='hub' href='http://linuxtidbits.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Bash Script Templates</title>
		<link>http://linuxtidbits.wordpress.com/2012/01/20/bash-script-templates/</link>
		<comments>http://linuxtidbits.wordpress.com/2012/01/20/bash-script-templates/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 13:10:58 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1762</guid>
		<description><![CDATA[The basic and expanded templates I use to begin most of my bash scripts: template-basic #!/bin/bash # scriptname - description of script scrpt=${0##*/}&#160;&#160;# script name # Display usage if no parameters given if&#160;[[&#160;-z&#160;"$@"&#160;]];&#160;then &#160;&#160;echo&#160;"&#160;$scrpt&#160;&#60;input&#62; - description" &#160;&#160;exit fi # Text color variables txtund=$(tput sgr&#160;0&#160;1)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;# Underline txtbld=$(tput bold)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;# Bold bldred=${txtbld}$(tput setaf&#160;1)&#160;#&#160;&#160;red bldblu=${txtbld}$(tput setaf&#160;4)&#160;#&#160;&#160;blue bldwht=${txtbld}$(tput setaf&#160;7)&#160;#&#160;&#160;white txtrst=$(tput [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1762&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://linuxtidbits.files.wordpress.com/2011/12/shellscript.png"><img src="http://linuxtidbits.files.wordpress.com/2011/12/shellscript.png?w=32&#038;h=32" alt="" title="shellscript" width="32" height="32" class="alignright wp-image-1666" /></a>The basic and expanded templates I use to begin most of my bash scripts:</p>
<p><strong>template-basic</strong></p>
<pre style="overflow:auto;width:auto;border:solid #c8c8c8;background-color:#dddddf;font-size:1em;white-space:pre;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><font face="monospace"><font color="#585858">#!/bin/bash</font>
<font color="#585858"># scriptname - description of script</font>

<font color="#00AF00">scrpt</font>=<font color="#008700">${</font><font color="#008700">0</font><font color="#8700AF">##</font>*/<font color="#008700">}</font>&nbsp;&nbsp;<font color="#585858"># script name</font>

<font color="#585858"># Display usage if no parameters given</font>
<font color="#8700AF">if&nbsp;</font><font color="#5F87FF"><b>[[</b></font>&nbsp;<font color="#8700AF">-z</font>&nbsp;<font color="#8700AF">"</font><font color="#008700">$@</font><font color="#8700AF">"</font>&nbsp;<font color="#5F87FF"><b>]]</b></font><font color="#8700AF">;</font>&nbsp;<font color="#8700AF">then</font>
&nbsp;&nbsp;<font color="#8700AF">echo</font><font color="#5F5FAF">&nbsp;</font><font color="#8700AF">"</font><font color="#5F5FAF">&nbsp;</font><font color="#008700">$scrpt</font><font color="#5F5FAF">&nbsp;&lt;input&gt; - description</font><font color="#8700AF">"</font>
&nbsp;&nbsp;<font color="#8700AF">exit</font>
<font color="#8700AF">fi</font>

<font color="#585858"># Text color variables</font>
<font color="#00AF00">txtund</font>=<font color="#008700">$(</font><font color="#5F87FF"><b>tput sgr&nbsp;</b></font>0<font color="#5F87FF"><b>&nbsp;</b></font>1<font color="#008700">)</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># Underline</font>
<font color="#00AF00">txtbld</font>=<font color="#008700">$(</font><font color="#5F87FF"><b>tput bold</b></font><font color="#008700">)</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># Bold</font>
<font color="#00AF00">bldred</font>=<font color="#008700">${</font><font color="#008700">txtbld</font><font color="#008700">}</font><font color="#008700">$(</font><font color="#5F87FF"><b>tput setaf&nbsp;</b></font>1<font color="#008700">)</font>&nbsp;<font color="#585858">#&nbsp;&nbsp;red</font>
<font color="#00AF00">bldblu</font>=<font color="#008700">${</font><font color="#008700">txtbld</font><font color="#008700">}</font><font color="#008700">$(</font><font color="#5F87FF"><b>tput setaf&nbsp;</b></font>4<font color="#008700">)</font>&nbsp;<font color="#585858">#&nbsp;&nbsp;blue</font>
<font color="#00AF00">bldwht</font>=<font color="#008700">${</font><font color="#008700">txtbld</font><font color="#008700">}</font><font color="#008700">$(</font><font color="#5F87FF"><b>tput setaf&nbsp;</b></font>7<font color="#008700">)</font>&nbsp;<font color="#585858">#&nbsp;&nbsp;white</font>
<font color="#00AF00">txtrst</font>=<font color="#008700">$(</font><font color="#5F87FF"><b>tput sgr0</b></font><font color="#008700">)</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># Reset</font>
<font color="#00AF00">info</font>=<font color="#008700">${</font><font color="#008700">bldwht</font><font color="#008700">}</font>*<font color="#008700">${</font><font color="#008700">txtrst</font><font color="#008700">}</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># Feedback</font>
<font color="#00AF00">pass</font>=<font color="#008700">${</font><font color="#008700">bldblu</font><font color="#008700">}</font>*<font color="#008700">${</font><font color="#008700">txtrst</font><font color="#008700">}</font>
<font color="#00AF00">warn</font>=<font color="#008700">${</font><font color="#008700">bldred</font><font color="#008700">}</font>*<font color="#008700">${</font><font color="#008700">txtrst</font><font color="#008700">}</font>
<font color="#00AF00">ques</font>=<font color="#008700">${</font><font color="#008700">bldblu</font><font color="#008700">}</font>?<font color="#008700">${</font><font color="#008700">txtrst</font><font color="#008700">}</font>

</font></pre>
<p><strong>template</strong></p>
<pre style="overflow:auto;width:auto;border:solid #c8c8c8;background-color:#dddddf;font-size:1em;white-space:pre;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><font face="monospace"><font color="#585858">#!/bin/bash</font>
<font color="#585858"># scriptname - description of script</font>

<font color="#00AF00">scrpt</font>=<font color="#008700">${</font><font color="#008700">0</font><font color="#8700AF">##</font>*/<font color="#008700">}</font>&nbsp;&nbsp;<font color="#585858"># script name</font>

<font color="#585858"># Display usage if no parameters given</font>
<font color="#8700AF">if&nbsp;</font><font color="#5F87FF"><b>[[</b></font>&nbsp;<font color="#8700AF">-z</font>&nbsp;<font color="#8700AF">"</font><font color="#008700">$@</font><font color="#8700AF">"</font>&nbsp;<font color="#5F87FF"><b>]]</b></font><font color="#8700AF">;</font>&nbsp;<font color="#8700AF">then</font>
&nbsp;&nbsp;<font color="#8700AF">echo</font><font color="#5F5FAF">&nbsp;</font><font color="#8700AF">"</font><font color="#5F5FAF">&nbsp;</font><font color="#008700">$scrpt</font><font color="#5F5FAF">&nbsp;&lt;input&gt; - description</font><font color="#8700AF">"</font>
&nbsp;&nbsp;<font color="#8700AF">exit</font>
<font color="#8700AF">fi</font>

<font color="#585858"># Text color variables</font>
<font color="#00AF00">txtred</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0;31m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># red</font>
<font color="#00AF00">txtgrn</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0;32m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># green</font>
<font color="#00AF00">txtylw</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0;33m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># yellow</font>
<font color="#00AF00">txtblu</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0;34m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># blue</font>
<font color="#00AF00">txtpur</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0;35m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># purple</font>
<font color="#00AF00">txtcyn</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0;36m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># cyan</font>
<font color="#00AF00">txtwht</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0;37m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># white</font>
<font color="#00AF00">bldred</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[1;31m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># red&nbsp;&nbsp;&nbsp;&nbsp;- Bold</font>
<font color="#00AF00">bldgrn</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[1;32m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># green</font>
<font color="#00AF00">bldylw</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[1;33m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># yellow</font>
<font color="#00AF00">bldblu</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[1;34m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># blue</font>
<font color="#00AF00">bldpur</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[1;35m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># purple</font>
<font color="#00AF00">bldcyn</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[1;36m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># cyan</font>
<font color="#00AF00">bldwht</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[1;37m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># white</font>
<font color="#00AF00">txtund</font>=<font color="#008700">$(</font><font color="#5F87FF"><b>tput sgr&nbsp;</b></font>0<font color="#5F87FF"><b>&nbsp;</b></font>1<font color="#008700">)</font>&nbsp;&nbsp;<font color="#585858"># Underline</font>
<font color="#00AF00">txtbld</font>=<font color="#008700">$(</font><font color="#5F87FF"><b>tput bold</b></font><font color="#008700">)</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># Bold</font>
<font color="#00AF00">txtrst</font>=<font color="#8700AF">'</font><font color="#5F5FAF">\e[0m</font><font color="#8700AF">'</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#585858"># Text reset</font>

<font color="#585858"># Feedback indicators</font>
<font color="#00AF00">info</font>=<font color="#008700">${</font><font color="#008700">bldwht</font><font color="#008700">}</font>*<font color="#008700">${</font><font color="#008700">txtrst</font><font color="#008700">}</font>
<font color="#00AF00">pass</font>=<font color="#008700">${</font><font color="#008700">bldblu</font><font color="#008700">}</font>*<font color="#008700">${</font><font color="#008700">txtrst</font><font color="#008700">}</font>
<font color="#00AF00">warn</font>=<font color="#008700">${</font><font color="#008700">bldred</font><font color="#008700">}</font>!<font color="#008700">${</font><font color="#008700">txtrst</font><font color="#008700">}</font>

<font color="#585858"># Indicator usage</font>
<font color="#8700AF">echo</font><font color="#5F5FAF">&nbsp;-e&nbsp;</font><font color="#8700AF">"</font><font color="#008700">${</font><font color="#008700">info</font><font color="#008700">}</font><font color="#5F5FAF">&nbsp;</font><font color="#8700AF">"</font>
<font color="#8700AF">echo</font><font color="#5F5FAF">&nbsp;-e&nbsp;</font><font color="#8700AF">"</font><font color="#008700">${</font><font color="#008700">pass</font><font color="#008700">}</font><font color="#5F5FAF">&nbsp;</font><font color="#8700AF">"</font>
<font color="#8700AF">echo</font><font color="#5F5FAF">&nbsp;-e&nbsp;</font><font color="#8700AF">"</font><font color="#008700">${</font><font color="#008700">warn</font><font color="#008700">}</font><font color="#5F5FAF">&nbsp;</font><font color="#8700AF">"</font></font></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1762/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1762/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1762/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1762/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1762/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1762/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1762/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1762/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1762&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2012/01/20/bash-script-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/shellscript.png" medium="image">
			<media:title type="html">shellscript</media:title>
		</media:content>
	</item>
		<item>
		<title>Syntax Highlighting in Blog Posts with Vim</title>
		<link>http://linuxtidbits.wordpress.com/2012/01/13/syntax-highlighting-in-blog-posts-with-vim/</link>
		<comments>http://linuxtidbits.wordpress.com/2012/01/13/syntax-highlighting-in-blog-posts-with-vim/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 02:23:32 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1749</guid>
		<description><![CDATA[Update: Reader Elder Marco has pointed out that WordPress.com does have support for syntax highlighting of source code built-in (which I had never heard of before) that might be a preferred alternative for some. An example of both is below. Vim is a great all-around editor. It also does very good at syntax highlighting. With [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1749&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>
<div style="overflow:auto;width:auto;border:solid #bab363;background-color:#faf7d8;font-size:1em;color:#4f4c2a;border-width:.1em .8em;padding:.3em .6em;"><strong>Update: </strong>Reader Elder Marco has pointed out that WordPress.com does have <a href="http://en.support.wordpress.com/code/posting-source-code/" target="_blank">support</a> for syntax highlighting of source code built-in (which I had never heard of before) that might be a preferred alternative for some.  An example of both is below.</div>
</p>
<p></p>
<p><a href="http://bobthecow.deviantart.com/art/Vim-dock-icon-57482936"><img align="right" class="com" src="http://linuxtidbits.files.wordpress.com/2008/02/vim-128.png?w=474" style="border-width:0;" /></a>Vim is a great all-around editor.  It also does very good at syntax highlighting.  With the plugin &#8220;TOhtml&#8221; included with Vim it&#8217;s easy to put that highlighting into a blog post.  I created a <code>scrptblog</code> script that when run on another script will produce a file defining the syntax highlighting in HTML code.  From there it can be pasted into the blog post.</p>
<p><strong><code>scrptblog</code> example:</strong></p>
<pre>
<font face="monospace"><font color="#585858">#!/bin/bash</font>
<font color="#585858"># scrptblog - Create HTML code from Vim syntax highlighting (for use in coloring</font>
<font color="#585858"># scripts)</font>

<font color="#00AF00">filename</font>=<font color="#008700">$@</font>
<font color="#00AF00">background</font>=light
<font color="#00AF00">colorscheme</font>=beauty256
<font color="#00AF00">scrpt</font>=<font color="#008700">${</font><font color="#008700">0</font><font color="#8700AF">##</font>*/<font color="#008700">}</font>&nbsp;&nbsp;<font color="#585858"># script name</font>

<font color="#585858"># Display usage if no parameters given</font>
<font color="#8700AF">if&nbsp;</font><font color="#5F87FF"><b>[[</b></font>&nbsp;<font color="#8700AF">-z</font>&nbsp;<font color="#8700AF">"</font><font color="#008700">$@</font><font color="#8700AF">"</font>&nbsp;<font color="#5F87FF"><b>]]</b></font><font color="#8700AF">;</font>&nbsp;<font color="#8700AF">then</font>
&nbsp;&nbsp;<font color="#8700AF">echo</font><font color="#5F5FAF">&nbsp;</font><font color="#8700AF">"</font><font color="#5F5FAF">&nbsp;</font><font color="#008700">$scrpt</font><font color="#5F5FAF">&nbsp;&lt;filename&gt; - create HTML code from Vim syntax highlighting</font><font color="#8700AF">"</font>
&nbsp;&nbsp;<font color="#8700AF">exit</font>
<font color="#8700AF">fi</font>

<font color="#585858"># Syntax highlighting to HTML export</font>
vim&nbsp;<font color="#5F87FF"><b>-f</b></font>&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">syntax on</font><font color="#8700AF">"</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">set background=</font><font color="#008700">$background</font><font color="#8700AF">"</font>&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">colorscheme&nbsp;</font><font color="#008700">$colorscheme</font><font color="#8700AF">"</font>&nbsp;&nbsp;&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">let html_use_css = 0</font><font color="#8700AF">"</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">let html_no_pre = 1</font><font color="#8700AF">"</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">let html_number_lines = 0</font><font color="#8700AF">"</font>&nbsp;&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">TOhtml</font><font color="#8700AF">"</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">x</font><font color="#8700AF">"</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#8700AF">\</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+<font color="#8700AF">"</font><font color="#5F5FAF">q</font><font color="#8700AF">"</font>&nbsp;<font color="#008700">$filename</font>

<font color="#585858"># Clean up HTML code</font>
tidy&nbsp;<font color="#5F87FF"><b>-utf8</b></font>&nbsp;<font color="#5F87FF"><b>-f</b></font>&nbsp;/dev/null&nbsp;<font color="#5F87FF"><b>--wrap</b></font>&nbsp;<font color="#5F87FF"><b>-m</b></font>&nbsp;<font color="#008700">$filename</font>.html

<font color="#585858"># Delete the HTML meta page information.</font>
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">1,/body bgcolor=/d</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html

<font color="#585858"># Remove line breaks (needed for some things like blog posts)</font>
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">s|&lt;br&gt;||g</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html

<font color="#585858"># Remove the closing HTML tags</font>
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">s~&lt;/body[^&gt;]*&gt;~~g</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">s~&lt;/html[^&gt;]*&gt;~~g</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html

<font color="#585858"># Add preformatting tabs &lt;pre&gt; and &lt;/pre&gt;</font>
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">1 i &lt;pre&gt;</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">$ a &lt;/pre&gt;</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html

<font color="#585858"># Remove trailing blank lines</font>
<font color="#8700AF">while&nbsp;</font><font color="#8700AF">[</font>&nbsp;<font color="#8700AF">"</font><font color="#008700">$(</font><font color="#8700AF">tail</font><font color="#5F87FF"><b>&nbsp;-n&nbsp;</b></font>1<font color="#5F87FF"><b>&nbsp;</b></font><font color="#008700">$filename</font><font color="#5F87FF"><b>.html</b></font><font color="#008700">)</font><font color="#8700AF">"</font>&nbsp;<font color="#8700AF">==</font>&nbsp;<font color="#5F5FAF">"\n"</font>&nbsp;<font color="#8700AF">]</font><font color="#8700AF">;</font><font color="#8700AF">&nbsp;</font><font color="#8700AF">do</font>
&nbsp;&nbsp;<font color="#8700AF">sed</font>&nbsp;<font color="#8700AF">-i</font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">$d</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html
<font color="#8700AF">done</font>

<font color="#585858"># Delete newline of last &lt;font&gt; line for better formatting</font>
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">:a;N;$!ba;s/\(.*\)\n/\1/</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html
<font color="#8700AF">sed</font>&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">:a;N;$!ba;s/\(.*\)\n/\1/</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html

<font color="#585858"># Delete final newline</font>
perl&nbsp;<font color="#5F87FF"><b>-i</b></font>&nbsp;<font color="#5F87FF"><b>-e</b></font>&nbsp;<font color="#8700AF">'</font><font color="#5F5FAF">local $/; $_ = &lt;&gt;; s/\n$//; print</font><font color="#8700AF">'</font>&nbsp;<font color="#008700">$filename</font>.html</font>
</pre>
<p><strong>WordPress built-in syntax highlight support example:</strong></p>
<p><pre class="brush: css;">#!/bin/bash
# scrptblog - Create HTML code from Vim syntax highlighting (for use in coloring
# scripts)

filename=$@
background=light
colorscheme=beauty256
scrpt=${0##*/}  # script name

# Display usage if no parameters given
if [[ -z &quot;$@&quot; ]]; then
  echo &quot; $scrpt &lt;filename&gt; - create HTML code from Vim syntax highlighting&quot;
  exit
fi

# Syntax highlighting to HTML export
vim -f  +&quot;syntax on&quot;                  \
        +&quot;set background=$background&quot; \
        +&quot;colorscheme $colorscheme&quot;   \
        +&quot;let html_use_css = 0&quot;       \
        +&quot;let html_no_pre = 1&quot;        \
        +&quot;let html_number_lines = 0&quot;  \
        +&quot;TOhtml&quot;                     \
        +&quot;x&quot;                          \
        +&quot;q&quot; $filename

# Clean up HTML code
tidy -utf8 -f /dev/null --wrap -m $filename.html

# Delete the HTML meta page information.
sed -i '1,/body bgcolor=/d' $filename.html

# Remove line breaks (needed for some things like blog posts)
sed -i 's|&lt;br&gt;||g' $filename.html

# Remove the closing HTML tags
sed -i 's~&lt;/body[^&gt;]*&gt;~~g' $filename.html
sed -i 's~&lt;/html[^&gt;]*&gt;~~g' $filename.html

# Add preformatting tabs &lt;pre&gt; and &lt;/pre&gt;
sed -i '1 i &lt;pre&gt;' $filename.html
sed -i '$ a &lt;/pre&gt;' $filename.html

# Remove trailing blank lines
while [ &quot;$(tail -n 1 $filename.html)&quot; == &quot;\n&quot; ]; do
  sed -i '$d' $filename.html
done

# Delete newline of last &lt;font&gt; line for better formatting
sed -i ':a;N;$!ba;s/\(.*\)\n/\1/' $filename.html
sed -i ':a;N;$!ba;s/\(.*\)\n/\1/' $filename.html

# Delete final newline
perl -i -e 'local $/; $_ = &lt;&gt;; s/\n$//; print' $filename.html</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1749/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1749/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1749&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2012/01/13/syntax-highlighting-in-blog-posts-with-vim/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2008/02/vim-128.png" medium="image" />
	</item>
		<item>
		<title>Ubuntu Oneiric: Final Touches</title>
		<link>http://linuxtidbits.wordpress.com/2012/01/06/ubuntu-oneiric-final-touches/</link>
		<comments>http://linuxtidbits.wordpress.com/2012/01/06/ubuntu-oneiric-final-touches/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 21:41:42 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1729</guid>
		<description><![CDATA[Note: A month ago I meant to write this article but experienced hardware issues. I wrote that in places that Oneiric was slow&#8230; I was wrong. Apologize for any inconvenience. Here are some edits, additions, and subtractions that help complete the feel of the of Ubuntu&#8217;s 11.10 Oneiric desktop. Note that a couple modifications are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1729&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>
<div style="width:auto;border:solid #637dba;background-color:#d8e2fa;font-size:.9em;color:#2a354f;border-width:.1em .8em;padding:.3em .6em;"><strong>Note: </strong>A month ago I meant to write this article but experienced hardware issues.  I <a href="/2011/10/24/ubuntu-oneiric-initial-musings/" target="_blank">wrote</a> that in places that Oneiric was slow&#8230; I was wrong.  Apologize for any inconvenience.</div>
</p>
<p><a href="http://linuxtidbits.files.wordpress.com/2012/01/ubuntu-final-touches-150.png"><img src="http://linuxtidbits.files.wordpress.com/2012/01/ubuntu-final-touches-150.png?w=474" alt="" title="Ubuntu Final Touches-150"   class="alignright size-full wp-image-1730" /></a>Here are some edits, additions, and subtractions that help complete the feel of the of Ubuntu&#8217;s 11.10 Oneiric desktop.  Note that a couple modifications are made only for performance reasons for use with an older computer.</p>
<p><strong><u>Installing</u></strong></p>
<p>When installing Ubuntu, it is still recommended to do a clean (fresh) install of Ubuntu.  Ubuntu/Debian engineers primarily focus resources on the install route therefore making it the recommended method.</p>
<p><strong><u><font size="+1">Home folder on a dedicated partition</font></u></strong></p>
<p><em>&#8220;How we work can be almost as important as what we do.&#8221;</em></p>
<p>Putting application preferences back together can be a lengthy process.  A good work flow can dramatically improve productivity.  Putting settings and documents on a dedicated partition will allow them to be easily built on from install to install.  In Linux, configurations rarely ever cause problems.  The <a href="http://partedmagic.com/" target="_blank">Parted Magic Maintenance CD</a> is a good tool to start with that can help with the process.  More on how to do this can be found <a href="https://help.ubuntu.com/community/Partitioning/Home/Moving#" target="_blank">here</a>.</p>
<p>When doing a clean install with a dedicated home partition, the partition needs to be defined during installation being sure to have it remain <em>unformatted</em>:</p>
<p><a href="http://linuxtidbits.files.wordpress.com/2012/01/04-amalgamated.png"><img src="http://linuxtidbits.files.wordpress.com/2012/01/04-amalgamated.png?w=474&#038;h=146" alt="" title="04 Amalgamated" width="474" height="146" class="alignleft size-full wp-image-1737" /></a></p>
<p><strong><u><font size="+1">Tools</font></u></strong></p>
<p>For future reference here is a <a href="http://ubuntuforums.org/showthread.php?p=7680189#post7680189" target="_blank">package management helper script</a>.  It makes common package management related tasks easier to execute (and remember).</p>
<p>If planning to stick around with Linux, learn Vim.  Vim is an excellent command line editor.  Learning Vim can save time and be pleasurable to use (here to edit configuration files).  More about Vim can be found <a href="https://wiki.archlinux.org/index.php/Vim" target="_blank">here</a>.</p>
<p><strong><u><font size="+1">Hardware Setup</font></u></strong></p>
<p>The first detail to focus on after installing Ubuntu is to get all hardware up and running.  Ubuntu does good at discovering/setting up hardware but it isn&#8217;t able to do everything.  First, the Additional Drivers control panel in System Settings may have hardware needed to be installed (some hardware setup requires user confirmation and is done here).  After this, testing all devices and peripherals is recommended.  It may in the end be necessary to visit the manufacturers website and download drivers.  In most cases though to get the hardware working, information is usually available on the <a href="https://help.ubuntu.com/" target="_blank">wiki</a>.</p>
<p><strong><u><font size="+1">Desktop Preferences</font></u></strong></p>
<p>A number of options can be made to make a more efficient desktop; these programs will be needed to make the edits:</p>
<pre>sudo apt-get install dconf-tools gconf-editor</pre>
<p><strong>Remove Unnecessary Startup Applications</strong></p>
<p>To restore the ability to edit the Startup Applications do:</p>
<pre>mkdir -p ~/.config/autostart
cd ~/.config/autostart
cp /etc/xdg/autostart/*.desktop .
sed -i "s/NoDisplay=true/NoDisplay=false/g" *.desktop</pre>
<p>To save resources, select what is needed in Startup Applications.  If not needed, Ubuntu One, Desktop Sharing, and Check Hardware Drivers can be removed.  Removing Update Notifier too can save a good bit or resources if willing to update manually.  To complete Update Notifier disabling:</p>
<pre>dconf write /com/ubuntu/update-notifier/auto-launch false
sudo apt-get remove apt-xapian-index  # actually an old Synaptic plugin remnant</pre>
<p><strong>Launcher</strong></p>
<p>The Launcher with a couple edits can become more able to streamline the workspace.</p>
<p>Disable Auto-hide:</p>
<p>To have the Launcher always visible (usually recommended) do:</p>
<pre>dconf write /com/canonical/unity-2d/launcher/use-strut true</pre>
<p>Remove Multiple Desktops/Workspaces:</p>
<p>Save space on the Launcher if not using the multiple desktops feature:</p>
<pre>gconftool-2 -s /apps/metacity/general/num_workspaces --type int 1
sudo cp /usr/share/unity-2d/launcher/Launcher.qml{,.bck}
sudo sed -i '/items.appendModel(workspaces)/d' /usr/share/unity-2d/launcher/Launcher.qml</pre>
<p>This edit is temporary and will need to be run again when the <strong>unity-2d-launcher</strong> package is updated.</p>
<p>Add Show Desktop:</p>
<p>The ability to show the desktop can be done with the <strong>Super + D</strong> keypress (thats usually the Windows key) but to have the icon available on the Launcher an Xorg server interface tool will be needed:</p>
<pre>sudo apt-get install xdotool</pre>
<p>Create the <code>.desktop</code> so it can be pinned to the launcher:</p>
<pre>echo "[Desktop Entry]
Name=Show Desktop
Exec=xdotool key --delay 300 super+d
Icon=desktop
Terminal=false
Type=Application
StartupNotify=false" &gt;&gt;   ~/.local/share/applications/show-desktop.desktop</pre>
<p>Open the file manager and drag the <code>.desktop</code> to the Launcher:</p>
<pre>nautilus ~/.local/share/applications/</pre>
<p><strong>Numlock Enabled on Login</strong></p>
<p>Because the numberpad exists on most keyboards and since it&#8217;s primary use is for doing calculations having the Numlock on by default is usually is the preferred option:</p>
<pre>sudo apt-get install numlockx
sudo sed -i 's|^exit 0.*$|# Numlock enable\n[ -x /usr/bin/numlockx ] \&amp;\&amp; numlockx on\n\nexit 0|' /etc/rc.local</pre>
<p><strong>Turn Off Resume from Sleep Lock</strong></p>
<p>More obstruction than protection for some the resume from sleep lock can be disabled:</p>
<pre>gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'</pre>
<p><strong>File Manager Possibilities</strong></p>
<p>Once the behavior is adapted to this feature can save time; however this behavior can be persistent: to streamline workflow consider using a single-click for files in the file manager/desktop.  Set this in the <b>File Manager</b> under &gt; <b>Edit</b> &gt; <b>Preferences</b> &gt; <b>Behavior</b> &gt; <b>Single click</b>.  For a slight speedup in the file manager, lower the preview values (Nautilus &gt; <b>Edit</b> &gt; <b>Pref</b> &gt; <b>Preview</b> &gt; <b>No text icons</b>, <b>Thumbs for smaller file sizes</b>, and <b>Count number</b>).</p>
<p><strong>Application Indicators</strong></p>
<p><strong>Application indicators</strong> are the feedback icons in the menu bar on the top right.  Here are some edits/considerations (changes to <strong>application indicators</strong> area don&#8217;t take effect until Logout/Login).</p>
<p>Switch Users Unneeded:</p>
<p>For single-user computer or if the feature is never used, save space by disabling the Switch Users indicator:</p>
<pre>dconf write /apps/indicator-session/user-show-menu false</pre>
<p>Google Web Mail:</p>
<p>Because of its&#8217; efficient use of space and it&#8217;s connectivity possibilities the web interface of Google mail is preferred over email programs by a good number of people.  There is an <strong>application indicator</strong> to notify of new Gmail email called <strong>gm-notify</strong>:</p>
<pre>sudo apt-get install gm-notify</pre>
<p><strong>gm-notify</strong> can be configured additionally to play a sound when new mail arrives, check <code>/usr/lib/libreoffice/basis3.4/share/gallery/sounds/curve.wav</code> ia a possibility.</p>
<p>Other Indicators:</p>
<p>Additional <strong>application indicators</strong> can be found at <a href="http://askubuntu.com/questions/30334/list-of-application-indicators" target="_blank">Ask Ubuntu</a>.</p>
<p><strong>Laptop Touches</strong></p>
<p>For regular laptop users the thought of limiting the touchpad from accidental scrolling and mouse click tapping is kept in the front of the mind.  Consider using two-finger scrolling and disabling touchpad tapping instead.</p>
<p><strong>Firefox Security</strong></p>
<p>If on the Internet a lot, it&#8217;s a good idea to protect the application that primarily accesses it.  There is a nice script written by Ignorant Guru that puts Firefox in a sandbox.  To learn more read <a href="http://ubuntuforums.org/showthread.php?t=1398659&amp;" target="_blank">here</a>.  First install the <a href="http://igurublog.wordpress.com/downloads/ppa/" target="_blank">PPA</a> then install the script through the package manager:</p>
<pre>sudo apt-get update
sudo apt-get install sandfox</pre>
<p>The script is most productive in protecting from Adobe Flash security holes.  A perk of the script is that it allows Flash preferences to be saved; a disadvantage is this allows a security hole.  To plug the hole change the preference directories to read-only only by root:</p>
<pre>cd ~
rm -rf .adobe .macromedia
sudo mkdir .adobe .macromedia
sudo chmod ugo-wx .adobe .macromedia</pre>
<p>Then bind the folders read-only in the script:</p>
<pre>sed -i 's_^hide=/home/\\$user/.adobe.*$_bindro=/home/\\$user/.adobe      # bind folder read-only_g' /usr/bin/sandfox
sed -i 's_^hide=/home/\\$user/.macromedia.*$_bindro=/home/\\$user/.macromedia # bind folder read-only_g' /usr/bin/sandfox</pre>
<p>After this, the Sandfox package could be put on hold to prevent it from updating (thereby preserving changes made to the script):</p>
<pre>echo sandfox hold | sudo dpkg --set-selections</pre>
<p><strong><u>Under the Hood</u></strong></p>
<p>A few options on the system-level can help improve performance and help unexpected delays.</p>
<p><strong>No Timestamping on File Access</strong></p>
<p>Since Linuxs&#8217; early days the kernel behavior has been to re-date a files&#8217; timestamp every time a file is accessed.  This reasoning goes back to its&#8217; server days when users were more interested in knowing when a file was accessed rather then when it was edited (written to).  For desktop users however the expected behavior is for the timestamp of a file to be when it was last edited.  Tagging the option <code>noatime</code> to the filesystem will give the expected behavior, also this option additionally improves system performance by saving a number of writes to the disk.  See more on this <a href="/2011/12/12/a-beautiful-fstab/" target="_blank">here</a>.</p>
<p><strong>Swap Value</strong></p>
<p>For computers with plenty of memory available (1 Gigabyte will be enough for most uses), lowering <a href="https://wiki.archlinux.org/index.php/Swap#Swappiness" target="_blank">swap priority</a> can help improve performance.  To change immediately do:</p>
<pre>sudo sysctl -w vm.swappiness=20
sudo sysctl -w vm.vfs_cache_pressure=50</pre>
<p>And to have it as this value used regularly add the values to <code>/etc/sysctl.conf</code>:</p>
<pre>vm.swappiness=20
vm.vfs_cache_pressure=50</pre>
<p><strong>Match Filesystem Check Times</strong></p>
<p>If more than one partition is used, having filesystem check times run at the same time will cause less number of unexpected boot delays.  This can be done with <strong>tune2fs</strong> (Ubuntus&#8217; default value is 33 mounts and six months):</p>
<pre>sudo tune2fs -c 33 -C 0 -i 6m -T now /dev/partition1
sudo tune2fs -c 33 -C 0 -i 6m -T now /dev/partition2</pre>
<p><strong><u>Other Programs</u></strong></p>
<p>Other useful programs are these (most are additional command line utilities that come in useful down the road):</p>
<pre>sudo apt-get install cd-discid curl dos2unix dnsmasq epiphany-browser gdebi gimp gparted imagemagick inkscape iotop irssi lame librsvg2-bin links mp3gain msmtp openjdk-6-jre p7zip pdftk ppa-purge pwgen realpath ripit ruby tree unrar vim xclip</pre>
<p>Vims is set up well as is, but to make it even better use a more-optioned configuration:</p>
<pre>sudo mv /etc/vim/vimrc{,.bak}
sudo cp /usr/share/vim/vim73/vimrc_example.vim /etc/vim/vimrc</pre>
<p>Being on the Internet a good deal a Domain Name Server address cache/query daemon can help a lot with improving web browser load times, particularly during busy hours (the NetworkManager connection will need to be re-established afterward for changes to take effect):</p>
<pre>sudo sed -i 's:^#listen-address=:listen-address=127.0.0.1:g' /etc/dnsmasq.conf
sudo sed -i 's:^#prepend domain:prepend domain:' /etc/dhcp/dhclient.conf
sudo service dnsmasq restart</pre>
<p><strong><u>Extrenui</u></strong></p>
<ul>
<li><a href="/2011/10/05/stiffsticky-buttons-on-a-touchpad/" target="_blank">Missed Touchpad Button Clicks</a> &#8211; fix for a touchpad button that missed clicks regularly.</li>
<li><a href="/2008/02/28/ad-blocker-not-required-hosts-file/" target="_blank">Hosts File Help</a> &#8211; Only really a good idea for aging computers that can&#8217;t process complex ad-laden webpages.</li>
<li>Root Required &#8211; If around Linux for a bit eventually the root account will have to be used.  To work in a familiar environment when it root link common home settings: <code>sudo ln -s ~/.{bashrc,profile,vimrc,vim} /root</code></li>
</ul>
<p><strong><u>Editors&#8217; Opinion</u></strong></p>
<p>I&#8217;m happy with my setup.  Originally I had thought I&#8217;d go straight to Gnome 3 Fallback but I&#8217;ve stuck with Unity and I like the simplicity of it; plus it runs well.  With a desktop setup like this, I&#8217;m beginning to feel productive.  Thanks to Linux and Ubuntu engineers that made this possible.</p>
<p><strong><u>Links</u></strong></p>
<ul>
<li><a href="http://www.linuxbsdos.com/2011/04/09/gnome-3-from-an-end-users-perspective/" target="_blank">Gnome 3 (Shell) Perspective</a></li>
<li><a href="http://www.omgubuntu.co.uk/2011/10/gnome-shell-ubuntu-11-10-guide/" target="_blank">Gnome 3 Installation</a></li>
</ul>
<p><a href="http://linuxtidbits.files.wordpress.com/2012/01/screenshot-at-2012-01-05-125943.png"><img src="http://linuxtidbits.files.wordpress.com/2012/01/screenshot-at-2012-01-05-125943.png?w=474&#038;h=266" alt="" title="Screenshot at 2012-01-05 12:59:43" width="474" height="266" class="alignleft size-full wp-image-1735" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1729/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1729/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1729&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2012/01/06/ubuntu-oneiric-final-touches/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2012/01/ubuntu-final-touches-150.png" medium="image">
			<media:title type="html">Ubuntu Final Touches-150</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2012/01/04-amalgamated.png" medium="image">
			<media:title type="html">04 Amalgamated</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2012/01/screenshot-at-2012-01-05-125943.png" medium="image">
			<media:title type="html">Screenshot at 2012-01-05 12:59:43</media:title>
		</media:content>
	</item>
		<item>
		<title>Western Digital My Book Essential External Hard Drive on Linux</title>
		<link>http://linuxtidbits.wordpress.com/2011/12/26/western-digital-my-book-essential-external-hard-drive-on-linux/</link>
		<comments>http://linuxtidbits.wordpress.com/2011/12/26/western-digital-my-book-essential-external-hard-drive-on-linux/#comments</comments>
		<pubDate>Mon, 26 Dec 2011 16:46:22 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[external hard drives]]></category>
		<category><![CDATA[linux desktop]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1713</guid>
		<description><![CDATA[I decided to sell my desktop computer and use my laptop exclusively, I had no need to keep another computer and since I was only using it for doing backups I decided it would be better to save some space. I choose to get a Western Digital because they have been so reliable to me [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1713&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://linuxtidbits.files.wordpress.com/2011/12/harddrive-150.png"><img src="http://linuxtidbits.files.wordpress.com/2011/12/harddrive-150.png?w=474" alt="" title="harddrive-150"   class="alignright size-full wp-image-1709" /></a>I decided to sell my desktop computer and use my laptop exclusively, I had no need to keep another computer and since I was only using it for doing backups I decided it would be better to save some space.</p>
<p>I choose to get a Western Digital because they have been so reliable to me in the past.  Of the external hard drives available at Wal-Mart it initially appeared not the be the best value.  A Seagate right next to it was also a terabtye in storage capacity but also had USB 3.0 capability for only $15 dollars more.  The WD Essentials has only USB 2.0 and I know that 3.0 is supposed to be considerable faster than 2.0.  However, for me, my laptop is only USB 1.0 so this didn&#8217;t factor into it; also, because I am only using this for backups, time isn&#8217;t much of a factor and I prefer to have the reliability of the Western Digital name.</p>
<p><a href="http://linuxtidbits.files.wordpress.com/2011/12/wdmybookessential.png"><img src="http://linuxtidbits.files.wordpress.com/2011/12/wdmybookessential.png?w=474" alt="" title="wdmybookessential"   class="alignleft size-full wp-image-1711" /></a>The My Book Essential HD has a capacity meter on the front to display how full the disk is.  I learned though, unfortunately, that this only works through the Windows driver and using the NTFS file system.  Because I&#8217;m going to be using this for backups on Linux with ext4 this feature isn&#8217;t available.</p>
<p>Since I have a Windows system installed I retrospectively learned that it is a good idea to install the driver/software for the drive there to setup the drive for only the reason so that I could disable the VCD.  The Virtual CD Drive is a built-in memory chip that registers to the operating system as a regular CD drive.  On it it contains the driver/software installer and manual.  As far as the driver/software goes its nicer than I&#8217;ve seen of other hardware&#8217;s software, it was lightweight, easy to use, and with no frills.  For Linux though the driver/software is unecessary as it is automatically recognized and working out of the box.  I disabled the VCD drive with the Windows software though to keep the VCD from popping up when I loaded my Linux desktop.</p>
<p>I ran a S.M.A.R.T. conveyance test and extended test on it then did a thorough badblocks write test that took about 24 hours&#8230; all tests passed.</p>
<p>Formatting to ext4, the drive works perfectly in Linux without any additional configuration (besides <code>noatime</code>.  I&#8217;ve been using the hard drive the last couple of months and I&#8217;m real happy with it: it&#8217;s small, quiet, and has done it&#8217;s job without a hitch.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1713/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1713&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2011/12/26/western-digital-my-book-essential-external-hard-drive-on-linux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/harddrive-150.png" medium="image">
			<media:title type="html">harddrive-150</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/wdmybookessential.png" medium="image">
			<media:title type="html">wdmybookessential</media:title>
		</media:content>
	</item>
		<item>
		<title>Display Size, DPI, and Text Size&#8230; an interesting DIY</title>
		<link>http://linuxtidbits.wordpress.com/2011/12/22/display-size-dpi-and-text-size-an-interesting-diy/</link>
		<comments>http://linuxtidbits.wordpress.com/2011/12/22/display-size-dpi-and-text-size-an-interesting-diy/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 18:28:05 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1685</guid>
		<description><![CDATA[I just got a new monitor to be able to use as an external monitor for my laptop. While I was setting it up I noticed that the monitors display size wasn&#8217;t correctly detected. The Xorg server does a good job auto-configuring however this caught my eye: $ xdpyinfo &#124; grep -B2 resolution dimensions: 1920x1080 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1685&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://linuxtidbits.files.wordpress.com/2011/12/preferences-desktop-display-150.png"><img src="http://linuxtidbits.files.wordpress.com/2011/12/preferences-desktop-display-150.png?w=474" alt="" title="preferences-desktop-display-150"   class="alignright size-full wp-image-1686" /></a>I just got a new monitor to be able to use as an external monitor for my laptop.  While I was setting it up I noticed that the monitors display size wasn&#8217;t correctly detected.  The Xorg server does a good job auto-configuring however this caught my eye:</p>
<pre>$ xdpyinfo | grep -B2 resolution
  dimensions:    1920x1080 pixels (508x286 millimeters)
  resolution:    96x96 dots per inch</pre>
<p>The monitor I got is a 21.5&#8243; monitor so I figured the DPI was off.  I decided to calculate it myself (this is a square pixel monitor):</p>
<pre>res_horz=1920
res_vert=1080
res_diag=$(echo "scale=5;sqrt($res_horz^2+$res_vert^2)" | bc)
siz_diag=21.5
siz_horz=$(echo "scale=5;($siz_diag/$res_diag)*$res_horz*25.4" | bc)
siz_vert=$(echo "scale=5;($siz_diag/$res_diag)*$res_vert*25.4" | bc)

echo "$siz_horz"x"$siz_vert"
475.48800x267.46200</pre>
<p>Also there are online DPI Calculators ([<a href="http://members.ping.de/~sven/dpi.html" target="_blank">1</a>] [<a href="http://pxcalc.com/" target="_blank">2</a>]) and xrandr:</p>
<pre>em_ds_h=$(xrandr | grep VGA-0 | rev | cut -d " " -f 3 | rev | sed 's/mm//')
em_ds_v=$(xrandr | grep VGA-0 | rev | cut -d " " -f 1 | rev | sed 's/mm//')
em_ds="$em_ds_h"x"$em_ds_v"

echo $em_ds
477x268</pre>
<p>My discovered value and theirs are a couple millimeters off overall so I just used theirs.  I created a configuration to define the display size to the the Xorg server.  A basic configuration to <a href="https://wiki.archlinux.org/index.php/Xorg#Display_Size_and_DPI" target="_blank">define display size</a> can be done like this:</p>
<p><code>
<pre>cat /usr/share/X11/xorg.conf.d/90-monitor-disp-size.conf
Section "Monitor"
  Identifier "&#060;default monitor&#062;"
  DisplaySize 477 268
EndSection</pre>
<p></code></p>
<p>Ubuntu uses <code>/usr/share/X11/xorg.conf.d/</code> Arch Linux and some other use <code>/etc/X11/xorg.conf.d/</code> (better choice I think).  However this won&#8217;t work on the external monitor.  So I expanded on it (more than it probably needed to be) by defining both monitors and related sections:</p>
<pre>Section "Monitor"
  Identifier    "Internal - Pavilion Laptop"
  DisplaySize    304.5 228.6
EndSection

Section "Monitor"
  Identifier    "External - Samsung Syncmaster SA350"
  VendorName    "Samsung"
  ModelName     "SA300/SA350"
  DisplaySize    476 267.7
EndSection

Section "Device"
  Identifier    "ATI Radeon Mobility IGP 330M"
  Option        "Monitor-VGA-0"  "External - Samsung Syncmaster SA350"
  Option        "Monitor-LVDS"   "Internal - Pavilion Laptop"
EndSection

Section "Screen"
  Identifier    "Default Screen"
  Monitor       "Internal - Pavilion Laptop"
EndSection

Section "ServerLayout"
  Identifier    "Default Layout"
  Screen        "Default Screen"
EndSection</pre>
<p>I added <code>VendorName</code> and <code>ModelName</code> but I&#8217;m not sure they uniquely define the monitor so that the Xorg server acknowledges them.  The <code>VendorName</code> I believe is just for reference, <code>ModelName</code> can usually be discovered by doing:</p>
<pre>grep "Monitor name" /var/log/Xorg.0.log</pre>
<p><b>Monitor-VGA-0</b> and <b>Monitor-LVDS</b> define the ports and hence by reference should uniquely define the monitor (<code>xrandr -q</code> shows them and both are found in the Xorg log).</p>
<p>After a bit of research I discovered that there is a good amount of history concerning the Xorg server having a bit of trouble in not being able to correctly discover the display size.  I believe this may be related to some drivers.  I&#8217;ve <a href="https://bbs.archlinux.org/viewtopic.php?pid=1030929#p1030929" target="_blank">been told</a> the open-source ATI driver have had problems and read in some other places of other people who have had similar issues.  Defining the display size in the configuration and telling the Xorg server not to use the auto-detected value can be done by adding this to the Devices section (for Nvidia drivers use: <code>Option "UseEDID" "FALSE"</code>): </p>
<pre>  Option        "NoDDC"</pre>
<p>Unfortunately, this didn&#8217;t work either and left me completely at a loss.  Unsure how to go further to define display size in the the Xorg server configuration I decided to define it through <strong>xrandr</strong>.</p>
<p>xrandr has an option to define the display size with the <code>--fbmm</code> option:</p>
<pre>xrandr --output VGA-0 --auto -fbmm 476x267.7</pre>
<p><code>--auto</code> uses the default/preferred mode of the monitor.</p>
<p>My purpose became to have a script that if the external monitor is present it will be enabled with the correct display size and then disable the laptop monitor; if an external monitor is not detected the laptop monitor is enabled with the correct display size.  xrandr looks to detect the display size accurately so that value was used.  Because the script detects the display size and uses the preferred display mode it should work for other that would like to do the same thing.</p>
<p>Also, I also added a section for Gnome&#8217;s text scaling.  Gnome assumes monitors are 96 DPI for multiple monitor setups which makes fonts will look small on a lot of newer monitors (higher DPI monitors).  I found out though that when this is adjusted corrently that the scaled font size is slightly larger than my personal preference would be.  In the script I adjusted it to be a little less (see variables <code>em_text_scale_adj</code> and <code>im_text_scale_adj</code> in script).</p>
<p><pre class="brush: plain;">#!/bin/bash
# externalmonitor - toggle between laptop and external monitor

# Laptop and external monitor relays (ports)
int_mon=&quot;LVDS&quot;    # Pavilion ze5570 1024x768
ext_mon=&quot;VGA-0&quot;   # Samsung SA350   1920x1080

# Discover if external monitor is connected
em_test=$(xrandr | grep $ext_mon | grep &quot; connected&quot;)

# Enable external monitor if present and disable laptop monitor, else vice versa
if [ -n &quot;$em_test&quot; ]; then
  # External monitor definitions:
  # physical screen size from xrandr (xorg detection isn't right)
  xrandr --output $ext_mon --auto  # monitor must be on to get display size
  em_ds_h=$(xrandr | grep $ext_mon | rev | cut -d &quot; &quot; -f 3 | rev | sed 's/mm//')
  em_ds_v=$(xrandr | grep $ext_mon | rev | cut -d &quot; &quot; -f 1 | rev | sed 's/mm//')
  em_ds=&quot;$em_ds_h&quot;x&quot;$em_ds_v&quot;
  xrandr --output $int_mon --off --output $ext_mon --auto --fbmm $em_ds
else
  # physical screen size from xrandr (xorg detection isn't right)
  xrandr --output LVDS --auto     # monitor must be on to get display size
  im_ds_h=$(xrandr | grep $int_mon | rev | cut -d &quot; &quot; -f 3 | rev | sed 's/mm//')
  im_ds_v=$(xrandr | grep $int_mon | rev | cut -d &quot; &quot; -f 1 | rev | sed 's/mm//')
  im_ds=&quot;$im_ds_h&quot;x&quot;$im_ds_v&quot;
  xrandr --output LVDS --auto --fbmm $im_ds
fi

# Text scaling: font scaling correction depending on DPI (adjusted here because
# Gnome considers every monitor 96 DPI for multi-monitors setups (makes 
# multiple monitors have the same text sizes).  Detection assumes square pixels.
if [ -n &quot;$em_test&quot; ]; then
  # horizontal resolution (using preferred [xrandr --auto]); , to calculate DPI.
  em_res_h=$(xrandr | awk &quot;/$em_ds_h/,/\+$/&quot; | grep +$ | awk '{print $1}' | \
             cut -d x -f 1)
  # dpi
  em_dpi=$(echo &quot;scale=3;($em_res_h*25.4)/$em_ds_h&quot; | bc)
  em_txt_scale=$(echo &quot;scale=4;$em_dpi/96&quot; | bc)
  em_txt_scale=$(scale=3;echo &quot;$em_txt_scale * 0.955&quot; | bc)     # fonts too big
  gsettings set org.gnome.desktop.interface text-scaling-factor $em_txt_scale
else
  # horizontal resolution
  im_res_h=$(xrandr | awk &quot;/$im_ds_h/,/\+$/&quot; | grep +$ | awk '{print $1}' | \
             cut -d x -f 1)
  # dpi
  im_dpi=$(echo &quot;scale=3;($im_res_h*25.4)/$im_ds_h&quot; | bc)
  im_txt_scale=$(echo &quot;scale=4;$im_dpi/96&quot; | bc)
  im_txt_scale=$(scale=3;echo &quot;$im_txt_scale * 0.955&quot; | bc)     # fonts too big
  gsettings set org.gnome.desktop.interface text-scaling-factor $im_txt_scale
fi</pre></p>
<p>To have the script automatically run on login place it as <code>~/.config/autostart/externalmonitor.desktop</code>:</p>
<pre>[Desktop Entry]
Type=Application
Exec=/home/USERNAME/SCRIPT-DIRECTORY/externalmonitor
Icon=gnome-display-properties
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=External Monitor Configure
Comment=Enable external monitor if connected and disable laptop monitor, otherwise enable laptop monitor (also sets text scaling value).</pre>
<p>I can&#8217;t tell you what a pleasant experience it is to have a display that is comfortable to look at.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1685/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1685/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1685/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1685/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1685/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1685/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1685/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1685/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1685/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1685/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1685/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1685/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1685/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1685/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1685&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2011/12/22/display-size-dpi-and-text-size-an-interesting-diy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/preferences-desktop-display-150.png" medium="image">
			<media:title type="html">preferences-desktop-display-150</media:title>
		</media:content>
	</item>
		<item>
		<title>A Journey of Fidelity (As Luck Has It)</title>
		<link>http://linuxtidbits.wordpress.com/2011/12/17/a-journey-of-fidelity-as-luck-has-it/</link>
		<comments>http://linuxtidbits.wordpress.com/2011/12/17/a-journey-of-fidelity-as-luck-has-it/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 21:40:48 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1675</guid>
		<description><![CDATA[A few weeks ago, my monitor kept blanking out on me. I&#8217;d been having a couple troubles with X crashes so I attributed them to that. I had been wanting to change my partitioning scheme so I decided to just re-install and use the older version for awhile (thinking the problem came after an update). [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1675&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://linuxtidbits.files.wordpress.com/2011/12/country-side.png"><img src="http://linuxtidbits.files.wordpress.com/2011/12/country-side.png?w=474" alt="" title="country-side"   class="alignright size-full wp-image-1676" /></a>A few weeks ago, my monitor kept blanking out on me.  I&#8217;d been having a couple troubles with X crashes so I attributed them to that.  I had been wanting to change my partitioning scheme so I decided to just re-install and use the older version for awhile (thinking the problem came after an update).  So I installed Windows, then started Parted Magic&#8217;s Gparted to resize the NTFS partition only to get 22 Unaccounted Clusters errors.  &#8216;<tt>ntfsresize</tt>&#8216; (which GParted uses) does a filesystem integrity check before resizing I found out.  Thinking that Windows must not have unmounted the disk cleanly on shutdown, I rebooted and forced a filesystem check&#8230; no errors.  When I went back and tried again, I got the same problem.  I learned that there are different versions of the NTFS filesystem so I reinstalled Windows again and let the Windows installer format the partition instead of Gparted which I had done previously.  When I went to resize again, I got the same problem.  Here I eventually came to the conclusion that very possibly my hard drive was failing on me.  This threw me off because my drive was only a year and a half old and because it was a Western Digital.  Nonetheless, I had to check.  So I ran a S.M.A.R.T conveyance test and then an extended test.  Both tests passed.  I knew (&#8230;Ughh!) that I&#8217;d have to run a &#8216;<tt>badblocks</tt>&#8216; test.  I ran a non-destructive test (&#8230; long wait here) and discovered I had <b>44</b> bad sectors on my hard drive.  I checked the Western Digital website (who had a very nice warranty check/RMA program) and thankfully my drive was still under warranty.  I got a replacement drive (in only two days!!), did tests this time, and installed Windows again.  When I went to resize&#8230; uggggh, I got the same problem again.  At this point, I got out an older version of Parted Magic (6.3) and everything worked&#8230; perfectly.</p>
<p>Through all this the fun part was my monitor which kept blanking out on me (its just getting old) and was only able to read the screen for about a minute at a time.</p>
<p>I got a new monitor now too and am doing good again.  It turns out that &#8216;<tt>ntfsresize</tt>&#8216; had a bug in it.  I&#8217;m not sure what version of &#8216;<tt>ntfsresize</tt>&#8216; had the bug but it&#8217;s also on the Ubuntu 11.10 install disk.  I upgraded to Parted Magic 11-11-11 and was able to resize my NTFS partition.</p>
<p>On this journey I learned is to never buy a a new drive and not test it, que sera sera.  Because of this, I wrote <a href="https://wiki.archlinux.org/index.php/Badblocks" target="_blank">badblocks</a> page on the Arch Wiki for reference.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1675/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1675&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2011/12/17/a-journey-of-fidelity-as-luck-has-it/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/country-side.png" medium="image">
			<media:title type="html">country-side</media:title>
		</media:content>
	</item>
		<item>
		<title>A Beautiful fstab</title>
		<link>http://linuxtidbits.wordpress.com/2011/12/12/a-beautiful-fstab/</link>
		<comments>http://linuxtidbits.wordpress.com/2011/12/12/a-beautiful-fstab/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 14:28:10 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1665</guid>
		<description><![CDATA[I know what partitions I have and like to know what is mounted and where. To do this, I keep a tidy static filesystem file (/etc/fstab). I use labels instead of UUID&#8217;s just because they look nicer, but also because this allows me to resize them if need be. It&#8217;s hard to go wrong with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1665&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://linuxtidbits.files.wordpress.com/2011/12/shellscript.png"><img src="http://linuxtidbits.files.wordpress.com/2011/12/shellscript.png?w=474" alt="" title="shellscript"   class="alignright size-full wp-image-1666" /></a>I know what partitions I have and like to know what is mounted and where.  To do this, I keep a tidy static filesystem file (<tt><a href="https://wiki.archlinux.org/index.php/Fstab" target="_blank">/etc/fstab</a></tt>).</p>
<p>I use labels instead of UUID&#8217;s just because they look nicer, but also because this allows me to resize them if need be.  It&#8217;s hard to go wrong with UUID&#8217;s but since I know I likely won&#8217;t be putting a USB drive named &#8216;Windows&#8217; or &#8216;Ubuntu&#8217; in the USB port, I&#8217;m likely pretty safe.  You may have noticed too that I choose not let HAL/DBUS (is it dbus that does mounting now?) handle my Windows and Storage partitions.  I choose to do this for several reasons.  One is because when I copy files I almost always find it much quicker from the command line (i.e. <tt>cp file1 file2 ... /mnt/Storage/backups/</tt>) rather than navigate through multiple directories in the file browser.  The second reason is for security because sensitive data I don&#8217;t always want available.  The third is to protect the Windows partition.  If a crash were to happen, I find it a good inconvenience to have to boot Windows to be able to fix the NTFS volume.</p>
<p>Here it is:</p>
<pre># /etc/fstab: static file system information.

#
# temporary file systems:
proc            /proc           proc    nodev,noexec,nosuid             0 0

# internal hard disk (sda[1-4}):
LABEL=Windows   /mnt/Windows    ntfs-3g noatime,noauto,user             0 0
LABEL=Ubuntu    /               ext4    errors=remount-ro,noatime       0 1
LABEL=Home      /home           ext4    noatime                         0 2
LABEL=Swap      none            swap    defaults                        0 0

# external hard disk (sdb1)
LABEL=Storage   /mnt/Storage    ext4    noatime,noauto,user             0 3</pre>
<p><tt>noatime</tt> has been applied to save disk writes and unnecessary timestamps everytime the file is accessed, and the user option allows me to mount without superuser privileges.  For the Windows partition to be able mounted as a regular user, the NTFS-3G driver will need to be <a href="/2011/12/10/mounting-a-windows-ntfs-partition-as-a-regular-user-ubuntu/">compiled with internal FUSE support</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1665/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1665/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1665/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1665&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2011/12/12/a-beautiful-fstab/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/shellscript.png" medium="image">
			<media:title type="html">shellscript</media:title>
		</media:content>
	</item>
		<item>
		<title>Mounting a Windows NTFS Partition as a Regular User (Ubuntu)</title>
		<link>http://linuxtidbits.wordpress.com/2011/12/10/mounting-a-windows-ntfs-partition-as-a-regular-user-ubuntu/</link>
		<comments>http://linuxtidbits.wordpress.com/2011/12/10/mounting-a-windows-ntfs-partition-as-a-regular-user-ubuntu/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 20:47:47 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1652</guid>
		<description><![CDATA[To be able to mount a Windows NTFS partition in Linux as a regular user (e.g. mount /dev/sda1 /mnt/Windows), rebuilding the driver with internal FUSE (Filesystem in USErspace) support is required, and then setting correct permissions is needed. Download and Compile First setting a couple variables eases the process: blddir=~/Downloads/build # A good place to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1652&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://openclipart.org/detail/20973/icon-hard-disk-by-rg1024"><img src="http://linuxtidbits.files.wordpress.com/2011/12/rg1024_icon_hard_disk.png?w=150&#038;h=109" alt="" title="rg1024_icon_hard_disk" width="150" height="109" class="alignright size-thumbnail wp-image-1653" /></a>To be able to mount a Windows NTFS partition in Linux as a regular user (e.g. <tt>mount /dev/sda1 /mnt/Windows</tt>), rebuilding the driver with internal FUSE (Filesystem in USErspace) support is required, and then setting correct permissions is needed.</p>
<p><strong>Download and Compile</strong></p>
<p>First setting a couple variables eases the process:</p>
<pre>blddir=~/Downloads/build      # A good place to do compiling
pkgname=ntfs-3g               # The package/driver name</pre>
<p>Here the package version variables defined to match the actual extracted package source namings (why 1: gets prepended and 2ubuntu3 gets appended I&#8217;m unsure of):</p>
<pre>pkgname_ver=$(dpkg -l | grep ^[i,h]i | awk '{print $2"_"$3}' | grep $pkgname | sed 's/1://')
PKGNAME_VER=$(echo $pkgname_ver | sed 's/\(.*\)-.*/\1/')</pre>
<p>Install the compiling (building) programs and then packages need to build ntfs-3g:</p>
<pre>sudo apt-get install build-essential fakeroot dpkg-dev lynx devscripts
sudo apt-get build-dep $pkgname</pre>
<p>Create the building directories and change to it&#8217;s directory:</p>
<pre>[ ! -d "$blddir" ] &amp;&amp; mkdir -p "$blddir"
cd "$blddir"
[ ! -d "$pkgname" ] &amp;&amp; mkdir "$pkgname"
cd "$pkgname"</pre>
<p>Download the source code (which gets extracted after downloading):</p>
<pre>apt-get source "$pkgname"</pre>
<p>The source code is oddly owned by root, to make it editable change it&#8217;s permissions:</p>
<pre>sudo chown -R username:username .</pre>
<p>Entering the source code directory (required to build):</p>
<pre>cd "$PKGNAME_VER"</pre>
<p>Change the FUSE option to internal, comment the change, then compile:</p>
<pre>sed -i 's/--with-fuse=external/--with-fuse=internal/g' debian/rules
dch -i "Changed fuse option to internal in configuration rules"
dpkg-buildpackage -rfakeroot -b</pre>
<p>Replace the current NTFS-3G driver with the one just compiled with internal FUSE support:</p>
<pre>sudo gdebi ntfs-3g_2011.4.12AR.4-2ubuntu3_i386.deb</pre>
<p>And hold (freeze) the package so it doesn&#8217;t get updated with a new version on a system update:</p>
<pre>echo ntfs-3g hold | sudo dpkg --set-selections</pre>
<p>The driver will need to be set to setuid-root (there are risks doing this, read <a href="http://www.tuxera.com/community/ntfs-3g-faq/#unprivileged" target="_blank">this</a> for more information):</p>
<pre>sudo chown root $(which ntfs-3g)
sudo chmod 4755 $(which ntfs-3g)</pre>
<p>Finally, give the user the ability to be able to mount volumes:</p>
<pre>sudo gpasswd -a username disk</pre>
<p>Reboot to have the new driver loaded and the user to be put in the disk group.</p>
<p><strong>Mounting</strong></p>
<p>The <tt>fstab</tt> will need to have the right options to be able to mount as a regular user.  In my <a href="/2011/12/12/a-beautiful-fstab/" target="_blank">next post</a>, I&#8217;ll show what my <tt>fstab</tt> looks like.</p>
<p><strong>Bug Fix</strong></p>
<p>I had a problem with gcc-4.6_4.6.1 on my install.  It would error out at the beginning of a compile.  The workaround for me was to use an earlier version of GCC and then define it when compiling:</p>
<pre>sudo apt-get install gcc-4.4
CC=gcc-4.4 dpkg-buildpackage -rfakeroot -b</pre>
<p><strong>Resources</strong></p>
<ul>
<li><a href="http://www.cyberciti.biz/faq/rebuilding-ubuntu-debian-linux-binary-package/" target="_blank">Rebuilding Ubuntu/Debian Linux Binary Packages</a></li>
<li><a href="https://bbs.archlinux.org/viewtopic.php?pid=792249#p792249" target="_blank">Arch Linux forums post on user-mounting NTFS drives</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1652/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1652/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1652/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1652&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2011/12/10/mounting-a-windows-ntfs-partition-as-a-regular-user-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/rg1024_icon_hard_disk.png?w=150" medium="image">
			<media:title type="html">rg1024_icon_hard_disk</media:title>
		</media:content>
	</item>
		<item>
		<title>Storing login/password Websites in a File</title>
		<link>http://linuxtidbits.wordpress.com/2011/12/09/lpsites-record-loginpassword-websites/</link>
		<comments>http://linuxtidbits.wordpress.com/2011/12/09/lpsites-record-loginpassword-websites/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 01:22:18 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1640</guid>
		<description><![CDATA[I find that it is a good idea to update my Internet passwords from time to time. Previously to do so, I opened Firefox&#8217;s Preferences window and then went to the Saved Passwords window. From here, I&#8217;d toggle between Firefox and the Saved Passwords window, goto the sites that were listed, and change the password. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1640&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://linuxtidbits.files.wordpress.com/2011/12/1270238965.png"><img src="http://linuxtidbits.files.wordpress.com/2011/12/1270238965.png?w=150&#038;h=150" alt="" title="1270238965" width="150" height="150" class="alignright size-thumbnail wp-image-1646" /></a>I find that it is a good idea to update my Internet passwords from time to time.  Previously to do so, I opened Firefox&#8217;s <strong>Preferences</strong> window and then went to the <strong>Saved Passwords</strong> window.  From here, I&#8217;d toggle between Firefox and the Saved Passwords window, goto the sites that were listed, and change the password.  After doing this, I decided it would be quicker if I just had them in a text file.  In the text file once I had updated the password on the website, I&#8217;d comment the line so I&#8217;d know I had done so.  For text editing, I commonly use <a href="https://wiki.archlinux.org/index.php/Vim" target="_blank">Vim</a> and it works great for this.  I created a script to make this easy.  It works like this:</p>
<pre># lplist a http://edit.yahoo.com</pre>
<p>It adds and sorts the websites:</p>
<pre>...

http://twitter.com/

http://ubuntuforums.org/

http://wordpress.com/

...</pre>
<p>The nice thing about working in the terminal too is that once the text file is opened the webpages can be opened by Ctrl clicking on them.</p>
<p>Later when I need to updated the passwords again, lplist</code> has a <b>s</b> switch that uncomments the file:</p>
<pre># lplist s
 Uncomment pass/login websites file? (y/n):</pre>
<p>Works good for me.  Here's the script:</p>
<p><pre class="brush: plain;">#!/bin/bash
# lplist - list of programs and websites using common password

scrpt=${0##*/}        # script name
lpfile=~/.lplist.txt  # filename of list

# Display usage if no parameters given
if [[ -z &quot;$@&quot; ]]; then
  echo &quot;$scrpt &lt;option&gt; &lt;*add entry&gt; - list of programs/sites using common pw
  a | add   - add entry to list
  e | edit  - edit list
  s | sort  - sort list alphabetically
  u | uncom - uncomment list for new password&quot;
  exit
fi

case $1 in
  # Add entry, sort, remove blank lines from list
  a | add  )  shift
              echo &quot;$@&quot; &gt;&gt; &quot;$lpfile&quot;
              sort -uV &quot;$lpfile&quot; -o &quot;$lpfile&quot;
              sed -i '/^$/d' &quot;$lpfile&quot;
              ;;
  # Edit list
  e | edit )  vim &quot;$lpfile&quot;
              ;;
  # Sort, remove blank lines from list
  s | sort )  sort -uV &quot;$lpfile&quot; -o &quot;$lpfile&quot;
              sed -i '/^$/d' &quot;$lpfile&quot;
              ;;
  # Uncomment lines from list
  u | uncom ) read -p &quot; Uncomment pass/login websites file? (y/n): &quot; uncomment
              if [ &quot;$uncomment&quot; = &quot;y&quot; ]; then
                sed -i 's/^#\([a-z,A-Z]\)/\1/g' &quot;$lpfile&quot;
              fi
              ;;
  # Unknown option help
  *         ) echo &quot;Unknown option&quot;
              ;;
esac</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1640/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1640/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1640/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1640&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2011/12/09/lpsites-record-loginpassword-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/12/1270238965.png?w=150" medium="image">
			<media:title type="html">1270238965</media:title>
		</media:content>
	</item>
		<item>
		<title>Say Goodbye to Swap Partition</title>
		<link>http://linuxtidbits.wordpress.com/2011/11/20/say-goodbye-to-swap-partition/</link>
		<comments>http://linuxtidbits.wordpress.com/2011/11/20/say-goodbye-to-swap-partition/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 10:12:42 +0000</pubDate>
		<dc:creator>Todd Partridge (Gen2ly)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://linuxtidbits.wordpress.com/?p=1618</guid>
		<description><![CDATA[Update: 12/10/2011 &#8211; Having occasional bugs with uswsusp suspending improperly has unfortunately led me to revert to using the kernel method of suspending and using a swap partition. 12/01/2011 &#8211; Appreciate the comments that had good points. Post updated: first, changed swap fstab entry to show proper none mount point. Second, added two methods to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1618&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://linuxtidbits.files.wordpress.com/2011/11/swap-icon.jpg"><img src="http://linuxtidbits.files.wordpress.com/2011/11/swap-icon.jpg?w=474" alt="" title="swap-icon"   class="alignright size-full wp-image-1619" /></a></p>
<p>
<div style="overflow:auto;width:auto;border:solid #bab363;background-color:#faf7d8;font-size:1em;color:#4f4c2a;border-width:.1em .8em;padding:.3em .6em;"><strong>Update: </strong><br />
12/10/2011 &#8211; Having occasional bugs with uswsusp suspending improperly has unfortunately led me to revert to using the kernel method of suspending and using a swap partition.</p>
<p>12/01/2011 &#8211; Appreciate the comments that had good points.  Post updated: first, changed swap <tt>fstab</tt> entry to show <em>proper</em> <b><tt>none</tt></b> mount point.  Second, added two methods to be able to use hibernation with a swap file.</div>
</p>
<p></p>
<p>I decided not to clutter my partitioning scheme anymore with a swap partition so from now on I&#8217;m using a swap file instead.  This shows how to do use a create and use swap file during installation.</p>
<p><b>Create the Swap File</b></p>
<p>Boot the install disk and load Linux (for Ubuntu use the &#8216;Try Ubuntu&#8217; to get to a functioning environment).  Partition now (if required, GParted recommended) as it is generally easier than using the installer partitioner.  When partitioning is done open the terminal so the swap file can be created.</p>
<p>You&#8217;ll need the kernel-defined root partition name (if you don&#8217;t already know it):</p>
<pre>sudo fdisk -l | grep ^/dev</pre>
<p>To simplify tasks define the root partition as a variable.  For example, if your root partition is sda2:</p>
<pre>root_part=sda2</pre>
<p>Create the mount point and mount the partition:</p>
<pre>sudo mkdir /mnt/$root_part &amp;&amp; sudo mount /dev/$root_part /mnt/$root_part</pre>
<p>Create the swap file (this is created before doing the install so it&#8217;s at the beginning of the partition) by doing:</p>
<pre>fallocate -l 1G /mnt/$root_part/swapfile  # G = Gigabyte, M = Megabyte
chmod 600 /mnt/$root_part/swapfile
mkswap /mnt/$root_part/swapfile</pre>
<p>Unmount, then install your system:</p>
<pre>umount /mnt/$root_part</pre>
<p><b>Install your System</b></p>
<p>Install as normal.  With the installer, define the partition(s) to the desired mount point (for example, <tt>sda2</tt> to be <b><tt>/</tt></b> (root), <tt>sda3</tt> to be <b><tt>/home</tt></b>?,&#8230;).</p>
<p><b>List the Swap File</b></p>
<p>After the install has completed, the swap file information will need to be listed in the static filesystem configuration file (<tt>fstab</tt>).  </p>
<p>To do this, the partition will likely need to be mounted again:</p>
<pre>sudo mount /dev/$root_part /mnt/$root_part</pre>
<p>Add the swap file to root partition <tt>fstab</tt> file using the editor of choice (for example: <tt>gksudo gedit /mnt/$root_part/etc/fstab</tt>) and adding:</p>
<pre>/swapfile none swap defaults 0 0</pre>
<p><b>Define the Kernel Options</b></p>
<p>After the install has completed, the swap file location will need to be defined as a kernel option to the bootloader.</p>
<p>Change apparent root (to be able to update the bootloader later):</p>
<pre>for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$root_part$i; done
chroot /bin/bash /mnt/$root_part</pre>
<p>Get root parition UUID (partition Unique IDentifier):</p>
<pre>blkid | grep /dev/STORAGE-DEVICE-ROOT-PARTITION</pre>
<p>Get the swap file first block physical location on the partition by running the command (the value needed is given on the first row of the &#8216;physical&#8217; column):</p>
<pre>filefrag -v /swapfile</pre>
<p>The bootloader will need the kernel options defining the swap file partition UUID and first block physical location of the swap file (resume_offset) in this form:</p>
<pre>resume=UUID=the-root-partition-UUID resume_offset=the-swap-file-physical-address</pre>
<p>These will need to be added to the configuration file.  For the original GRUB (GRUB Legacy), edit <tt>/boot/grub/menu.lst</tt> and add to the kernel line the above kernel options.  For GRUB2, edit <tt>/etc/default/grub</tt> and add the kernel options to the <tt>GRUB_CMDLINE_LINUX_DEFAULT="..."</tt> line, then:</p>
<pre>update-grub</pre>
<p>Also the initial ram filesystem (basically a device/software loader for items that need initialized during kernel boot) may need this information as well.  For Ubuntu, define the kernel options by doing:</p>
<pre>echo "resume=UUID=the-root-partition-UUID resume_offset=the-swap-file-physical-address" | sudo tee /etc/initramfs-tools/conf.d/resume
sudo update-initramfs -u</pre>
<p>Exit chroot, unmount, and reboot to new system:</p>
<pre>exit
for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$root_part$i; done
umount /mnt/$root_part</pre>
<p>Test now if hibernation works.  If it doesn&#8217;t you can try to add and switch to the &#8216;userspace&#8217; suspend framework instead.</p>
<p><b>Userspace Suspend/Hibernation</b></p>
<p><b><tt>uswsusp</tt></b> is a rewrite of the kernel suspend framework for use as a &#8216;userspace&#8217; tool.  It generally has better support for suspending to a swap file so using it here is generally necessary.</p>
<p>Reboot into the new operating system and install <b><tt>uswsusp</tt></b>.</p>
<p>Ubuntu pre-configures <b><tt>uswsusp</tt></b> (defines the root partition, gets the swap file size, runs <tt>sudo swap-offset /swapfile</tt>, places these values in the configuration file <tt>/etc/uswsusp.conf</tt>, then creates a new initramfs) so all that needed to do is install it.  Other distributions may need to configure it.  Once installed and configured, reboot again and test.</p>
<p><b>References</b></p>
<ul>
<li><a href="https://wiki.archlinux.org/index.php/Swap" target="_blank">Arch Wiki&#8217;s Swap Page</a></li>
<li><a href="http://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition" target="_blank">Hibernate Without Swap Partition</a></li>
<li><a href="http://ubuntuforums.org/showthread.php?t=1042946" target="_blank">HOWTO: Use swapfile instead of swap partition and have working hibernation</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/linuxtidbits.wordpress.com/1618/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/linuxtidbits.wordpress.com/1618/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/linuxtidbits.wordpress.com/1618/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/linuxtidbits.wordpress.com/1618/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/linuxtidbits.wordpress.com/1618/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/linuxtidbits.wordpress.com/1618/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/linuxtidbits.wordpress.com/1618/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/linuxtidbits.wordpress.com/1618/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/linuxtidbits.wordpress.com/1618/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/linuxtidbits.wordpress.com/1618/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/linuxtidbits.wordpress.com/1618/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/linuxtidbits.wordpress.com/1618/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/linuxtidbits.wordpress.com/1618/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/linuxtidbits.wordpress.com/1618/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=linuxtidbits.wordpress.com&amp;blog=1210515&amp;post=1618&amp;subd=linuxtidbits&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://linuxtidbits.wordpress.com/2011/11/20/say-goodbye-to-swap-partition/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80f26e1935b0884b8ea58d6b7744a36f?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=R" medium="image">
			<media:title type="html">toddpartridge</media:title>
		</media:content>

		<media:content url="http://linuxtidbits.files.wordpress.com/2011/11/swap-icon.jpg" medium="image">
			<media:title type="html">swap-icon</media:title>
		</media:content>
	</item>
	</channel>
</rss>
