<?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>T’N’T Luoma &#187; geeky</title>
	<atom:link href="http://tntluoma.com/tag/geeky/feed/" rel="self" type="application/rss+xml" />
	<link>http://tntluoma.com</link>
	<description>Stuff I've Written Down</description>
	<lastBuildDate>Thu, 26 Jan 2012 16:39:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>~/Dropbox/bin/</title>
		<link>http://tntluoma.com/shell-scripts/dropbox-bin/</link>
		<comments>http://tntluoma.com/shell-scripts/dropbox-bin/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 04:34:28 +0000</pubDate>
		<dc:creator>@luomat</dc:creator>
				<category><![CDATA[Shell Scripts]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[geeky]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://tntluoma.com/?p=1005</guid>
		<description><![CDATA[Summary: I geek out by putting all my shell scripts in ~/Dropbox/bin/ and a few other tweaks and tricks. Like most computer-savvy folks I know, I ♥ Dropbox. If you don&#8217;t know what Dropbox is, here&#8217;s a simple summary: It&#8217;s a folder on your local computer which is also sync&#8217;d with Amazon.com&#8217;s super cool S3 [...]]]></description>
				<content:encoded><![CDATA[<p>Summary: I geek out by putting all my shell scripts in ~/Dropbox/bin/ and a few other tweaks and tricks.</p>

<p><span id="more-1005"></span>
Like most computer-savvy folks I know, I ♥ <a href="http://getdropbox.com/">Dropbox</a>.</p>

<p>If you don&#8217;t know what Dropbox is, here&#8217;s a simple summary:</p>

<ul>
<li>It&#8217;s a folder on your local computer which is also sync&#8217;d with Amazon.com&#8217;s super cool S3 service</li>
<li>You can sync that folder with all your computers, so all your files are on all your computers</li>
<li>It&#8217;s free (up to 2GB, which is plenty for documents)</li>
<li>It works for Mac, Windows, and Linux</li>
<li>You can access your files via a web browser (ever been away from home without your computer and wished you could get a file off your computer? Now you can, if the file is on your Dropbox.</li>
</ul>

<p>The same files, everywhere.</p>

<p>If you have more than one computer, you realize how this can be valuable.</p>

<p>Also, it works in the background, flawlessly (for me, thus far) and you never know that anything is happening.</p>

<h2>&#8220;Ok, I knew all that, what&#8217;s new?&#8221;</h2>

<p>Like most geeks I know, I&#8217;ve got a small collection of shell scripts that I&#8217;ve written over the years.</p>

<p>I would like those scripts to be accessible on all my computers as well.</p>

<p>I also have a bunch of shell customizations in my .zshenv file which I would also like sync&#8217;d on all my computers.</p>

<p>As I was getting ready to write some complicated syncing script to do that, it occurred to me: &#8220;Why don&#8217;t I just use Dropbox?&#8221;</p>

<p>Scripts are small and self-contained, and I can put them in <em>any</em> folder as long as I add that folder to my $PATH.</p>

<p>So I changed this:</p>

<pre><code>PATH=$HOME/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:
</code></pre>

<p>to this</p>

<pre><code>PATH=$HOME/Dropbox/bin:/usr/local/bin:/usr/local/sbin:/opt/loc
</code></pre>

<p>then I simply moved my ~/bin/ folder to ~/Dropbox/</p>

<p>Then I renamed ~/.zshenv to ~/Dropbox/zshenv.txt (so it would be visible and have a known file extension to open in a text editor) and finally I did this</p>

<pre><code>cd ~ &amp;&amp; ln -s Dropbox/zshenv.txt .zshenv
</code></pre>

<p>so now I have the same <a href="http://www.zsh.org/">Zsh</a> setup everywhere.</p>

<p>Wow! That was easy.</p>

<h2>Not So Fast</h2>

<p>I should have known this because <a href="http://forums.getdropbox.com/topic.php?id=1748">I raised the issue on the Dropbox forums</a> about 4 months ago.</p>

<blockquote>
  <p>I am developing a shell script. Since I want to use the same version on all my Macs, I have saved it in ~/Dropbox/ and issued chmod 755.  However, the &#8216;execute&#8217; bit keeps getting dropped off when it syncs.</p>
</blockquote>

<p>to which I was told:</p>

<blockquote>
  <p>Dropbox doesn&#8217;t actually track most extended attributes for any operating system, the file comes down as a standard read/writeable file. The problem here is that the &#8220;file system&#8221; on the cloud isn&#8217;t ntfs, or ext3, or zfs, or hfs +, so there is no analogous part to the execute bit. or file permissions or any of that extra stuff, but all your bits are there. But OS X supports ACLs that you can set on a directory so that all files created there inherit the same permissions, so drop your script into a folder, and set an ACL for it.</p>
</blockquote>

<p>Now I&#8217;ve <em>heard</em> of <a href="http://en.wikipedia.org/wiki/Access_control_list">ACLs</a>, but since I&#8217;m the only user on my computer, I&#8217;ve never actually <em>used them</em> before.</p>

<p>Like most geeks I know, I only really learn about something when I have some practical <em>reason</em> to know it.  When people ask me how I know so much about computers, I always tell them &#8220;practice&#8221; and it&#8217;s true.</p>

<p>I don&#8217;t sit around <em>reading</em> about something, and if there&#8217;s something I just have a casual interest in learning (&#42;cough&#42;perl, emacs, vi&#42;cough&#42;) I probably won&#8217;t learn about it even if I do read about it.</p>

<p>Now I had a reason, so I set off to learn something about ACLs.</p>

<p>And here is what I learned about ACLs: they&#8217;re fairly complicated for what I&#8217;m trying to do.</p>

<p>Here&#8217;s another thing about me and (I believe) most geeks: we&#8217;re lazy. By which I mean, we&#8217;ll accept any acceptable solution, and tend to prefer the first one that &#8220;just works&#8221;.</p>

<p>(Look at the GUI for most large free software packages, and you&#8217;ll understand what I mean. Most geeks don&#8217;t care so much about making things <em>pretty</em> as making things <em>work</em>. When things work, they go on to making something else work.)</p>

<p>So, since I didn&#8217;t wake up today and say &#8220;Hey, I want to learn about ACLs today!&#8221; and I don&#8217;t know that I&#8217;ll have much use to know about them in the future, I went for the easiest solution I could think of, which is this:</p>

<pre><code>chmod -R 755 ~/Dropbox/bin/
</code></pre>

<p>which says &#8220;Make everything inside the ~/Dropbox/bin/ folder executable.&#8221;</p>

<p>And I put that line in my ~/.zshenv, so that whenever I open a new shell, the command gets run. Sure if I had thousands and thousands of files in there, it might be slow, but there 205, and it takes almost no &#8216;time&#8217; at all:</p>

<pre><code>$ time chmod -R 755 ~/Dropbox/bin 
chmod -R 755 ~/Dropbox/bin  0.00s user 0.00s system 16% cpu 0.019 total
</code></pre>

<p>Or, to put it another way:</p>

<pre><code>$ date;chmod -R 755 ~/Dropbox/bin;date
Wed Dec  3 23:20:24 EST 2008
Wed Dec  3 23:20:25 EST 2008
</code></pre>

<p>It takes less than a second.</p>

<p>Note: because I am a hardcore, comment-happy geek, this is actually what I put in my .zshenv:</p>

<pre><code># if the folder is found
# make everything inside it executable
# since Dropbox doesn't save execute bit

if [[ -d $HOME/Dropbox/bin ]]
then

    chmod -R 755 $HOME/Dropbox/bin

fi
</code></pre>

<p>which means that the command only gets run if the folder is located.</p>

<p>All in all, a pretty dang slick.</p>

<h2>Just One More Thing</h2>

<p>Did I mention that Dropbox saves revisions?</p>

<p>Yeah, so now if I make a change to a script and decide I want to undo that, I can go back and get a previous version.</p>

<h2>Oh, and about those ACLs</h2>

<ol>
<li><p>15 Geek Cred points to anyone who can tell me the proper &#8216;chmod&#8217; command to set ~/Dropbox/bin/ so that all the files inside of it are automatically set to be executable.</p></li>
<li><p>25 Geek Cred points to anyone who can point me to an online &#8220;ACLs in Plain English&#8221; explanation (and no, &#8216;man acl&#8217; doesn&#8217;t count :-)</p></li>
<li><p>If you want to deal with ACLs in Mac OS X and would like a GUI tool, checkout <a href="http://www.bresink.de/osx/TinkerToolSys.html">TinkerTool System</a> (not to be confused with <a href="http://www.bresink.de/osx/TinkerTool.html">TinkerTool</a> by the same company) which <a href="http://www.bresink.de/osx/193281/screenshots.html">handles ACLs</a>.  It sells for € 7.00 (as of 2008-12-03).</p></li>
</ol>

<p>If you take nothing else away from this, remember one thing: <a href="https://www.getdropbox.com/">Dropbox? More like ROCK BOX!</a></p>

<p>(No, no, I don&#8217;t mean it&#8217;s like a box of rocks, I mean it <em>rocks</em>. Nevermind.)</p>
]]></content:encoded>
			<wfw:commentRss>http://tntluoma.com/shell-scripts/dropbox-bin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
