<?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>Cain Manor &#187; Tech</title> <atom:link href="http://cainmanor.com/category/tech/feed/" rel="self" type="application/rss+xml" /><link>http://cainmanor.com</link> <description>Your Guide To All Things Cain™</description> <lastBuildDate>Thu, 27 Oct 2011 19:34:41 +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>Push SSH public keys to multiple host</title><link>http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/</link> <comments>http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/#comments</comments> <pubDate>Tue, 02 Aug 2011 18:27:52 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[OS-X]]></category> <category><![CDATA[Tech]]></category> <category><![CDATA[UNIX]]></category> <category><![CDATA[Work]]></category><guid
isPermaLink="false">http://cainmanor.com/?p=1251</guid> <description><![CDATA[I’m starting a new job where I need to have my SSH keys pushed to hundreds of Red Hat servers. The special sauce is a command called ssh-copy-id. However, using this command requires you answering a (yes/no) question, then shortly &#8230; <a
href="http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I’m starting a new job where I need to have my SSH keys pushed to hundreds of Red Hat servers. The special sauce is a command called ssh-copy-id.  However, using this command requires you answering a (yes/no) question, then shortly thereafter enter your password.  Painful. Here’s how push your keys without the pain.<br
/> <span
id="more-1251"></span><br
/> The first problem is having to answer (yes/no) for each server.  Normally you see this…</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">The authenticity of host <span style="color: #ff0000;">'myfirsthost.work.cainmanor.com (10.256.33.106)'</span> can<span style="color: #ff0000;">'t be established.
RSA key fingerprint is fc:40:7c:de:b8:ac:a2:f5:d4:11:d0:0e:b2:77:8a:63.
Are you sure you want to continue connecting (yes/no)? yes</span></pre></div></div><p>To stop this prompt, we need to edit your ~/.ssh/config file.  Add these two lines</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">StrictHostKeyChecking no
<span style="color: #007800;">UserKnownHostsFile</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null</pre></div></div><p>Setting your UserKnownHostsFile should only be a temporary fix.  After you’ve pushed your keys, you should comment out both of those settings.</p><p>Your password is the next problem.  We can solve that with sshpass.  sshpass takes your password and passes it on when ssh ask for it.  There are three ways to do it, all of them insecure.  Read the man page and decide which of those you want to use.  For my purposes I just put it on the command line — I’m on my personal machine with no other users, and only I know the passwords to the box.  Don’t do this on a shared server.</p><p>Here is an example of how to push your public key one.  Try it on a new server to make sure you get the results you expect.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">sshpass <span style="color: #660033;">-p</span> <span style="color: #ff0000;">'MY_PASSWORD'</span> ssh-copy-id gregc<span style="color: #000000; font-weight: bold;">@</span>new_host_with_no_keys</pre></div></div><p>Now that we’ve got the prompts turned off, we’ll wrap a script around this.  How you get the list of appropriate hostnames or IP’s is your business.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> X <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> my_host_that_need_keys<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">do</span>
sshpass <span style="color: #660033;">-p</span> <span style="color: #ff0000;">'MY_PASSWORD'</span> ssh-copy-id gregc<span style="color: #000000; font-weight: bold;">@</span><span style="color: #800000;">${X}</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div><p>Happy Computing!!</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/push-ssh-public-keys-to-mulitple-host/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Installing APC (Alternative PHP Cache) on CentOS 5.6</title><link>http://cainmanor.com/tech/installing-apc-alternative-php-cache-on-centos-5-6/</link> <comments>http://cainmanor.com/tech/installing-apc-alternative-php-cache-on-centos-5-6/#comments</comments> <pubDate>Tue, 12 Jul 2011 02:12:04 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[Online]]></category> <category><![CDATA[Tech]]></category> <category><![CDATA[UNIX]]></category><guid
isPermaLink="false">http://cainmanor.com/?p=1248</guid> <description><![CDATA[There were more than a few instructions on how to do this. They were all wrong, at least for my default install of CentOS 5.6. In a nutshell, here is how I was able to do it: cd /tmp yum &#8230; <a
href="http://cainmanor.com/tech/installing-apc-alternative-php-cache-on-centos-5-6/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>There were more than a few instructions on how to do this.  They were all wrong, at least for my default install of CentOS 5.6.</p><p>In a nutshell, here is how I was able to do it:<br
/> <span
id="more-1248"></span></p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
yum <span style="color: #c20cb9; font-weight: bold;">install</span> pcre-devel
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pecl.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>APC-3.1.9.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvf</span> APC-3.1.9.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> APC-3.1.9
phpize
<span style="color: #c20cb9; font-weight: bold;">whereis</span> php-config
.<span style="color: #000000; font-weight: bold;">/</span>configure –enable-apc –enable-apc-mmap –with-apxs –with-php <span style="color: #007800;">config</span>=<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>php-config
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;extension=apc.so&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.d<span style="color: #000000; font-weight: bold;">/</span>apc.ini
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;apc.slam_defense=0&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.d<span style="color: #000000; font-weight: bold;">/</span>apc.ini
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;apc.write_lock=1&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.d<span style="color: #000000; font-weight: bold;">/</span>apc.ini
service httpd restart</pre></div></div><p>I also make these changes to my httpd.conf file</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">Timeout <span style="color: #000000;">40</span>
KeepAlive On
MaxKeepAliveRequests <span style="color: #000000;">200</span>
KeepAliveTimeout <span style="color: #000000;">2</span></pre></div></div>]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/installing-apc-alternative-php-cache-on-centos-5-6/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Max out your Dropbox referrals using Google Adwords</title><link>http://cainmanor.com/tech/max-out-your-dropbox-referrals-using-google-adwords/</link> <comments>http://cainmanor.com/tech/max-out-your-dropbox-referrals-using-google-adwords/#comments</comments> <pubDate>Mon, 24 Jan 2011 21:37:07 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[Online]]></category> <category><![CDATA[Tech]]></category><guid
isPermaLink="false">http://cainmanor.com/?p=1220</guid> <description><![CDATA[I love Dropbox. It’s a giant USB drive you can use from anywhere, it’s a great way to keep backups, it’s a great way to share files and it’s free. After spending two hours and 15 minutes on the latest &#8230; <a
href="http://cainmanor.com/tech/max-out-your-dropbox-referrals-using-google-adwords/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I love Dropbox.</p><p>It’s a giant USB drive you can use from anywhere, it’s a great way to keep backups, it’s a great way to share files and it’s free. After spending two hours and 15 minutes on the latest Dropbox <a
href="https://www.dropbox.com/dropquest2011">promotion</a> for 1 GB of extra space ( I was the 343rd finisher, which was about 15 minutes behind the winner), I thought there has to be a better way.  There is — Google Adwords.</p><p>Here’s how to max out your Dropbox referrals using Google Adwords.</p><p><span
id="more-1220"></span></p><ol><li>Get a coupon for free Google Adwords credit.  Google for “google adwords promotional code.”  Under search tools, set your search to the last month or the last week. It might take a few searches, but eventually you’ll find it. Whatever you do, DO NOT PAY FOR A PROMOTIONAL CODE.  Finding the code was the hardest part, but eventually you’ll find one.</li><li>Once you have the voucher (it may take a few days), create your <a
href="http://adwords.google.com/">Google Adwords account</a>.</li><li>Create your Ad Campaign.  I created one Campaign, with two different Ad Groups.  The most important step is to make sure you use your referral link (found <a
title="Your Dropbox Referral Link" href="https://www.dropbox.com/referrals" target="_blank">here</a>) instead of just putting in dropbox.com.  That’s where the magic happens.  When someone clicks on the dropbox.com link, they are clicking on on your referral link, which sends them to the dropbox signup page.<br
/><table
border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td
width="50%"><a
href="http://photos.cainmanor.com/2011/01/Adword-First.png"><img
class="alignleft size-full wp-image-1223" title="Adword - First" src="http://photos.cainmanor.com/2011/01/Adword-First.png" alt="" width="177" height="78" /></a>The first, using just the keyword of “Dropbox”, was quite a bit more expensive and had a lower return. The CPC (Cost Per Click) of $.24, with 124 clicks out of 11,500 impressions (which means it was served on 11,500 pages, and clicked 124 times.)  Not all of the clicks resulted in people actually signing up.</td><td
width="50%"><a
href="http://photos.cainmanor.com/2011/01/Adword-Second.png"><img
class="alignright size-full wp-image-1224" title="Adword - Second" src="http://photos.cainmanor.com/2011/01/Adword-Second.png" alt="" width="218" height="81" /></a>The second ad was using the keyword of “Get Dropbox”, which had a CPC of $.13, but I got 64 clicks out of 1,418 impressions.   The total cost for this ad was between 1/3rd and 1/4 the cost of the first ad.</td></tr></tbody></table></li><li>Now all you need to do is sit back and watch the referrals roll in.  Not all clicks go on to sign up, and not everybody that signs up installs the software, which is a necessary step in the process.  Of the 188 clicks, 35 joined Dropbox, and 30 installed the software.  If you were starting from zero, you’d need 32 people to sign up in order to get the complete 8GB.</li></ol><p>There were a couple of things I would do differently. I set up a relatively low budget for the ads per day, which means they will only run a few times per day (for instance, if you have a $5 a day budget, and your ad is estimated to cost $.25 per click, it will only get, at max, 20 clicks a day.) The time those ads run will be spread out over the course of the day. It’s not bad, but there really wasn’t any reason to not just use your estimated budget at once. Be careful to not go over your budget, because those cost come out of your pocket.</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/max-out-your-dropbox-referrals-using-google-adwords/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Install Django on OS-X Snow Leopard using sqlite3</title><link>http://cainmanor.com/tech/install-django-on-os-x-snow-leopard-using-sqlite3/</link> <comments>http://cainmanor.com/tech/install-django-on-os-x-snow-leopard-using-sqlite3/#comments</comments> <pubDate>Sun, 09 Jan 2011 01:40:29 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[Online]]></category> <category><![CDATA[Tech]]></category> <category><![CDATA[UNIX]]></category><guid
isPermaLink="false">http://cainmanor.com/?p=1213</guid> <description><![CDATA[Download django.   It should default to your ~/Downloads folder and it should be untarred. Go into that directory (in my case, /Users/gregcain/Downloads/Django-1.2.4), and install Django. sudo python setup.py install Now we need to configure our first project, which we’ll &#8230; <a
href="http://cainmanor.com/tech/install-django-on-os-x-snow-leopard-using-sqlite3/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Download <a
href="http://www.djangoproject.com/download/">django</a>.   It should default to your ~/Downloads folder and it should be untarred.  Go into that directory (in my case, /Users/gregcain/Downloads/Django-1.2.4), and install Django.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> python setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div><p><span
id="more-1213"></span><br
/> Now we need to configure our first project, which we’ll call myBooks.  Create the parent directory you want your project to live in.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>Django</pre></div></div><p>Let’s create the first project</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">django-admin.py startproject myBooks</pre></div></div><p>You’ll see a directory created underneath your Django directory called myBooks. (~/Django/myBooks)  In that directory, you’ll see the following files…</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">__init__.py
manage.py
settings.py
urls.py</pre></div></div><p>Start the built in web server.  From the directory ~/Django/myBooks directory</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">python manage.py runserver</pre></div></div><p>Which gives you this..</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">Django version 1.2.4, using settings <span style="color: #ff0000;">'myBooks.settings'</span>
Development server is running at http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1:<span style="color: #000000;">8000</span><span style="color: #000000; font-weight: bold;">/</span>
Quit the server with CONTROL-C.</pre></div></div><p>If you point your web browser to http://127.0.0.1:8000/ you should see this basic getting started page<br
/> <a
href="http://photos.cainmanor.com/2011/01/Screen-shot-2011-01-08-at-4.21.39-PM.png"><img
src="http://photos.cainmanor.com/2011/01/Screen-shot-2011-01-08-at-4.21.39-PM.png" alt="" title="Django getting started web view" width="869" height="280" class="alignnone size-full wp-image-1214" /></a><br
/> If you see that, all is good so far…</p><p>Now let’s configure Django to use sqlite as it’s database.  All you need to do is edit the settings.py file in ~/Django/myBooks.  You need to change ENGINE to the sqlite3 instance, and tell it where you want your database to live.  You’ll create that database in the next step.</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">DATABASES = <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #ff0000;">'default'</span>: <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #ff0000;">'ENGINE'</span>: <span style="color: #ff0000;">'django.db.backends.sqlite3'</span>, <span style="color: #666666; font-style: italic;"># Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.</span>
        <span style="color: #ff0000;">'NAME'</span>: <span style="color: #ff0000;">'/Users/gregcain/Django/myBooks/myBooksDB'</span>,                      <span style="color: #666666; font-style: italic;"># Or path to database file if using sqlite3.</span>
        <span style="color: #ff0000;">'USER'</span>: <span style="color: #ff0000;">''</span>,                      <span style="color: #666666; font-style: italic;"># Not used with sqlite3.</span>
        <span style="color: #ff0000;">'PASSWORD'</span>: <span style="color: #ff0000;">''</span>,                  <span style="color: #666666; font-style: italic;"># Not used with sqlite3.</span>
        <span style="color: #ff0000;">'HOST'</span>: <span style="color: #ff0000;">''</span>,                      <span style="color: #666666; font-style: italic;"># Set to empty string for localhost. Not used with sqlite3.</span>
        <span style="color: #ff0000;">'PORT'</span>: <span style="color: #ff0000;">''</span>,                      <span style="color: #666666; font-style: italic;"># Set to empty string for default. Not used with sqlite3.</span>
    <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div><p>Now create the database</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">python manage.py syncdb</pre></div></div><p>You’ll be asked a few questions, including one to setup a super user.</p><p>Now that the database is created, let’s go in and see if it looks correct.  To open a connection to the database</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">sqlite3 myBooksDB</pre></div></div><p>and to see the schema</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">.schema</pre></div></div><p>Happy Coding!!</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/install-django-on-os-x-snow-leopard-using-sqlite3/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The Internet Down Under</title><link>http://cainmanor.com/tech/the-internet-down-under/</link> <comments>http://cainmanor.com/tech/the-internet-down-under/#comments</comments> <pubDate>Sat, 04 Dec 2010 09:23:19 +0000</pubDate> <dc:creator>Greg Cain</dc:creator> <category><![CDATA[Australia]]></category> <category><![CDATA[Online]]></category> <category><![CDATA[Tech]]></category><guid
