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

<channel>
	<title>ten.ynottony.net &#187; How-to</title>
	<atom:link href="http://ten.ynottony.net/category/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://ten.ynottony.net</link>
	<description>He's at it again...</description>
	<lastBuildDate>Sat, 05 Feb 2011 11:21:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Speeding up Liferea</title>
		<link>http://ten.ynottony.net/2009/08/speeding-up-liferea/</link>
		<comments>http://ten.ynottony.net/2009/08/speeding-up-liferea/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 13:46:38 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[liferea]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=92</guid>
		<description><![CDATA[Liferea was taking a couple of minutes to open for me, so I thought I&#8217;d look for a solution to that. I have >100 feeds, but I&#8217;m not about to cut the amount down (not addicted, honest). Liferea stores a &#8230; <a href="http://ten.ynottony.net/2009/08/speeding-up-liferea/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Liferea was taking a couple of minutes to open for me, so I thought I&#8217;d look for a solution to that.  I have >100 feeds, but I&#8217;m not about to cut the amount down (not addicted, honest).</p>
<p>Liferea stores a lot of information in an sqlite database.  If sqlite databases aren&#8217;t vacuumed every now and then, they bloat and slow down.  </p>
<p>Most people know about speeding up Firefox by <a href="http://www.gettingclever.com/2008/06/vacuum-your-firefox-3.html">vacuuming the sqlite databases</a> every now and then.  Well, the same can be done with <a href="http://liferea.sourceforge.net/">Liferea</a>.<br />
Close Liferea and paste the following in a bash terminal. </p>
<p><code>sqlite3 ~/.liferea_1.4/liferea.db "VACUUM;"</code></p>
<p>Open up Liferea and you should notice it load much faster.  Unless of course, it was fast to begin with.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/08/speeding-up-liferea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handy Hints: Emptying log files</title>
		<link>http://ten.ynottony.net/2009/04/handy-hints-emptying-log-files/</link>
		<comments>http://ten.ynottony.net/2009/04/handy-hints-emptying-log-files/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 12:59:46 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=80</guid>
		<description><![CDATA[When emptying log files, don&#8217;t just rm log_file.log as the disk space won&#8217;t be freed until the application that is logging is restarted. It is better to use &#62; log_file.log as that will allow the file system to free the &#8230; <a href="http://ten.ynottony.net/2009/04/handy-hints-emptying-log-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When emptying log files, don&#8217;t just <code>rm log_file.log</code> as the disk space won&#8217;t be freed until the application that is logging is restarted.</p>
<p>It is better to use <code>&gt; log_file.log</code> as that will allow the file system to free the space that is used by the open file.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/04/handy-hints-emptying-log-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy Hints: What is using up my disk space?</title>
		<link>http://ten.ynottony.net/2009/04/handy-hints-what-is-using-up-my-disk-space/</link>
		<comments>http://ten.ynottony.net/2009/04/handy-hints-what-is-using-up-my-disk-space/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:59:36 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=74</guid>
		<description><![CDATA[Here are some commands I use to find out what is eating all of my disk space on a remote server: df -h Shows how much disk space is available. The -h means that you get G for gigabytes, M &#8230; <a href="http://ten.ynottony.net/2009/04/handy-hints-what-is-using-up-my-disk-space/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here are some commands I use to find out what is eating all of my disk space on a remote server:</p>
<p><code> df -h </code> Shows how much disk space is available. The -h means that you get G for gigabytes, M for megabytes etc.</p>
<p><code> sudo du -k / | sort -n </code> Shows which directories are biggest (starting at the root directory /).  The biggest ones will be printed at the bottom of the list.  The sudo allows du to check directories that your user doesn&#8217;t have permission for.  To check your home directory only use <code> du -k ~ | sort -n </code></p>
<p><code> du -ka | sort -n </code> Shows the size of all the files and sub-directories of the current directory.  The biggest ones at the bottom of the list.</p>
<p><code> watch 'du -ka | sort -nr' </code> Shows the size of all the files and sub-directories of the current directory.  The biggest ones at the top of the list.  The list is updated every 2 seconds.  This is useful for watching disk usage in a particular directory, such as an upload directory on a  web server.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/04/handy-hints-what-is-using-up-my-disk-space/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>git-svn new branches don&#8217;t show up&#8230;</title>
		<link>http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/</link>
		<comments>http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 17:22:11 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=35</guid>
		<description><![CDATA[Working with git-svn I noticed that new branched didn&#8217;t show up when I did the usual git svn rebase to get the remote changes. After a bit of searching and not coming up with much, I worked out that git &#8230; <a href="http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Working with git-svn I noticed that new branched didn&#8217;t show up when I did the usual <code>git svn rebase</code> to get the remote changes.  After a bit of searching and not coming up with much, I worked out that <code>git svn fetch</code> pulls in the changes for the whole module, not just the current branch.  After running that command, the new branches, tags etc. show up.</p>
<p>Hope this helps someone&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enabling bash/git auto-completion in Ubuntu</title>
		<link>http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/</link>
		<comments>http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 16:15:44 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=32</guid>
		<description><![CDATA[I now use git quite a lot for various projects.Â  I noticed that on one computer I had very handy tab completion, and the other one did not.Â  They are both running Ubuntu 8.10, so there shouldn&#8217;t be a difference. &#8230; <a href="http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I now use git quite a lot for various projects.Â  I noticed that on one computer I had very handy tab completion, and the other one did not.Â  They are both running Ubuntu 8.10, so there shouldn&#8217;t be a difference.</p>
<p>It turns out that I had enabled bash completion on one machine but not on the other.</p>
<p>To enable it for all users on your system you need to editÂ  /etc/bash.bashrc and uncomment lines 32 &#8211; 34 (in the default file) so it looks like:</p>
<pre># enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi</pre>
<p>Open a new terminal and auto-completion should now work.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy Hints: tail &#124; grep</title>
		<link>http://ten.ynottony.net/2008/12/handy-hints-tail-grep/</link>
		<comments>http://ten.ynottony.net/2008/12/handy-hints-tail-grep/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 11:54:16 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[sys-admin]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=11</guid>
		<description><![CDATA[When trying to track an issue in log files on a live system, I find it handy to tail the logs. If the logs are being populated to quickly too find what I am looking for, I would pipe tail &#8230; <a href="http://ten.ynottony.net/2008/12/handy-hints-tail-grep/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When trying to track an issue in log files on a live system, I find it handy to <code>tail</code> the logs.   If the logs are being populated to quickly too find what I am looking for, I would <code>pipe</code> <code>tail</code> to <code>grep</code> and match on a pattern.</p>
<p><code> tail -f query.log | grep "thing I'm interested in" --color </code></p>
<p>Now you will see any new lines added to query.log that contain &#8220;thing I&#8217;m interested in&#8221; highlighted.  Any other lines will be ignored.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2008/12/handy-hints-tail-grep/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SSH tricks: Forward and Reverse Tunneling for Fun and Profit</title>
		<link>http://ten.ynottony.net/2008/11/ssh-tricks-forward-and-reverse-tunneling-for-fun-and-profit/</link>
		<comments>http://ten.ynottony.net/2008/11/ssh-tricks-forward-and-reverse-tunneling-for-fun-and-profit/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 20:21:56 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[sys-admin]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/2008/11/11/ssh-tricks-forward-and-reverse-tunneling-for-fun-and-profit/</guid>
		<description><![CDATA[SSH or Secure SHell is a protocol for connecting to a remote computer&#8217;s shell securely.Â  Many people use it for just this purpose, but there are several less used, yet extremely useful tricks you can use to get more out &#8230; <a href="http://ten.ynottony.net/2008/11/ssh-tricks-forward-and-reverse-tunneling-for-fun-and-profit/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>SSH</strong> or <strong>S</strong>ecure <strong>SH</strong>ell is a protocol for connecting to a remote computer&#8217;s shell securely.Â  Many people use it for just this purpose, but there are several less used, yet extremely useful tricks you can use to get more out of SSH.</p>
<p>In this post, I will cover what forward and reverse tunneling of ports through SSH is.Â  Why you would want to do it, and how to do it.Â  <a href="http://en.wikipedia.org/wiki/Computer_port_(software)" title="Wikipedia page on the term Port">Port</a> tunneling is also known as port forwarding.</p>
<p><span id="more-9"></span></p>
<h2>Forward Tunneling</h2>
<p>Port forwarding allows a specific port to be mapped between one computer and another.Â  A forward tunnel allows you to have a remote port appear as a local one.</p>
<p>This can be useful if you need to connect your MySQL query browser to a remote database, but the database only listens to localhost.Â  Although this section only talks about MySQL, it is applicable to almost any other piece of client/server software that uses specific ports.</p>
<p>To forward port 3306 (MySQL&#8217;s default port) to your local systems port 3306 use the following command:<br />
<code>ssh user@remote-hostname -L 3306:remote-hostname:3306</code></p>
<p>If you are running MySQL locally on port 3306, or want to use a different local port to the remote port, change the port before the first colon:<br />
<code>ssh user@remote-hostname -L <strong>3305</strong>:remote-hostname:3306</code></p>
<p>Then you can connect to your remote MySQL server as if it was a local one.Â  Use the usual username, password and database name as you would to connect to the database, but change the host to 127.0.0.1 and the port to 3305.Â  You should now be able to access the remote database as if it was a local one.</p>
<h2>Reverse Tunneling</h2>
<p>Reverse tunneling allows you to have a port on a remote machine work as if it is a port on your local machine.  It&#8217;s the exact opposite of a forward tunnel.<br />
You could use this when working on code that needed to be accessed by a service that is outside of your firewall, but not ready to be deployed on a server.  For example, developing a payment gateway for a shop, when the payment gateway needs to talk to the code that is on your development machine and you don&#8217;t want to (or can&#8217;t) make modifications to your firewall.</p>
<p>To reverse tunnel port 8080 on a remote server to port 80 on the local machine use the following command:<br />
<code>ssh username@remote-hostname -R 8080:127.0.0.1:80</code><br />
This will let you, <em>or anyone else</em>, visit http://remote-hostname:8080 and see what is visible on http://127.0.0.1:80.  In this case, your local web server is available to anyone who can see remote-hostname.  If remote-hostname is a server available to the whole internet, the whole internet can see into your local machine that is usually hidden behind your firewall.</p>
<h2>Some notes</h2>
<ul>
<li> This guide is for <a href="http://www.openssh.com/" title="The OpenSSH homepage" target="_blank">OpenSSH</a>, other implementations may vary.</li>
<li> You will need to set GatewayPorts to yes in /etc/ssh/sshd_config (Don&#8217;t forget to restart sshd after the change).</li>
<li>When you close your ssh session,Â  the port forwarding stops.</li>
</ul>
<p>For more information, read the OpenSSH <a href="http://www.openssh.com/manual.html" title="OpenSSH documentation" target="_blank">documentation</a> and <a href="http://www.openssh.com/faq.html" title="OpenSSH FAQ" target="_blank">Frequently Asked Questions</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2008/11/ssh-tricks-forward-and-reverse-tunneling-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recovering photos from a formatted camera&#8230;</title>
		<link>http://ten.ynottony.net/2007/09/recovering-photos-from-a-formatted-camera/</link>
		<comments>http://ten.ynottony.net/2007/09/recovering-photos-from-a-formatted-camera/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 14:33:43 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Recovery]]></category>
		<category><![CDATA[Wedding]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=5</guid>
		<description><![CDATA[I&#8217;ve just come back from my sister-in-laws wedding. It was great and we took some really good photos. (When I see we, I mean Jude took some really great photos, and I cut some peoples head off). Unfortunately, we accidentally &#8230; <a href="http://ten.ynottony.net/2007/09/recovering-photos-from-a-formatted-camera/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just come back from my sister-in-laws wedding.  It was great and we took some really good photos. (When I see we, I mean Jude took some really great photos, and I cut some peoples head off).  Unfortunately, we accidentally formatted the card and lost all of our photos.</p>
<p>Being fairly geeky, Jude and I thought we might be able to recover some of the photos.  Never tried it before, but thought it should be possible.Â  If they can do it on CSI, it must be possible.Â  Right?</p>
<p><span id="more-5"></span>When you delete a file on a computer, usually the contents of the file remain on the disk but the information that tells the computer where the file is is deleted.  Knowing this, we decided the best thing to do was to remove the memory card and take photos using a different one.  This would stop us from overwriting any data that might still be on the card.</p>
<p>To reduce the chance of corrupting any data on the card, I made a copy of the entire disk.   Using the command &#8216;dd&#8217; I made an image of the disk.</p>
<p><code>dd if=/dev/disk/by-label/EOS_DIGITAL of=/home/toeknee/cf/backup.img bs=512 conv=notrunc</code></p>
<p>This made a 2 gigabyte file on my computer containing all the data from the compact flash card.</p>
<p>Fairly happy that I had a copy of the card, I unmounted and removed it and put it in a safe place.  I looked around google for a while trying to find other examples of people recovering  images, but I didn&#8217;t find much of use.   I thought I have a quick look in the ol&#8217; package manager for programs that could recover files from FAT file systems (<a href="http://en.wikipedia.org/wiki/File_Allocation_Table" title="File Allocation Table" target="_blank">FAT</a> is the file system used by most cameras).  I came across a program called PhotoRec in the package testdisk.</p>
<p>PhotoRec is described as &#8220;file data recovery software designed to recover lost pictures from digital camera memory or even Hard Disks.&#8221;</p>
<p>Sounds good to me.<code> photorec /home/toeknee/cf/backup.img</code></p>
<p>Enter the directory  that the photos should be restored to, start it up and wait.</p>
<p>15 minutes later I had 200-odd pictures of the wedding and some that I had deleted months ago.</p>
<p>Very happy Tony, Very happy Jude. Very happy <a href="http://ten.ynottony.net/wp-content/uploads/2007/09/f540425.jpg" title="Group photo">group photo&#8230;</a></p>
<p><em>Edit: Added <code>conv=notrunc</code> to the dd command as suggested by <a href="http://www.reddit.com/r/photography/comments/7cv8m/recovering_photos_from_a_formatted_camera/c06bk9b" title="Comment from docatomic" target="_blank">docatomic</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2007/09/recovering-photos-from-a-formatted-camera/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

