<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>MorganGoose.com</title>
    <link>http://morgangoose.com/blog</link>
    <description>notes about various technical subjects</description>
    <pubDate>Thu, 08 Dec 2016 01:14:37 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Fedora KVM with simple network forwards</title>
      <link>http://morgangoose.com/blog/2010/06/fedora-kvm-with-simple-network-forwards/</link>
      <pubDate>Wed, 02 Jun 2010 22:52:43 PDT</pubDate>
      <category><![CDATA[Servers]]></category>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/2010/06/fedora-kvm-with-simple-netowrk-forward/</guid>
      <description>Fedora KVM with simple network forwards</description>
      <content:encoded><![CDATA[<div class="document">
<p>Recently I've been teaching python to some high school students. It has been going well, but the development environment we had access to left a little bit to be desired. We were working with ages old solaris, vi only, and no real access to newer gnu (or other) tools. So a new setup was required, I went off to investigate.</p>
<p>I started with chroot, since a buddy, Daniel Thau, had used it extensively for running <a class="reference external" href="http://opensource.osu.edu/sites/default/files/chroottalk_0.pdf">multiple operating systems side by side</a>. He'd pointed me in the directions of <a class="reference external" href="http://people.redhat.com/~rjones/febootstrap/">febootstrap</a> and that seemed like it'd work fine. I was able to make a sandbox, get ssh running on 2022 and then have my dlink route that to my box. Success!</p>
<p>But I found that a bit messy, and a bit limited. I wanted to lock down how much of my resources they could use, and I didn't want to have to give access to some of my root file systems directly; /proc, /dev, etc. So I looked around a bit more, and stumbled on using KVM indirectly via the new virt-manager toolset that fedora 12 and 13 provide. Installation was as simple as:</p>
<div class="highlight"><pre><span class="nv">$ </span>yum install qemu-kvm virt-manager virt-viewer python-virtinst
</pre></div>
<p>But it also seems that from the <a class="reference external" href="http://www.techotopia.com/index.php/Installing_and_Configuring_Fedora_KVM_Virtualization">techotopia article</a> I followed for some of this that one could also just do:</p>
<div class="highlight"><pre><span class="nv">$ </span>yum groupinstall <span class="s1">&#39;Virtualization&#39;</span>
</pre></div>
<p>I have to say it's a pretty swank set of tools. It's free, it works on KVM or Xen. KVM usage requires no special kernel and as such, no reboot. The setup was simple, and gave out a vnc port to connect to from the get go. It is also trivial to connect to a setup on machine A with virt-manager on machine B over ssh. If you want more information, <a class="reference external" href="http://fedoraproject.org/wiki/Virtualization_Quick_Start">fedora has a nice writeup</a>, and libvirt has a more <a class="reference external" href="http://wiki.libvirt.org/page/Main_Page">distro agnostic set of docs</a>.</p>
<p>Problem was though that the networking was virtual, and didn't pull an IP address from my router, so it wasn't public. There were a few sections here and there describing how to switch to bridged, and I tried them. They didn't work for me, either I suck at following directions, or they just won't work how I expect them to. You can see for yourself <a class="reference external" href="http://wiki.libvirt.org/page/Networking#Fedora.2FRHEL_Bridging">here</a> at how I attempted network bridging.</p>
<p>What I did was much more in my realm of knowledge, is simpler than all the other options, and is something I can make changes to w/o killing my network connectivity. iptables! I just used NAT forwarding. It was 2 lines, put in my pre-existing firewall script. So to get my local box 192.168.1.199 on port 2022 to forward to its internal virtual network of 192.168.100.2 at port 22 was as plain as this:</p>
<div class="highlight"><pre><span class="nv">$ </span>iptables -t nat -I PREROUTING -p tcp --dport 2022 -j DNAT<span class="se">\</span>
    --to-destination 192.168.100.2:22
<span class="nv">$ </span>iptables -I FORWARD -p tcp --dport 22 -d 192.168.100.2 -j ACCEPT
</pre></div>
<p>One preroute rule to grab the port incoming, and one forward rule to pass said packets along. Now I have connectivity into my class virtual machine, and I don't have to do much to add more ports as needed. I am pretty happy with the setup so far. It's really nice to be able to connect remotely, vnc or ssh now, as well as know that I've limited the ram and cpu time the class can use on my box. I am interested to hear if anyone else is doing similar things with virtualization on their desktops.</p>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Fedora with awesome window manager</title>
      <link>http://morgangoose.com/blog/2010/05/fedora-with-awesome-window-manager/</link>
      <pubDate>Sat, 29 May 2010 11:57:56 PDT</pubDate>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/2010/05/fedora-with-awesome-window-manager/</guid>
      <description>Fedora with awesome window manager</description>
      <content:encoded><![CDATA[<div class="document">
<p>I have recently gotten into tiling window managers. Awesome being the one I've found I like to use the most. There are others and they all have their merits, I just settled on this one, and then got comfortable. I also am a bit of a mutt in what distro's I use. Work they put ubuntu on my box, home I have usually used fedora but now it's fedora on the desktop and arch on the laptop.</p>
<p>So the issue was arch and ubuntu both had awesome in the package repos, and fedora did not. There is discussion out there as to why this was, and you might be interested in it. Me, I just wanted to use awesome. So using the directions from the awesome wiki and grabbing the required source rpms cairo-1.8.8-3.fc12.src.rpm and awesome-3.4.4-1.fc12.src.rpm, I now have awesome on my desktop.</p>
<p><strong>Here are some of the docs and sources I used:</strong></p>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://awesome.naquadah.org/wiki/Awesome-3-fedora">directions from awesome's wiki</a></li>
<li><a class="reference external" href="http://mnowak.fedorapeople.org/awesome/">awesome src.rpms for fedora</a></li>
<li><a class="reference external" href="http://rpm.pbone.net/index.php3/stat/26/dist/69/size/6660576/name/cairo-1.8.8-3.fc12.src.rpm">the cario src.rpm</a></li>
<li><a class="reference external" href="https://bugzilla.redhat.com/show_bug.cgi?id=452427">discussion on package inclusion</a></li>
</ul>
</blockquote>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>How fabric gets it right</title>
      <link>http://morgangoose.com/blog/2010/02/how-fabric-gets-it-right/</link>
      <pubDate>Thu, 11 Feb 2010 00:56:33 PST</pubDate>
      <category><![CDATA[Tools]]></category>
      <category><![CDATA[Programming]]></category>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/?p=76</guid>
      <description>How fabric gets it right</description>
      <content:encoded><![CDATA[<div class="document">
<div class="section" id="i-like-fabric-a-lot">
<h1>I like <a class="reference external" href="http://docs.fabfile.org">fabric</a>. A lot.</h1>
<p>Its a easy to use tool that continually makes my life simpler, and my projects smarter and more automated. Not much out there can really say that. At least nothing I use daily, without noticing, and dependably.</p>
<p>I used to use vellum, and that did what I needed. But fabric being under active development, and getting new features each version it seems is a huge plus. That and it does the network stuff for you, along with the nitty gritty.</p>
<p>Recently I have been giving presentations to the <a class="reference external" href="http://opensource.osu.edu/">Ohio State University's Open Source Club</a> about <a class="reference external" href="http://morgangoose.com/p/gnu_tools/">gnu tools</a>, <a class="reference external" href="http://morgangoose.com/p/tool_oriented_python/">python tools</a>, and soon some cli apps. Fabric really helped make this simple for me to get a whole system down for making and uploading these.</p>
<p>I made all of those presentations in restrctured text, and compiled them into their final formats. All of which was scripted in fabric. I became really attached to ReST after getting introduced to it watching <a class="reference external" href="http://catherinedevlin.pythoneers.com/">Catherine Devlin</a> give a <a class="reference external" href="ahref=&quot;http://catherinedevlin.pythoneers.com/presentations/rst/olf.html">talk about restructured text</a> at Ohio Linux Fest. I ended up finding a cool rst2s5 command that makes nice presentations and with a little tweaking it now also has syntax highlighted code blocks, and can make nice pdfs.</p>
<p>In starting to use fabric you'll notice the basic idea is that you'd make a fabfile that works a lot like a Makefile or a SConstruct file would, with make and scons respectively. You'll make calls with the fab command in the directory the fabfile is located and it will supply the targets.</p>
<p>Below in this example, two targets are made, pack and deploy. The pack target will just makes a tarball, using the local function fabric provides. The deploy target calls pack to make this tarball, then using the put function will place the tarball into the tmp directory, then change into the web dir provided, and extract the archive. It knows automaticly to do this to both hosts I provided, and since I am using an ssh key does all this trickery autonomously.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">fabfile.py:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<div class="highlight"><pre><span class="kn">from</span> <span class="nn">fabric.api</span> <span class="kn">import</span> <span class="o">*</span>

<span class="n">env</span><span class="o">.</span><span class="n">user</span> <span class="o">=</span> <span class="s">&#39;username&#39;</span>
<span class="n">env</span><span class="o">.</span><span class="n">hosts</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;host1.com&#39;</span><span class="p">,</span> <span class="s">&#39;host2.com&#39;</span><span class="p">]</span>

<span class="k">def</span> <span class="nf">pack</span><span class="p">():</span>
    <span class="n">local</span><span class="p">(</span><span class="s">&#39;tar czf /tmp/project_foo.tgz project_foo/&#39;</span><span class="p">,</span> <span class="n">capture</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">deploy</span><span class="p">():</span>
    <span class="n">pack</span><span class="p">()</span>
    <span class="n">put</span><span class="p">(</span><span class="s">&#39;/tmp/project_foo.tgz&#39;</span><span class="p">,</span> <span class="s">&#39;/tmp/&#39;</span><span class="p">)</span>

    <span class="k">with</span> <span class="n">cd</span><span class="p">(</span><span class="s">&#39;/var/www/foo/&#39;</span><span class="p">):</span>
        <span class="n">run</span><span class="p">(</span><span class="s">&#39;tar xzf /tmp/project_foo.tgz&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="fabric-can-do-a-lot-more-than-just-deploy">
<h1>Fabric can do a lot more than just deploy</h1>
<p>It's <a class="reference external" href="http://docs.fabfile.org">docs</a> have a lot of detail, and explain most everything well. A last example of some a cool fabric config would be the one I use to publish my presentations to this site.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">fabfile.py:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
<div class="highlight"><pre><span class="kn">from</span> <span class="nn">fabric.api</span> <span class="kn">import</span> <span class="o">*</span>

<span class="n">env</span><span class="o">.</span><span class="n">roledefs</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s">&#39;production&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s">&quot;morgangoose.com&quot;</span><span class="p">],</span>
    <span class="p">}</span>


<span class="k">def</span> <span class="nf">setup_vars</span><span class="p">(</span><span class="n">project</span><span class="p">):</span>
    <span class="k">global</span> <span class="n">presentation</span>
    <span class="k">global</span> <span class="n">presentation_archive</span>
    <span class="k">global</span> <span class="n">rst_source</span>
    <span class="k">global</span> <span class="n">pdf</span>

    <span class="n">project</span> <span class="o">=</span> <span class="n">project</span><span class="o">.</span><span class="n">strip</span><span class="p">(</span><span class="s">&quot;/&quot;</span><span class="p">)</span>
    <span class="n">presentation</span> <span class="o">=</span> <span class="n">project</span>
    <span class="n">presentation_archive</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">.tar.gz&quot;</span> <span class="o">%</span> <span class="n">presentation</span>
    <span class="n">rst_source</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">.rst&quot;</span> <span class="o">%</span> <span class="n">presentation</span>
    <span class="n">pdf</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">.pdf&quot;</span> <span class="o">%</span> <span class="n">presentation</span>

<span class="nd">@roles</span><span class="p">(</span><span class="s">&#39;production&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">upload</span><span class="p">(</span><span class="n">project</span><span class="p">):</span>
    <span class="n">env</span><span class="o">.</span><span class="n">user</span> <span class="o">=</span> <span class="s">&quot;username&quot;</span>
    <span class="n">p_dir</span> <span class="o">=</span> <span class="s">&quot;/var/www/html/p/&quot;</span>

    <span class="n">package</span><span class="p">(</span><span class="n">project</span><span class="p">)</span>
    <span class="n">put</span><span class="p">(</span><span class="n">presentation_archive</span><span class="p">,</span> <span class="n">p_dir</span><span class="p">)</span>
    <span class="n">put</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">presentation</span><span class="p">,</span> <span class="n">pdf</span><span class="p">),</span> <span class="n">p_dir</span><span class="p">)</span>
    <span class="k">with</span> <span class="n">cd</span><span class="p">(</span><span class="n">p_dir</span><span class="p">):</span>
        <span class="n">run</span><span class="p">(</span><span class="s">&quot;rm -rf </span><span class="si">%s</span><span class="s">/&quot;</span> <span class="o">%</span> <span class="n">presentation</span><span class="p">)</span>
        <span class="n">run</span><span class="p">(</span><span class="s">&quot;tar zxvf </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">presentation_archive</span><span class="p">)</span>

    <span class="n">local</span><span class="p">(</span><span class="s">&quot;rm -f </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">presentation_archive</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">package</span><span class="p">(</span><span class="n">project</span><span class="p">):</span>
    <span class="n">setup_vars</span><span class="p">(</span><span class="n">project</span><span class="p">)</span>
    <span class="n">make_presentation</span><span class="p">()</span>
    <span class="n">local</span><span class="p">(</span><span class="s">&quot;tar zcvf </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">presentation_archive</span><span class="p">,</span> <span class="n">presentation</span><span class="p">))</span>

<span class="k">def</span> <span class="nf">make_presentation</span><span class="p">():</span>
    <span class="c">#PDF first</span>
    <span class="n">local</span><span class="p">(</span><span class="s">&quot;rst2pdf </span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s"> -o </span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span>
        <span class="n">presentation</span><span class="p">,</span> <span class="n">rst_source</span><span class="p">,</span> <span class="n">presentation</span><span class="p">,</span> <span class="n">pdf</span><span class="p">,</span> <span class="p">))</span>

    <span class="c">#Then s5 html presentation</span>
    <span class="n">local</span><span class="p">(</span><span class="s">&quot;python rst-directive.py </span><span class="se">\</span>
<span class="s">            --stylesheet=pygments.css </span><span class="se">\</span>
<span class="s">            --theme=small-black </span><span class="se">\</span>
<span class="s">            --quiet </span><span class="se">\</span>
<span class="s">            </span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s"> &gt; </span><span class="si">%s</span><span class="s">/index.html&quot;</span> <span class="o">%</span> <span class="p">(</span>
                <span class="n">presentation</span><span class="p">,</span> <span class="n">rst_source</span><span class="p">,</span> <span class="n">presentation</span><span class="p">,</span> <span class="p">))</span>

<span class="k">def</span> <span class="nf">new</span><span class="p">(</span><span class="n">project</span><span class="p">):</span>
    <span class="n">setup_vars</span><span class="p">(</span><span class="n">project</span><span class="p">)</span>
    <span class="n">local</span><span class="p">(</span><span class="s">&quot;mkdir -p </span><span class="si">%s</span><span class="s">/{,files}&quot;</span> <span class="o">%</span> <span class="n">presentation</span><span class="p">)</span>
    <span class="n">local</span><span class="p">(</span><span class="s">&quot;cp -R ui </span><span class="si">%s</span><span class="s">/&quot;</span> <span class="o">%</span> <span class="n">presentation</span><span class="p">)</span>
    <span class="n">local</span><span class="p">(</span><span class="s">&quot;touch </span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">presentation</span><span class="p">,</span> <span class="n">rst_source</span><span class="p">))</span>
</pre></div>
<p>This has some more complicated bits, where it uses the role decorator to specify only to use the hosts listed in the production role definitions.</p>
<p>It also takes advantage of an awesome feature I didn't know fabric had where, one can send arguments to a fabric target. So the project parameter in the targets here can be, and is, supplied via the command line.</p>
</div>
<div class="section" id="for-example">
<h1>For example</h1>
<p>I used this to deploy the updates to my most recent presentation:</p>
<div class="highlight"><pre><span class="nv">$ </span>fab upload:tool_oriented_python
</pre></div>
<p>That's telling fabric to run the upload target, and send the string &quot;tool_oriented_python&quot; as an argument to the function.</p>
<p>If you forget the targets you have just do:</p>
<div class="highlight"><pre><span class="nv">$ </span>fab -l
</pre></div>
</div>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>GNU tools presentation</title>
      <link>http://morgangoose.com/blog/2010/02/gnu-tools-presentation/</link>
      <pubDate>Mon, 01 Feb 2010 10:41:17 PST</pubDate>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/2010/02/gnu-tools-presentation/</guid>
      <description>GNU tools presentation</description>
      <content:encoded><![CDATA[<div class="document">
<p>The other day, I gave a presentation to the Ohio State University, Open Source Club. It was on a smattering of command line utilities that I use on a daily basis, as well as a quick intro to regex usage.</p>
<p>It is all accessible on my site <a class="reference external" href="http://morgangoose.com/p/gnu_tools/">here</a> and in <a class="reference external" href="http://morgangoose.com/p/gnu_tools/gnu_tools.pdf">pdf</a> form.</p>
<p>It was pretty long, and presenting it took a little over an hour. I plan on distilling the parts I liked talking about into more concise presentations, and also a blog post or two.</p>
<p>Awk and find will most likely be their own posts/presentations. I think I need to learn some more of the advanced uses of sed, and revisit that section to make it a bit more clear.</p>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Logitech MX Revolution configuration</title>
      <link>http://morgangoose.com/blog/2009/08/logitech-mx-revolution-configuration/</link>
      <pubDate>Mon, 24 Aug 2009 22:44:22 PDT</pubDate>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/2009/08/logitech-mx-revolution-configuration/</guid>
      <description>Logitech MX Revolution configuration</description>
      <content:encoded><![CDATA[<div class="document">
<p>The other day <a class="reference external" href="http://twitter.com/shuckins">&#64;shuckins</a> mentioned that</p>
<blockquote>
I'm finding the MX Revolution quite awesome except that I really miss my scroll wheel click button.</blockquote>
<p>This was an issue that I had when I started using this mouse as well. The key feature of the mouse being that a middle click will switch the scroll wheel from smooth movement to discrete (chunky?) movement and back again. This is actually very cool to use once you've gotten accustomed to having the option of scrolling down a page with fine control of speed/distance and then click once to then flick back up to the top of a page.</p>
<p>What I did to make my life easier with this mouse was setup the thumb scroll wheel to act as my middle click that I was accustomed to having. I accomplished this via the btnx-config program as available from the <a class="reference external" href="http://www.ollisalonen.com/btnx">btnx</a> website.</p>
<div class="figure align-center">
<a class="reference external image-reference" href="/images/Screenshot-btnx-config-1.png"><img alt="ThumbPress" class="size-medium wp-image-63" src="/images/Screenshot-btnx-config-1-300x203.png" style="width: 300px; height: 203px;" /></a>
<p class="caption">Configuration for thumb wheel press/click</p>
</div>
<p>Once I found out how easy it was to get the middle click from the thumb wheel I decided to make the thumb up/down also have some functionality. If you use firefox and/or gnome terminal I find the most useful thing to map was thumb up to shift pageup and thumb down to shift pagedown.</p>
<div class="figure align-center">
<a class="reference external image-reference" href="/images/Screenshot-btnx-config1.png"><img alt="ThumbDown" class="size-medium wp-image-62" src="/images/Screenshot-btnx-config1-300x203.png" style="width: 300px; height: 203px;" /></a>
<p class="caption">Configuration for thumb wheel down</p>
</div>
<p>With these set this way I can switch tabs on both firefox and gnome-terminal w/o moving back to the keyboard. The other neat thing I found (when I actually noticed) was that this mapping holds even when using synergy to control two (or more) machines.</p>
<p>The mouse works great, and I haven't in recent memory ever like a mouse as much as I have this one. Couple the nice manufacturing with the ease of button configuration provided by the great programmers of btnx  and I think its the perfect mouse for a programmer. Especially one who doesn't like to have to constantly switch between using the mouse and keyboard.</p>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Getting stfl working on fedora 11 x64</title>
      <link>http://morgangoose.com/blog/2009/07/getting-stfl-working-on-fedora-11-x64/</link>
      <pubDate>Thu, 30 Jul 2009 11:14:11 PDT</pubDate>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/2009/07/getting-stfl-working-on-fedora-11-x64/</guid>
      <description>Getting stfl working on fedora 11 x64</description>
      <content:encoded><![CDATA[<div class="document">
<p><a class="reference external" href="http://www.newsbeuter.org">Newbeuter</a> is my preferred way to browse RSS feeds. Its a great CLI app that is 'Mutt Of Feed Readers', and being a user of <a class="reference external" href="http://www.mutt.org">mutt</a> I love this app for being so similar. I wanted to use the newest version of newbeuter, because recently I have been on a kick to get all of my apps: screen, vim, mutt, and now newsbuter; setup with 256 colours.</p>
<p>I read on the development blog that the newest version in the git repo was able to use 256 colours, so I immediately cloned the repo and started the install process. I was stopped immediately at the config.sh. It wanted the stfl libraries and wasn't able to find them, and neither could yum.</p>
<p>Looking into the config.sh I saw that it was querying pkg-config for the flags to use on compilation to see if the library was present. It wasn't, and so I also read further on the notes for the git repo version, and saw the bit about using the latest svn copy of stfl. So I checked that out, made it and installed it onto my machine. But this didn't get me any further into making newsbueter, because pkg-config was still unable to find libstfl.</p>
<p>So I decided to try and figure out what the issue was with stfl and pkg-config. First thing I saw was that the stfl.pc file that pkg-config uses to make its responses was in the wrong place for my system. It was in /usr/local/lib/pkgconfig, instead of with the other libraries on my system in /usr/lib64/pkgconfig. This resolved the issue of pkg-config not knowing where the pc file for stfl was, and pkg-config was now returning actual data about libstfl. A recompilation of newsbeuter did show that there was still a problem. I now received: error while loading shared libraries: libstfl.so.0: cannot open shared object file: No such file or directory.</p>
<p>I did another updatedb, and ran a locate for all stfl files, and found that the make install for stfl was putting the libs in a strange place as well. I then updated both the Makefile.cfg and the stfl.so.in to reflect the locations of other libs:</p>
<p><strong>Makefile.cfg</strong> changed lines</p>
<div class="highlight"><pre><span class="k">export </span><span class="nv">libdir</span> <span class="o">?=</span> lib64
<span class="k">export </span><span class="nv">prefix</span> <span class="o">?=</span> usr
<span class="k">export </span><span class="nv">DESTDIR</span> <span class="o">?=</span> /
</pre></div>
<p><strong>stfl.pc.in</strong> changes lines</p>
<div class="highlight"><pre><span class="nv">prefix</span><span class="o">=</span>/usr
<span class="nv">exec_prefix</span><span class="o">=</span>/usr
<span class="nv">libdir</span><span class="o">=</span>/usr/lib64
<span class="nv">includedir</span><span class="o">=</span>/usr/include
</pre></div>
<p>This got me pretty far I think, because now the system looked like the other libraries. The stfl.pc lines were taken almost verbatim from the sqlite3.pc file in fact. I was still getting the shared library issue though, and after not thinking about the problem for a bit I realized that the stfl makefile had made libstfl.so.0.21 and the error message was not able to find libstfl.so.0, so I too the logical leap and made a symlink named libstfl.so.0 that pointed to libstfl.so.0.21 in the /usr/lib64/ directory. After making sure that this worked, I made a change to the makefile for stfl, and added another line to make a second symlink, that ended in 0:</p>
<p><strong>Makefile</strong></p>
<div class="highlight"><pre><span class="err">ln</span> <span class="err">-fs</span> <span class="err">libstfl.so.</span><span class="k">$(</span>VERSION<span class="k">)</span> <span class="k">$(</span>DESTDIR<span class="k">)$(</span>prefix<span class="k">)</span>/<span class="k">$(</span>libdir<span class="k">)</span>/libstfl.so.0
</pre></div>
<p>I do admit that there may be a better way to do this, and some of it may be done with command line config or make flags. I don't know them, and was able to successfully build with these changes.</p>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Decouple with kwargs</title>
      <link>http://morgangoose.com/blog/2009/07/decouple-with-kwargs/</link>
      <pubDate>Wed, 22 Jul 2009 17:26:42 PDT</pubDate>
      <category><![CDATA[Programming]]></category>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/?p=45</guid>
      <description>Decouple with kwargs</description>
      <content:encoded><![CDATA[<div class="document">
<p>So I've been attempting to make a suite of cli scripts for work. I recently discovered the <a class="reference external" href="http://docs.python.org/library/multiprocessing.html">multiprocessing</a> module for python, and really liked its simplicity, and started using it, with great success. Everything was faster.</p>
<p>This then spurred me to take the scripts that were for the most part, copy common-ish bits and then modify to suite, and turn them into a library of sorts. The neat part then arose when I wanted to import a argument parser, as well as pass off to a proc creation component.</p>
<p>In doing this I had in mind that the 'script' would need to only define a function to make a list of commands to run on a given server, and a __main__ section that would pass in a list of servers, the function to make a command list and some other info. This way the script itself would only be two definition sections, and only the parts that were going to be unique for the most part.</p>
<p>The problem that came up in doing this is when I wanted the function that makes the command list to have more arguments that normal. How would I pass them in, and how would I define them so that I don't have to edit my libraries to accommodate this argument passing.  It was kwargs that saved me there, that and some <a class="reference external" href="http://docs.python.org/library/optparse.html">optparse</a> tweaking.</p>
<p>Here is a basic example:</p>
<div class="section" id="script-py">
<h1>script.py</h1>
<div class="highlight"><pre><span class="k">def</span> <span class="nf">get_commands</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
    <span class="n">command_list</span> <span class="o">=</span> <span class="p">[]</span>

    <span class="n">user</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;user&#39;</span><span class="p">]</span>
    <span class="n">key_file</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;key_file&#39;</span><span class="p">]</span>

    <span class="n">command_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;echo </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">user</span><span class="p">)</span>

    <span class="k">return</span> <span class="n">command_list</span>

<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
    <span class="kn">import</span> <span class="nn">automation</span>

    <span class="n">hosts</span> <span class="o">=</span> <span class="p">[]</span>

    <span class="p">(</span><span class="n">hosts</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span> <span class="o">=</span> <span class="n">automation</span><span class="o">.</span><span class="n">process_args</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span>

    <span class="n">automation</span><span class="o">.</span><span class="n">thread_hosts</span><span class="p">(</span>
            <span class="n">hosts</span><span class="p">,</span>
            <span class="n">get_commands</span><span class="p">,</span>
            <span class="n">options</span><span class="p">,</span>
            <span class="n">user</span><span class="o">=</span><span class="s">&quot;test&quot;</span>
            <span class="p">)</span>
</pre></div>
</div>
<div class="section" id="automation-py-library-w-functions">
<h1>automation.py (library w/ functions)</h1>
<div class="highlight"><pre><span class="k">def</span> <span class="nf">thread_hosts</span><span class="p">(</span><span class="n">hosts</span><span class="p">,</span> <span class="n">get_commands</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="p">{},</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
    <span class="kn">import</span> <span class="nn">multiprocessing</span>

    <span class="n">kwargs</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">options</span><span class="p">)</span>

    <span class="n">jobs</span> <span class="o">=</span> <span class="p">[]</span>

    <span class="k">for</span> <span class="n">host</span> <span class="ow">in</span> <span class="n">hosts</span><span class="p">:</span>
        <span class="n">p</span> <span class="o">=</span> <span class="n">multiprocessing</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span>
                <span class="n">target</span><span class="o">=</span><span class="n">run_commands</span><span class="p">,</span>
                <span class="n">args</span><span class="o">=</span><span class="p">(</span>
                    <span class="n">host</span><span class="p">,</span>
                    <span class="n">get_commands</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">),</span>
                    <span class="p">),</span> <span class="p">)</span>

        <span class="n">jobs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
        <span class="n">p</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
</pre></div>
<p>So this example is a script that defines the function to return a command list, and provides an options var, and list of hosts. The thread hosts then loops over the hosts each time  passing the host and the get_commands function to another library function that connects to said host, and loops over the returned command list.</p>
<p>A part that might be confusing is that the parse_args function returns optparse's options variable but the options.__dict__ representation specifically. This then allows me to be able to update kwargs with any options that I allow to be set at the command line. The example in the script being the key_file variable.</p>
<p>The neat part of all this is being able to take the kwargs for one function and pass it right along to the next. This is key, because it allows for the library function in this case to be able to be entirely decoupled from the script itself.</p>
<p>With this implementation I am able to write a script that defines extra args to use, and only the script need know what they are. In the examples the library will just dumbly pass them along in the kwargs dict, I never have to tell it that I want to pass a user variable to it, and it makes the script a nice self contained unit.</p>
</div>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Trac makes my life easy</title>
      <link>http://morgangoose.com/blog/2009/07/trac-makes-my-life-easy/</link>
      <pubDate>Wed, 22 Jul 2009 17:15:23 PDT</pubDate>
      <category><![CDATA[Servers]]></category>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/?p=43</guid>
      <description>Trac makes my life easy</description>
      <content:encoded><![CDATA[<div class="document">
<p>The project management app <a class="reference external" href="http://trac.edgewall.org">Trac</a> is something that was new to me a while back. I'd just installed t for a side project, and used the yum install without any issues. It took care of all the grunt work, and got me to the point where I could now create and use a trac project.</p>
<p>Trac is set up like what I see web frameworks go with. A main program that will install the framework in a project directory. In this case trac-admin , which is killer when you want to make multiple projects, and offers a cli interface to the project s framework configuration, etc.</p>
<p>This setup becomes awesome I found when you want to upgrade. Yum installed what it had packaged, the .10 version, but I had decided that I wanted to toy with <a class="reference external" href="http://bitten.edgewall.org">bitten</a> their automated build tool, which required .11 and up. So an upgrade was needed, yum couldn t be used, but I found that trac-admin has an upgrade command.</p>
<p>So I was poised to make the fun and scary transition into mixing a package managed install with a source install, not something that always goes well. I ve found that sometimes packagers change to install location from where the src install goes (looking at you nagios), and make some conflicts or at least confusion.</p>
<p>The upgrade process for the server then my app was as simple as:</p>
<div class="highlight"><pre>wget http://ftp.edgewall.com/pub/trac/Trac-0.11.5.tar.gz
tar zxvf http://ftp.edgewall.com/pub/trac/Trac-0.11.5.tar.gz
<span class="nb">cd </span>Trac-0.11.5
python setup.py install
trac-admin /path/to/project upgrade
trac-admin /path/to/project wiki upgrade
/etc/init.d/httpd restart
</pre></div>
<p>This blew me away. I ve have never had a complicated app (relativily of course) upgrade so simply, and without any issues. The main install of trac from empty folder to working project manager was simple too, so perhaps I should have expected this, but really I think it is a testimony to how well the developers of Trac have though of the whole process of using their framework.</p>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Fedora 10 on the eeePC 900</title>
      <link>http://morgangoose.com/blog/2009/05/fedora-10-on-the-eeepc-900/</link>
      <pubDate>Mon, 04 May 2009 19:22:09 PDT</pubDate>
      <category><![CDATA[Linux]]></category>
      <guid>http://morgangoose.com/blog/?p=5</guid>
      <description>Fedora 10 on the eeePC 900</description>
      <content:encoded><![CDATA[<div class="document">
<p>Recently got the woot.com deal on the eeepc 900, sans webcam. I tried to use the xanadros os that was bundled with it for a few days, but the lack of normal gnu tools and normal packages made me want to switch. So I decided to to look into putting my os of choice fedora onto it.</p>
<p><strong>Installing:</strong></p>
<p>Found that is was a <a class="reference external" href="http://fedoraproject.org/wiki/EeePc#Eee_PC_90x.2F1000_Series">dooable</a> <a class="reference external" href="http://idolinux.blogspot.com/2009/02/fedora-10-on-eee-pc-1000.html">project</a>, exciting and surprising.  Since the netbook doesn't have a dvd-rom drive, and I lent out my external, I decided to go the usb live stick route.</p>
<p><a class="reference external" href="http://fedoraproject.org/wiki/FedoraLiveCD/USBHowTo">Directions</a> for this were easy to find, I did have to use the command line version of them, and found through trial and error that only my name brand Kingston drive would get the netbook to boot.</p>
<p>To get the usb drive to boot, hit escape while booting or hit f2 and set the main drive to be the usb drive.  After it boots and finishes and installs, everything pretty much works.</p>
<p>When I brought up the machine I started to follow <a class="reference external" href="http://idolinux.blogspot.com/2009/02/fedora-10-on-eee-pc-1000.html">Gavin's_directions</a> and run a general update. This failed, only because it filled the small hard drive up. I then had to find the /var/cache/yum/updates/packages/ directory and clear it by hand, because yum didn't have the room to run and remove the rpms itself.</p>
<p><strong>Removing things to make space:</strong></p>
<p>So now I had to sleuth around to find out what was taking up all the space on the drive. Using</p>
<div class="highlight"><pre>du -Hs -si /*
</pre></div>
<p>found that the largest folder in the root dir was usr. And walking down that path structure I found that the three largest folders, that I could do something about, were:</p>
<blockquote>
<ul class="simple">
<li>/usr/share/locale &#64;332MB</li>
<li>/usr/share/doc &#64;106MB</li>
<li>/usr/share/fonts &#64;223MB</li>
</ul>
</blockquote>
<p>So I really went through and removed a whole lot of this stuff, which depending on ones needs, may not be advisable.</p>
<p>I removed all fonts that could using yum instead of just deleting them, as that just really seemed like a bad idea. It took a bit of grep'ing, so this line is a little long, but it basically strips out all the extra fonts, and keeps liberation as well as core font tools and libs. I personally use Anonymous, for all my coding, and terminal work, and I put that in .fonts dir, so really even this is a bit liberal for me.</p>
<div class="highlight"><pre>rpm -qa | grep font <span class="se">\</span>
| grep -ve<span class="s1">&#39;xorg&#39;</span> -ve<span class="s1">&#39;core&#39;</span> -ve<span class="s1">&#39;liberation&#39;</span> -ve<span class="s1">&#39;fontconfig&#39;</span> -ve<span class="s1">&#39;lib&#39;</span> -ve<span class="s1">&#39;bitmapfonts&#39;</span> -ve<span class="s1">&#39;ghostscript&#39;</span> <span class="se">\</span>
| xargs yum -y erase
</pre></div>
<p>Note also that this removes these apps:</p>
<blockquote>
<ul class="simple">
<li>gimp</li>
<li>abiword</li>
<li>evince</li>
<li>ghostscript (even though I tried not to)</li>
</ul>
</blockquote>
<p>This frees up most of the 200MB that the fonts dir takes up, so we're off to a good start.</p>
<p>The locale directory I was unfamiliar with, but some searching found that this is where data for other language support is stored. I only speak one, and found that removing these doesn't cause irreparable harm. So delete them I did.  Since these are installed with every program, and the language packs don't have their own RPMs yum wasn't useful in this case.</p>
<div class="highlight"><pre>ls /usr/share/locale/* -d <span class="se">\</span>
| grep -ve<span class="s1">&#39;locale.alias&#39;</span> -ve<span class="s1">&#39;default&#39;</span> -ve<span class="s1">&#39;en&#39;</span> <span class="se">\</span>
| xargs rm -rf
</pre></div>
<p>This frees up about another 300MB. But it is also something that will crop up again, since any new program you install will add it own locale information. For apt-get there is a nice plug-in that will automatically strip out this information for you on install, but in my shallow searching for this for yum there didn't seem to be a substitute. Might be a good weekend project.</p>
<p>The share doc directory I just cd'ed into and wiped out its contents. This is a netbook, and I can ssh into my home machine to read those if I need to, so I freed up another 100 or so MB with this wipe.</p>
<p>This brings us a lot closer to a good 1 GB of free space. I went further and removed a few apps I won't be using:</p>
<blockquote>
<ul class="simple">
<li>evolution</li>
<li>rhythmbox</li>
<li>cheese</li>
</ul>
</blockquote>
<p><strong>Now to try and get the services under control.</strong></p>
<p>Found this great <a class="reference external" href="http://www.mjmwired.net/resources/mjm-services-f10.html">listing</a> of what each service does, so if you're unsure if you want to stop as many as I chose to, look it up and make sure. I also chose to use the command line service conf tool:</p>
<div class="highlight"><pre>/sbin/chkconfig  --list
</pre></div>
<p>So its a bit time consuming but I went through the chkconfig list and grepped out the 5:on states and checked them against my list below and set them to off one at a time for every run time level.  There might be a quicker way, but I couldn't think of one that didn't involve making a script, so I let it be, and stuck with manual.</p>
<blockquote>
<ul class="simple">
<li>cron, atd, anacron</li>
<li>auditd (also disabled SELinux)</li>
<li>avahi-daemon</li>
<li>bluetooth</li>
<li>btseed, bttrack</li>
<li>capi</li>
<li>cups[*]</li>
<li>firstboot</li>
<li>ip6tables</li>
<li>irda</li>
<li>irqbalance</li>
<li>isdn</li>
<li>kerneloops</li>
<li>lm_sensors</li>
<li>mdmonitor</li>
<li>multipathd</li>
<li>netconsole</li>
<li>netfs</li>
<li>nfs</li>
<li>nfslock</li>
<li>nmbd</li>
<li>nscd</li>
<li>pcscd</li>
<li>portreserve</li>
<li>restorecond</li>
<li>rpcbind</li>
<li>rpcgssd*</li>
<li>sendmail</li>
<li>smb</li>
<li>ypbind</li>
</ul>
</blockquote>
<p>Now not all of those services were up, but I just made the list of what I would remove, and didn't take note of what was not running in that list.</p>
<p>Then I installed my must haves: xfce, vim, htop, all the dvcs', tilda, and tomboy. I rsync'ed over my dot dirs that I wanted, and I was good.</p>
</div>
]]></content:encoded>
    </item>
  </channel>
</rss>
