<?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>lab.joelGillman.com &#187; bash</title>
	<atom:link href="http://lab.joelgillman.com/archives/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://lab.joelgillman.com</link>
	<description>Sketches, Code Bites and Toys</description>
	<lastBuildDate>Tue, 12 Jul 2011 15:03:29 +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>Pseudo Work (fwork)</title>
		<link>http://lab.joelgillman.com/archives/159_pseudo-work</link>
		<comments>http://lab.joelgillman.com/archives/159_pseudo-work#comments</comments>
		<pubDate>Thu, 05 Nov 2009 22:16:30 +0000</pubDate>
		<dc:creator>joel gillman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://lab.joelgillman.com/?p=159</guid>
		<description><![CDATA[This script takes a text file (any text file should) and displays it one line at a time with short delays in between. In other words, you can run this script to make it look like your computer is actually doing something worthwhile. I had searched around the internet a few times but never really [...]]]></description>
			<content:encoded><![CDATA[<p>This script takes a text file (any text file should) and displays it one line at a time with short delays in between.  In other words, you can run this script to make it <em>look</em> like your computer is actually doing something worthwhile.</p>
<p>I had searched around the internet a few times but never really found anything like this, but that doesn&#8217;t mean it doesn&#8217;t look.  Maybe I&#8217;m just a bad internet searcher.  <a href="http://lab.joelgillman.com/archives/159_pseudo-work">Script after the jump</a>. <span id="more-159"></span></p>
<p><br/></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<span style="color: #666666; font-style: italic;"># Pseudo Work (fwork) Script - by Joel Gillman 2009</span><br />
<span style="color: #666666; font-style: italic;"># lab.joelgillman.com/archives/159_pseudo-work</span><br />
<span style="color: #666666; font-style: italic;"># </span><br />
<span style="color: #666666; font-style: italic;"># Please feel free to edit and change this as you</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;like! If &nbsp;you do make any edits I would be curious</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;to see what you've done so drop me a line!</span><br />
<span style="color: #666666; font-style: italic;"># </span><br />
<span style="color: #666666; font-style: italic;"># DISCLAIMER</span><br />
<span style="color: #666666; font-style: italic;"># I am in no way a bash scripting expert. Most of what</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;I write is copy and paste and trial and error.</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;While this script shouldn't hurt anything in your</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;system don't hold me responsible if it does! Use</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;at your own risk.</span><br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">## test if file (default or otherwise)</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">''</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">filename</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$HOME</span>/garbage.txt&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$filename</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">0</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No file specified and default file '~/garbage.txt' not found.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">filename</span>=<span style="color: #007800;">$1</span><br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No file found at $1&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #666666; font-style: italic;">## execute fakeness</span><br />
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> p; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(($RANDOM % 10)</span>)&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = (<span style="color: #007800;">$RANDOM</span> % 2)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(($RANDOM % 50)</span>)&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = (<span style="color: #007800;">$RANDOM</span> % 20)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = 0&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R2 = (<span style="color: #007800;">$RANDOM</span> % 10)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$p</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #007800;">$R1</span>.<span style="color: #007800;">$R2</span><br />
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$filename</span></div></div>
<p><a href="http://lab.joelgillman.com/thepress/wp-content/uploads/2009/11/fwork.zip">Download a zip&#8217;d version of the script</a>.<br />
You can <a href="http://lab.joelgillman.com/thepress/wp-content/uploads/2009/11/garbage.txt">download the (2.5MB) text file</a> I&#8217;ve been using.</p>
<p>Let me know what you think!  Any improvements or suggestions would be greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.joelgillman.com/archives/159_pseudo-work/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iSightCapture, now with more SSH!</title>
		<link>http://lab.joelgillman.com/archives/130_isightcapture-now-with-more-ssh</link>
		<comments>http://lab.joelgillman.com/archives/130_isightcapture-now-with-more-ssh#comments</comments>
		<pubDate>Thu, 30 Apr 2009 18:28:50 +0000</pubDate>
		<dc:creator>joel gillman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[isight]]></category>
		<category><![CDATA[scp]]></category>
		<category><![CDATA[screencapture]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh-keys]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://lab.joelgillman.com/?p=130</guid>
		<description><![CDATA[I think this kind of thing is pretty awesome. Take a picture from your iSight. Take a screencapture. Upload them both to a remote server. WHY DOESN&#8217;T EVERYONE WANT TO DO THIS?! Maybe you do, now you can (hopefully). Firstly, props to Dylan O&#8217;Donnell, who wrote the original script. I was personally unsatisfied with FTP [...]]]></description>
			<content:encoded><![CDATA[<p>I think this kind of thing is pretty awesome.  Take a picture from your iSight.  Take a screencapture.  Upload them both to a remote server. WHY DOESN&#8217;T EVERYONE WANT TO DO THIS?!  Maybe you do, now you can (hopefully).<span id="more-130"></span></p>
<p>Firstly, props to Dylan O&#8217;Donnell, who wrote the original script.  I was personally unsatisfied with FTP because it&#8217;s insecure and I always run into technical troubles with it. Probably because I never took the time to learn what I was doing with FTP via command line&#8230; But I favor SCP for my file transferring needs.<br/><br/></p>
<p>I also added a screen cap functionality because there&#8217;s all kinds of cool things you can do with that down the line.  Time-lapse animation, security, you name it!<br/><br/></p>
<p>If you want the iSight captures to work you must download and install <a href='http://lab.joelgillman.com/thepress/wp-content/uploads/2009/04/isightcapture.zip'>isightcapture</a>! I&#8217;ve installed it to /usr/sbin/ and hardcoded the script to look there. If you don&#8217;t know what you&#8217;re doing, I suggest you do the same.<br/><br/></p>
<p><strong>&#8220;Installing&#8221; isightcapture (assuming it&#8217;s unzipped and on your desktop):</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">user$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> ~<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>isightcapture <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>Quick rundown of what&#8217;s happening here:<br />
- Grab the date and time info and prepare the filenames (YearMonthDayHourMinuteSecond)<br />
- Take a picture with the iSight, save it to a folder (~/Documents/pics/)<br />
- Take a screencap, save it to the same folder (~/Documents/pics/)<br />
- Resize all of the jpgs in the pics folder so they&#8217;re no more than 800px in any dimention<br />
- Check to see if the computer has a network connection, if it does upload the files to a remote server (via scp) and delete the local images. If there&#8217;s no connection, do nothing (images will try to upload next time the script is run)</p>
<p>In order for this to work <strong><em>you must have SSH Keys setup with the server you are connecting to</em></strong>. If you don&#8217;t it will not work.  If you google &#8220;ssh keys&#8221; there are a million ways to do it but this is the site that actually got it working on my modern mac: <a href="http://www.webficient.com/2007/11/16/mac-and-ssh-keys">http://www.webficient.com/2007/11/16/mac-and-ssh-keys</a><br/><br/></p>
<p>Here&#8217;s a quick and dirty run down of how to do that, but I&#8217;m just copying from <a href="http://www.webficient.com/2007/11/16/mac-and-ssh-keys">Phil&#8217;s post</a> so don&#8217;t blame me if it doesn&#8217;t work for you :)<br/><br/></p>
<p>Generate the ssh key (obviously replace the CAPS stuff with your info). When asked for a passphrase just hit enter, this will make an empty passphrase which, I admit, is very insecure but it&#8217;s better than nothing and the script won&#8217;t work with a passphrase :( :</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">user$ </span><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa</div></div>
<p>If you&#8217;ve never used SSH to make an outgoing connect on the machine you are connecting to you will also need to create the ssh folder on that machine and make it so only your user can read it:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">user$ </span><span style="color: #c20cb9; font-weight: bold;">ssh</span> USER<span style="color: #000000; font-weight: bold;">@</span>YOUR.SERVER.COM <span style="color: #ff0000;">'mkdir ~/.ssh;chmod 700 ~/.ssh'</span></div></div>
<p>Now copy your public key (id_rsa.pub) to the server you&#8217;re connecting to (I always name the copy on the server &#8220;temp_pub_key&#8221; so I know exactly what file I need):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">user$ </span><span style="color: #c20cb9; font-weight: bold;">scp</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub USER<span style="color: #000000; font-weight: bold;">@</span>YOUR.SERVER.COM:~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>temp_pub_key</div></div>
<p>Now connect to the remote server and navigate to ~/.ssh/</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">remote-user$ </span><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>On the server, check to see if the file &#8220;authorized_keys&#8221; exists, if it doesn&#8217;t rename your &#8220;temp_pub_key&#8221; to &#8220;authorized_keys:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">remote-user$ </span><span style="color: #c20cb9; font-weight: bold;">mv</span> temp_pub_key authorized_keys</div></div>
<p>If &#8220;authorized_keys&#8221; already exists then you want to add your public key to the end of the file:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">remote-user$ </span><span style="color: #c20cb9; font-weight: bold;">cat</span> temp_pub_key <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; authorized_keys</div></div>
<p>If &#8220;authorized_keys&#8221; didn&#8217;t already exists, you&#8217;ll also have to set the permissions of the authorized_keys file:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ssh</span> USER<span style="color: #000000; font-weight: bold;">@</span>YOUR.SERVER.COM <span style="color: #ff0000;">'chmod 644 ~/.ssh/authorized_keys2'</span></div></div>
<p>Here is the automation script originally written by Dylan O&#8217;Donnell with my tweaks and editing for SSH and screencaps.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># Original iSight Auto Upload Script - by Dylan O'Donnell 2006</span><br />
<span style="color: #666666; font-style: italic;"># Edited for ssh and made more awesome by Joel Gillman 2009 </span><br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<span style="color: #666666; font-style: italic;"># Edit CAPITALS with appropriate details </span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;Notes : You must have ssh-keys setup with the server you are </span><br />
<span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp;: uploading to before hand. Otherwise this will not work.</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp;:</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp;: Try here for tutorial on ssh-keys (worked for me)</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp;: &nbsp;http://www.webficient.com/2007/11/16/mac-and-ssh-keys</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Generate filename based on date stamp</span><br />
<span style="color: #007800;">picture</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">%</span>H<span style="color: #000000; font-weight: bold;">%</span>M<span style="color: #000000; font-weight: bold;">%</span>S<span style="color: #7a0874; font-weight: bold;">&#41;</span>_pic.jpg;<br />
<span style="color: #007800;">screen</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">%</span>H<span style="color: #000000; font-weight: bold;">%</span>M<span style="color: #000000; font-weight: bold;">%</span>S<span style="color: #7a0874; font-weight: bold;">&#41;</span>_scr.jpg;<br />
<br />
<span style="color: #666666; font-style: italic;"># Take iSight Photo and store with datestamp filename</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>isightcapture <span style="color: #660033;">-w</span> <span style="color: #000000;">640</span> <span style="color: #660033;">-h</span> <span style="color: #000000;">480</span> <span style="color: #660033;">-t</span> jpg <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>pics<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$picture</span>;<br />
<br />
<span style="color: #666666; font-style: italic;"># Take screen capture</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>screencapture <span style="color: #660033;">-C</span> <span style="color: #660033;">-m</span> <span style="color: #660033;">-t</span> jpg <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>pics<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$screen</span>;<br />
<br />
<span style="color: #666666; font-style: italic;">#resize the pictures so they're not too big</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>sips <span style="color: #660033;">--resampleHeightWidthMax</span> <span style="color: #000000;">800</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>pics<span style="color: #000000; font-weight: bold;">/*</span>.jpg<br />
<br />
<span style="color: #666666; font-style: italic;"># Generate semaphore for connectivity by pinging NASA</span><br />
<span style="color: #007800;">isconnected</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ping</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">1</span> www.nasa.gov <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000;">64</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<br />
<br />
<span style="color: #666666; font-style: italic;"># Wait a few seconds to see if it's connected.</span><br />
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">3</span>;<br />
<br />
<span style="color: #666666; font-style: italic;"># If connected...</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$isconnected</span>&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> <br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>pics<span style="color: #000000; font-weight: bold;">/*</span> USERNAME<span style="color: #000000; font-weight: bold;">@</span>YOUR.SERVER.COM:<span style="color: #ff0000;">&quot;REMOTE/PATH&quot;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Wait a few seconds, just to make sure everything is clear and complete</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">4</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># delete local images</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>pics<span style="color: #000000; font-weight: bold;">/*</span>.jpg;<br />
<br />
<span style="color: #000000; font-weight: bold;">else</span> <br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># If not connected.. leave captures there until next time. </span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No Connection, Image not transferred or deleted.&quot;</span>;<br />
<span style="color: #000000; font-weight: bold;">fi</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://lab.joelgillman.com/archives/130_isightcapture-now-with-more-ssh/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

