<?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>A Million Monkeys &#187; bash</title>
	<atom:link href="http://www.monkeedev.co.uk/blog/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.monkeedev.co.uk/blog</link>
	<description>Surviving life as a sysadmin.</description>
	<lastBuildDate>Mon, 16 May 2011 09:49:18 +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>Hipstamatic taking up too much space?</title>
		<link>http://www.monkeedev.co.uk/blog/2011/03/25/hipstamatic-taking-up-too-much-space/</link>
		<comments>http://www.monkeedev.co.uk/blog/2011/03/25/hipstamatic-taking-up-too-much-space/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 19:48:10 +0000</pubDate>
		<dc:creator>Kris</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[hipstamatic]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.monkeedev.co.uk/blog/?p=222</guid>
		<description><![CDATA[Please see the update at the bottom of this post! As an avid user of the Hipstamatic iPhone app, I soon noticed that it started taking up a lot of disk space. I had a look around the filesystem (my iPhone is jailbroken, so I can access the whole filesystem) and found that inside the [...]]]></description>
			<content:encoded><![CDATA[<p><b>Please see the update at the bottom of this post!</b></p>
<p>As an avid user of the Hipstamatic iPhone app, I soon noticed that it started taking up a lot of disk space. </p>
<p>I had a look around the filesystem (my iPhone is jailbroken, so I can access the whole filesystem) and found that inside the Documents folder for the app, there are 2 folders which hold any photos you take (FilmRoll for the thumbnail images, and HiResPrints for the full sized ones).</p>
<p>When you delete a photo from the film roll, the thumbnail and full size image aren&#8217;t removed from these folders, meaning that after you&#8217;ve taken a lot of photos, you can end up with the app taking up a huge amount of space and have no way of freeing the space up.</p>
<p>If you&#8217;re jailbroken, you can remove old images from the filesystem fairly easily, but you need to take care not to delete ones which havent been deleted from the app.</p>
<p>The file HipstaData.sqlite is a sqlite database holding info about all of the photos which are still in the app, so you could correlate the records in that with what&#8217;s in the folders above to decide what to delete, but it&#8217;s a pain to do and you need a sqlite browser and basic understanding of the filesystem and databases to do.</p>
<p>Rather than the hassle of having to do this manually, I decided to write a shell script to do it for me. I achieved it by doing the following.</p>
<p>1, Locate the hipstamatic app folder on the device (I believe this is different for all installs, so I made the script find the app itself rather than hardcoding it). On a 3GS, this takes a few seconds.</p>
<blockquote><p>DIR_NAME=`find /var/mobile/Applications/ -name &#8220;Hipstamatic.app&#8221; | cut -d \/ -f 5`</p></blockquote>
<p>2, Kill the running hipstamatic process (this might not be needed, but it&#8217;s safer to not have the app running while you&#8217;re editing the contents of its Documents folder).</p>
<blockquote><p>killall -v Hipstamatic</p></blockquote>
<p>3, Loop through all files in the FilmRoll directory (I assume that every file in this directory will have a corresponding entry in HiResPrints). For each file, query the sqlite database and if the filename exists in the ZRECENTPRINT table then it&#8217;s still part of the film roll inside the app so needs to be kept.</p>
<p>The full script is available here (removed). To use it, copy it to your device using something like cyberduck or i-funbox, then make it executable and run it through ssh&#8230;</p>
<blockquote><p>mv hipsta.txt hipsta.sh<br />
chmod +x hipsta.sh<br />
./hipsta.sh</p></blockquote>
<p><b>Now a quick disclaimer!</b> This script works for me. I&#8217;ve only used it myself on my own iPhone so whilst I think it will work correctly, I can&#8217;t guarantee that it won&#8217;t brick your device and empty your bank accounts. Please make sure you have a backup (I&#8217;d recommend AppBackup or Chronus) before you attempt to use it. Also, I&#8217;m not an expert at shell scripting so if anyone who reads this is and notices any issues then please let me know and I&#8217;ll fix it as soon as possible. I don&#8217;t want anyone to suffer any data loss because of my script!</p>
<p><b>Update 14th May 2011 &#8211; It appears that this problem has been fixed as of Hipstamatic v210, so this script isn&#8217;t needed any more!</b></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F&amp;title=Hipstamatic+taking+up+too+much+space%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F&amp;title=Hipstamatic+taking+up+too+much+space%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F&amp;title=Hipstamatic+taking+up+too+much+space%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F&amp;title=Hipstamatic+taking+up+too+much+space%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F&amp;title=Hipstamatic+taking+up+too+much+space%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Hipstamatic+taking+up+too+much+space%3F+@+http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2011%2F03%2F25%2Fhipstamatic-taking-up-too-much-space%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.monkeedev.co.uk/blog/2011/03/25/hipstamatic-taking-up-too-much-space/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nice shell colours in bash</title>
		<link>http://www.monkeedev.co.uk/blog/2007/07/11/nice-shell-colours-in-bash/</link>
		<comments>http://www.monkeedev.co.uk/blog/2007/07/11/nice-shell-colours-in-bash/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 20:52:53 +0000</pubDate>
		<dc:creator>Kris</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell colours]]></category>

		<guid isPermaLink="false">http://www.monkeedev.co.uk/blog/2007/07/11/nice-shell-colours-in-bash/</guid>
		<description><![CDATA[Lets face it, the default debian bash prompt is pretty dull whereas distributions like Gentoo have nice colours. This is very easy to get in all distributions, and it&#8217;s one of the first things I do on new installs. The file you need to edit is ~/.bashrc, and if you want it to apply to [...]]]></description>
			<content:encoded><![CDATA[<p>Lets face it, the default debian bash prompt is pretty dull whereas distributions like Gentoo have nice colours.</p>
<p>This is very easy to get in all distributions, and it&#8217;s one of the first things I do on new installs.</p>
<p>The file you need to edit is ~/.bashrc, and if you want it to apply to all new users, /etc/skel/.bashrc.</p>
<p>Simply add the following lines to the bottom of the file:</p>
<p>//////</p>
<p>eval `dircolors -b`<br />
alias ls=&#8217;ls &#8211;color=auto&#8217;</p>
<p>if [ "`id -u`" -eq 0 ]; then<br />
PS1=&#8217;[ 33[01;31m]h [ 33[01;34m]w $ [ 33[00m]&#8216;<br />
else<br />
PS1=&#8217;[ 33[01;32m]u@h [ 33[01;34m]w $ [ 33[00m]&#8216;<br />
fi</p>
<p>//////</p>
<p>This will give you a light green prompt for standard users, and red for root. To use different colours, change the numbers in the [01;32m] sections. You will need to logout and login again to see the changes.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F&amp;title=Nice+shell+colours+in+bash" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F&amp;title=Nice+shell+colours+in+bash" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F&amp;title=Nice+shell+colours+in+bash" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F&amp;title=Nice+shell+colours+in+bash" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F&amp;title=Nice+shell+colours+in+bash" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Nice+shell+colours+in+bash+@+http%3A%2F%2Fwww.monkeedev.co.uk%2Fblog%2F2007%2F07%2F11%2Fnice-shell-colours-in-bash%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.monkeedev.co.uk/blog/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.monkeedev.co.uk/blog/2007/07/11/nice-shell-colours-in-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