isPermaLink="false">http://cainmanor.com/?p=1191</guid> <description><![CDATA[My post were sparse to begin with, but recently I’ve started catching up. But you’ll notice that there aren’t many photos. Why? Because the Internet sucks in Australia and New Zealand. When I first moved in with Tom and Felicity &#8230; <a
href="http://cainmanor.com/tech/the-internet-down-under/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>My post were sparse to begin with, but recently I’ve started catching up.  But you’ll notice that there aren’t many photos.  Why?  Because the Internet sucks in Australia and New Zealand.  When I first moved in with Tom and Felicity the connection was good, but not great. It also may have been the reason for some of Tom’s frustration.<br
/> <span
id="more-1191"></span><br
/> Once we got on the road, I found the Internet access to be spotty.  At our first hotel, I didn’t get online, if only because we were otherwise occupied.  In the second hotel (Strathfield), we had no TV, much less Internet, but then again, I kept my laptop close to my chest (literally) to stop any hobo stabbings that might occur.  The third hotel had access, but I don’t remember how much it cost.  It wasn’t cheap, and it was only 512K.  The third hotel, in Melbourne was $16 for the same 512K, and it never got better.  Perth was $22 for the same 512K, but I joined the Hotel Frequent Flier Club to get it for $11 instead of $22.  Oddly enough, when we got to Alice Springs, the access was better than anywhere else we’d been.  It was expensive — $16, but it was pretty fast, and we were in one of the most isolated places in the world.  I had hoped it would get better, but it didn’t.  Back in Sydney, at the Formule 1 hotel, it was $20 for 3 hours, with a download limit of 50 Mb.  On to Auckland, it was $30 for 100MB over 24 hours.  It’s like living in 1990, and it’s very annoying.  That’s why there aren’t many photos.</p><p>All in all, the access sucks. I somewhat expected it, since Australia is pretty isolated, but I don’t like it.  When I get back to Seattle, or wherever we settle, I intent to splice the Ethernet cable into my arm, and try to create some sort of Borg like person.   Then I’ll get Comcast, which sucks, but is fast, and a backup DSL line (cause Comcast sucks.)</p> ]]></content:encoded> <wfw:commentRss>http://cainmanor.com/tech/the-internet-down-under/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/44 queries in 0.033 seconds using apc
Object Caching 611/696 objects using apc

Served from: cainmanor.com @ 2012-02-04 19:16:20 -->
