<?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>Andrew M. Whalen &#187; bash</title>
	<atom:link href="http://amwhalen.com/archives/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://amwhalen.com</link>
	<description>Thoughts on the web, programming and other nerdery by Andrew M. Whalen.</description>
	<lastBuildDate>Thu, 29 Dec 2011 14:13:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Another Day Out My Window</title>
		<link>http://amwhalen.com/archives/2008/01/20/another-day-out-my-window</link>
		<comments>http://amwhalen.com/archives/2008/01/20/another-day-out-my-window#comments</comments>
		<pubDate>Sun, 20 Jan 2008 15:57:51 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[gphoto]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[mogrify]]></category>
		<category><![CDATA[nikon]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[timelapse]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://amwhalen.com/blog/archives/2008/01/20/another-day-out-my-window/</guid>
		<description><![CDATA[This time around my bash script for gphoto started when it was supposed to. I captured a full day worth of photos, 1 every 60 seconds. The frames were captures on January 18th, 2008. I ended up with 710 photos in the final video, which is about 11.8 hours worth of the day. When I [...]]]></description>
			<content:encoded><![CDATA[<p>This time around my bash script for gphoto started when it was supposed to. I captured a full day worth of photos, 1 every 60 seconds. The frames were captures on January 18th, 2008. I ended up with 710 photos in the final video, which is about 11.8 hours worth of the day. When I made the video, I set the delay to 1/10th of a second, resulting in 10 photos per second. So every second of this video covers 10 minutes of the day.</p>
<p><object width="615" height="514"><param name="movie" value="http://www.youtube.com/v/kFnGpw9Q10g&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/kFnGpw9Q10g&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="615" height="514"></embed></object></p>
<p>This video is better than my first attempt, but still not as awesome as I&#8217;d like. The morning started cloudy and a little snowy/rainy, then the clouds moved away and the sky turned bright blue until sunset. I&#8217;ll need to find a better vantage point to take some more striking images.</p>
<p>Another hindrance to finding a good location is that gphoto still doesn&#8217;t work correctly on Mac OS X. That means I can&#8217;t use it on my laptop, so the camera has to be tied to my Ubuntu box. Even though I installed gphoto2 with Mac Ports, I can&#8217;t find any solutions to the delay and disappearing file problems I&#8217;m having.</p>
]]></content:encoded>
			<wfw:commentRss>http://amwhalen.com/archives/2008/01/20/another-day-out-my-window/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Day Out My Window</title>
		<link>http://amwhalen.com/archives/2008/01/17/one-day-out-my-window</link>
		<comments>http://amwhalen.com/archives/2008/01/17/one-day-out-my-window#comments</comments>
		<pubDate>Thu, 17 Jan 2008 23:03:24 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[gphoto]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[mogrify]]></category>
		<category><![CDATA[nikon]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[timelapse]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://amwhalen.com/blog/archives/2008/01/17/one-day-out-my-window/</guid>
		<description><![CDATA[I finally got the Nikon EH-5a, the $70 power cord for my camera. It&#8217;s crazy that a cord can cost that much money, and all it does it supply my camera with power from a wall socket. I put it to use though, by running my camera all day on the 16th. I shot out [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got the Nikon EH-5a, the $70 power cord for my camera. It&#8217;s crazy that a cord can cost that much money, and all it does it supply my camera with power from a wall socket. I put it to use though, by running my camera all day on the 16th. I shot out my window towards the woods. Unfortunately it was a really clear day, the sun was never really in the picture, and the script didn&#8217;t start when it was supposed to (6am). Lots of problems. So the video&#8217;s kind of boring, but it was a good learning experience for when I do more time lapse videos.</p>
<p><object width="615" height="514"><param name="movie" value="http://www.youtube.com/v/FqQtkNrp62c&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/FqQtkNrp62c&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="615" height="514"></embed></object></p>
<p>Here&#8217;s the process I used. I installed gphoto on my ubuntu box. Gphoto allows you to control a capable camera with your computer. It&#8217;s a very neat program. There are tons of options I can play with, and I think everything is controllable through the software from aperture to shutter speed to white balance and ISO. I didn&#8217;t use any of its crazy capabilities though. I just wrote a bash script that called it every 60 seconds to take a picture and download it to the computer. I set the camera to aperture priority (A) mode. That way, the depth of field of the images wouldn&#8217;t change throughout the day, only the shutter speed.</p>
<p>Once I had a directory full of photos (just under 600), I ran ImageMagick&#8217;s &#8220;mogrify&#8221; command on them to resize them all to 600&#215;366. From there, I used ImageMagick again, this time it&#8217;s &#8220;convert&#8221; command to turn all the jpegs into an mpeg, with 5 jpegs every second. This resulted in a movie that plays for a little over a minute that shows about 12 hours worth of time.</p>
]]></content:encoded>
			<wfw:commentRss>http://amwhalen.com/archives/2008/01/17/one-day-out-my-window/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time Lapse Sunrise</title>
		<link>http://amwhalen.com/archives/2007/04/27/time-lapse-sunrise</link>
		<comments>http://amwhalen.com/archives/2007/04/27/time-lapse-sunrise#comments</comments>
		<pubDate>Fri, 27 Apr 2007 14:14:45 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gphoto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[timelapse]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://amwhalen.com/blog/archives/2007/04/27/time-lapse-sunrise/</guid>
		<description><![CDATA[Way back in January I was playing around with this great software called gphoto. It allows you to attach your digital camera to your computer and take photos. This has many uses, one of which is to create time lapse movies by writing a script to take pictures every so often. So that&#8217;s what I [...]]]></description>
			<content:encoded><![CDATA[<div class="video"><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/cT7pZrv1vLg"></param> <embed src="http://www.youtube.com/v/cT7pZrv1vLg" type="application/x-shockwave-flash" width="425" height="350"></embed></object></div>
<p>Way back in January I was playing around with this great software called <a href="http://www.gphoto.org/">gphoto</a>. It allows you to attach your digital camera to your computer and take photos. This has many uses, one of which is to create time lapse movies by writing a script to take pictures every so often. So that&#8217;s what I did, one January night. I wrote a script to take a picture every 15 seconds or so, and set it to run from 6am to 6pm. Unfortunately, my battery died only an hour or two in, so I came out with an 11 second video of a partial time lapse sunrise.</p>
]]></content:encoded>
			<wfw:commentRss>http://amwhalen.com/archives/2007/04/27/time-lapse-sunrise/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing File Extensions</title>
		<link>http://amwhalen.com/archives/2007/04/20/changing-file-extensions</link>
		<comments>http://amwhalen.com/archives/2007/04/20/changing-file-extensions#comments</comments>
		<pubDate>Fri, 20 Apr 2007 15:28:52 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://amwhalen.com/blog/archives/2007/04/20/changing-file-extensions/</guid>
		<description><![CDATA[Today at work I needed to change a whole directory (with many sub-directories and sub-sub-directories and&#8230; etc.) of .php files to the .html file extension. Since the files were on a Unix server, I wrote a quick Bash shell script to take care of this for me. #!/bin/bash &#160; function change_extension_recursive &#123; &#160; #change all [...]]]></description>
			<content:encoded><![CDATA[<p>Today at work I needed to change a whole directory (with many sub-directories and sub-sub-directories and&#8230; etc.) of .php files to the .html file extension. Since the files were on a Unix server, I wrote a quick Bash shell script to take care of this for me.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> change_extension_recursive <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#change all .php to .html</span>
	<span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$1</span><span style="color: #000000; font-weight: bold;">/*</span>.php; <span style="color: #000000; font-weight: bold;">do</span>
		<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$f</span> <span style="color: #007800;">$1</span><span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$f</span> .php<span style="color: #000000; font-weight: bold;">`</span>.html;
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$f</span>;
	<span style="color: #000000; font-weight: bold;">done</span>;
&nbsp;
	<span style="color: #666666; font-style: italic;"># recurse on any directories</span>
	<span style="color: #000000; font-weight: bold;">for</span> d <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$1</span><span style="color: #000000; font-weight: bold;">/*</span>; <span style="color: #000000; font-weight: bold;">do</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$d</span>; <span style="color: #000000; font-weight: bold;">then</span>
			change_extension_recursive <span style="color: #007800;">$d</span>;
		<span style="color: #000000; font-weight: bold;">fi</span>;
&nbsp;
	<span style="color: #000000; font-weight: bold;">done</span>;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">dir</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`</span>;
&nbsp;
change_extension_recursive <span style="color: #007800;">$dir</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://amwhalen.com/archives/2007/04/20/changing-file-extensions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

