<?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>Morgajel.net &#187; Utility</title>
	<atom:link href="http://morgajel.net/category/open-source/utility/feed" rel="self" type="application/rss+xml" />
	<link>http://morgajel.net</link>
	<description>Stemming the flow of evincible Ignorance. We must try to understand for the sake of understanding.</description>
	<lastBuildDate>Fri, 12 Mar 2010 20:46:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Introduction to Subversion</title>
		<link>http://morgajel.net/2007/11/20/223</link>
		<comments>http://morgajel.net/2007/11/20/223#comments</comments>
		<pubDate>Tue, 20 Nov 2007 21:03:25 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hobbies]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">http://morgajel.net/2007/11/20/223/</guid>
		<description><![CDATA[I was planning on simply republishing my previous svn article, but realized that it sucked compared to what I know now.
Prerequisites
I&#8217;ll presume you have the following things.
- a Linux machine
- subversion already installed
 Terminology to Know 
There are a few terms that get mangled if you&#8217;re coming from other types of source control. This is [...]]]></description>
			<content:encoded><![CDATA[<p>I was planning on simply republishing my previous svn article, but realized that it sucked compared to what I know now.</p>
<h3>Prerequisites</h3>
<p>I&#8217;ll presume you have the following things.<br />
- a Linux machine<br />
- subversion already installed</p>
<h3> Terminology to Know </h3>
<p>There are a few terms that get mangled if you&#8217;re coming from other types of source control. This is just to clear things up.<br />
- <b>Repository:</b> the central storage place on the subversion server where your data is kept.<br />
- <b>Checked-out copy:</b> Unlike VSS, saying something is checked out does not imply that the file is locked. Also referred to as a local copy; but bear in mind that it doesn&#8217;t contain *all* of the data of the actual Repository.<br />
- <b>commit:</b> save the changes you made locally to the repository.</p>
<h3> Mental Hurdles </h3>
<p>All of the files stored in a subversion repository are stored in a meta-filesystem. Much like an ISO image sitting on your desktop is not simply a folder full of files, a subversion repository is not directly accessible  when you open it. Instead, you&#8217;ll see the guts of the repository- DB files, hooks, locks, etc. Don&#8217;t go digging through there to manually change your files- it&#8217;ll break things.</p>
<p>Another important one is the meta-filesystem. The &#8220;inside&#8221; of your repository is just a big filesystem. Much like /bin and /home exist on a linux machine by convention, there are certain base-level directories you should create for convention&#8217;s sake. The first thing you should do with a new repository is create three new base level directories: /tags, /trunk and /branches. Your main development will take place in /trunk. Don&#8217;t worry about the other two at the moment.</p>
<p>When I refer to the root of the repository, I&#8217;ll often refer to it as / or root. This *IS NOT* your server&#8217;s root directory or the physical location of the repository- it&#8217;s the part of the meta-filesystem where /trunk, /tags and /branches reside.</p>
<h3> Step 1: Creating the Repository</h3>
<p>Creating a repository is fairly simple. Anyone can create a repository where ever they have write access. All they must do is run<br />
<code><br />
  $ svnadmin create ~/project1/<br />
</code></p>
<p>This should create an empty repository. This will demonstrate what I&#8217;m talking about when I say that your repository is a meta-filesystem:<br />
<code><br />
  morgajel@unicron ~ $ svn ls file:////home/morgajel/project1<br />
  morgajel@unicron ~ $ ls /home/morgajel/project1<br />
  conf  dav  db  format  hooks  locks  README.txt<br />
  morgajel@unicron ~ $ svn mkdir file:////home/morgajel/project1/trunk -m 'creating trunk'</p>
<p>  Committed revision 1.<br />
  morgajel@unicron ~ $ svn ls file:////home/morgajel/project1<br />
  trunk/<br />
  morgajel@unicron ~ $ ls /home/morgajel/project1<br />
  conf  dav  db  format  hooks  locks  README.txt<br />
</code></p>
<p>Here you can see the repository was empty, then we created a directory called trunk (using a commit message to describe the change we made), then showing that the directory was in fact created. Do the same thing for /tags and /branches.</p>
<p>We now have a working repository!</p>
<h3>Checking out the Repository</h3>
<p>Creating a repository is fine, but using it would be much more&#8230; useful. Next you should check out a copy of your project. Under normal conditions you&#8217;ll only be checking out the /trunk, but you mileage may vary in different situations. Since this is on our local machine, we can use the file:// protocol. Other protocols exist, like http:// (webdav), svn:// (svnserve), and svn+ssh:// (svn over ssh), but you don&#8217;t have to worry about them right now.</p>
<p><code><br />
  morgajel@unicron ~ $ svn co file:////home/morgajel/project1/trunk my_project1<br />
  Checked out revision 3.<br />
</code></p>
<p>This should check out the empty /trunk directory to a local folder called my_project1. The only thing in this directory is a hidden .svn directory which holds the guts of your local copy repository info. It&#8217;s similar in function to the CVS directory in CVS. Unfortunately a nearly-empty directory isn&#8217;t much use, so let&#8217;s add some content.</p>
<h3>Adding Content</h3>
<p>So let&#8217;s add some content.<br />
<code><br />
morgajel@unicron ~ $ cd my_project1/<br />
morgajel@unicron ~/my_project1 $ mkdir -p lib bin share/docs<br />
morgajel@unicron ~/my_project1 $ touch configure Makefile share/docs/README lib/foo.pm bin/widget.pl<br />
morgajel@unicron ~/my_project1 $ svn status<br />
?      configure<br />
?      share<br />
?      lib<br />
?      bin<br />
?      Makefile<br />
</code></p>
<p>Here I created a bunch of directories and created some empty files. When I ran svn status, svn told me that there were 5 things it wasn&#8217;t versioning. Let&#8217;s add them.<br />
<code><br />
morgajel@unicron ~/my_project1 $ svn add configure share lib bin Makefile<br />
A         configure<br />
A         share<br />
A         share/docs<br />
A         share/docs/README<br />
A         lib<br />
A         lib/foo.pm<br />
A         bin<br />
A         bin/widget.pl<br />
A         Makefile<br />
morgajel@unicron ~/my_project1 $ svn status<br />
A      configure<br />
A      share<br />
A      share/docs<br />
A      share/docs/README<br />
A      lib<br />
A      lib/foo.pm<br />
A      bin<br />
A      bin/widget.pl<br />
A      Makefile<br />
</code><br />
As you can see, it recursed down into share, bin and lib and added all the goodies inside of each directory. You can also see svn status shows these as well. Keep in mind they&#8217;re just slated to be added to the repository- they&#8217;re not added yet. Let&#8217;s go ahead and commit them.</p>
<p><code><br />
morgajel@unicron ~/my_project1 $ svn commit -m "a bunch of empty files and directories"<br />
Adding         Makefile<br />
Adding         bin<br />
Adding         bin/widget.pl<br />
Adding         configure<br />
Adding         lib<br />
Adding         lib/foo.pm<br />
Adding         share<br />
Adding         share/docs<br />
Adding         share/docs/README<br />
Transmitting file data .....<br />
Committed revision 4.<br />
</code></p>
<h3>Modifying Data</h3>
<p>So suppose you&#8217;d like to modify these files, you you decide to move the README to the root of your local copy (~/my_project1/):</p>
<p><code><br />
morgajel@unicron ~/my_project1 $ svn mv share/docs/README README<br />
A         README<br />
D         share/docs/README<br />
morgajel@unicron ~/my_project1 $ svn stat<br />
D      share/docs/README<br />
M      bin/widget.pl<br />
A  +   README<br />
</code></p>
<p>Notice that I used svn mv to move files rather than regular old mv- That&#8217;s to make sure svn is aware of the move and keeps the file history associated with the new file. You can also see bin/widget.pl now include some new info as well, and displays an M[odified] next to it. The + next to README shows that it copied the history over from it&#8217;s previous position. So what happens if we move a file without svn mv?<br />
<code><br />
morgajel@unicron ~/my_project1 $ mv configure config<br />
morgajel@unicron ~/my_project1 $ svn status<br />
?      config<br />
!      configure<br />
D      share/docs/README<br />
M      bin/widget.pl<br />
A  +   README<br />
morgajel@unicron ~/my_project1 $ mv config configure<br />
</code><br />
You can see that svn panics(!) that configure has gone missing, and sees this new file called config that it&#8217;s currently not revisioning. It doesn&#8217;t know that they&#8217;re the same file.</p>
<h3> Commit Messages</h3>
<p>You&#8217;ve seen me use the -m flag a couple of times now- I&#8217;m using it to keep things flowing. If you don&#8217;t use it, you&#8217;re prompted in your favorite $EDITOR to create a commit statement, which includes the list of modified files. Using the -m flag is useful if you&#8217;re scripting commits (I use this when dumping and committing a nightly config file from our load-balancer).</p>
<p>Most of the time however, you&#8217;ll use your Editor. Make sure to keep your commit messages sweet and to the point- other&#8217;s will see them.</p>
<p><code><br />
morgajel@unicron ~/my_project1 $ svn commit<br />
[vim shows up, I enter the following text]<br />
Small changes to demonstrate movements<br />
- moved the README<br />
- added shebang to widget.pl<br />
[save and exit vim]<br />
"svn-commit.tmp" 8L, 190C written<br />
Adding         README<br />
Sending        bin/widget.pl<br />
Deleting       share/docs/README<br />
Transmitting file data .<br />
Committed revision 5.<br />
morgajel@unicron ~/my_project1 $ svn update<br />
At revision 5.<br />
morgajel@unicron ~/my_project1 $ svn log<br />
------------------------------------------------------------------------<br />
r5 | morgajel | 2007-11-20 15:55:21 -0500 (Tue, 20 Nov 2007) | 4 lines</p>
<p>Small changes to demonstrate movements<br />
- moved the README<br />
- added shebang to widget.pl</p>
<p>------------------------------------------------------------------------<br />
r4 | morgajel | 2007-11-20 14:17:04 -0500 (Tue, 20 Nov 2007) | 1 line</p>
<p>a bunch of empty files and directories<br />
------------------------------------------------------------------------<br />
r1 | morgajel | 2007-11-20 13:35:28 -0500 (Tue, 20 Nov 2007) | 1 line</p>
<p>creating trunk<br />
------------------------------------------------------------------------<br />
</code></p>
<p>You&#8217;ll notice that revisions 2 and 3 aren&#8217;t listed- if you&#8217;ll remember correctly, they were used to commit the /tags and /branches directories. svn log only reports changes that affect the current target (in this case, ~/my_project1 which is a local copy of /trunk).</p>
<p>There&#8217;s a couple more tips and tricks I could go on about- if there&#8217;s any interest in this post maybe I&#8217;ll write some more about more advanced topics.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2007/11/20/223/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to Vim Tip #5 (Recording)</title>
		<link>http://morgajel.net/2007/10/07/220</link>
		<comments>http://morgajel.net/2007/10/07/220#comments</comments>
		<pubDate>Sun, 07 Oct 2007 06:47:37 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://morgajel.net/2007/10/07/220/</guid>
		<description><![CDATA[Search and replace is a great feature in most text editors, but what happens when you want to do more? Vim has a solution- recording macros. Suppose you have the following output from some ancient program that needs to be tweaked:

X1222 22323 2A22 3303 0000 3334esss test 123
X2222 22353 2A22 3303 0001 3334esss tacd 456
X3222 [...]]]></description>
			<content:encoded><![CDATA[<p>Search and replace is a great feature in most text editors, but what happens when you want to do more? Vim has a solution- recording macros. Suppose you have the following output from some ancient program that needs to be tweaked:</p>
<p><code><br />
X1222 22323 2A22 3303 0000 3334esss test 123<br />
X2222 22353 2A22 3303 0001 3334esss tacd 456<br />
X3222 22383 2A22 3303 0010 3334esss fals 789<br />
X4222 22393 2A22 3303 0011 3334esss true 012<br />
</code></p>
<p>It is doesn&#8217;t really matter what it is, this example is somewhat contrived. Suppose you needed to make the following changes for each line that starts with X:<br />
* change the ID from X_222 to Y_223<br />
* reverse the 4th and 5th fields<br />
* copy the second character from the beginning and insert it before the last character of the line</p>
<p>If it were only 4 lines, you could handle this yourself, but it would be very tedious. Suppose rather than 4 lines, you had 400- it&#8217;d be much easier to automate it. The best way to take care of it would be with a macro:<br />
<code><br />
[esc]qa<br />
/^X[enter] i[delete]Y[right][right][right][delete]3<br />
[esc]wwwdww[left]p<br />
0[right]d[ctrl+v]y$[shift+p]<br />
q<br />
</code><br />
That right there is a MESS, but gets the job done- it&#8217;s not something you want to repeat for fear of a typo. Notice that the first characters you typed were qa: &#8216;q&#8217; starts recording, and &#8216;a&#8217; is the slot we&#8217;re using to store the macro. From here we record how *we* would make the changes, making sure to keep our keystrokes to a minimum. When we&#8217;re done, we stop the macro by pressing &#8216;q&#8217; again.</p>
<p>To run our macro on the next line, press &#8216;@a&#8217; to run the newly created &#8216;a&#8217; macro- it should find the next line that starts with an X (notice the /^X in our first command) and run those commands to massage our text.</p>
<p>Remember how we were talking about 400 lines like this? Even at 2 characters each, that&#8217;s 800 characters to type which is still annoying. Here&#8217;s where the magic comes in- you can record macros of macros:<br />
<code><br />
qb<br />
@a@a@a@a@a@a@a@a@a@a<br />
q<br />
</code><br />
Now each time you run @b, you&#8217;ll run the a macro 10 times. A more efficient way to handle this would be to use<br />
<code><br />
@a<br />
398@@<br />
</code><br />
the first one was done manually to record the macro, the second to play the macro, and the third to say run it 398 more times. </p>
<p>And there you go- a quick tour of recording macros. I&#8217;m sure there&#8217;s much more than what I&#8217;ve shown, but that&#8217;s enough to keep you busy.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2007/10/07/220/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Giving Back</title>
		<link>http://morgajel.net/2007/06/08/205</link>
		<comments>http://morgajel.net/2007/06/08/205#comments</comments>
		<pubDate>Fri, 08 Jun 2007 19:40:17 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hobbies]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">http://morgajel.net/2007/06/08/205/</guid>
		<description><![CDATA[I&#8217;ve been using and promoting open source for about 7 years now- it started back in 2000 when I began writing php and playing with apache. In 2003 I made the full switch to Linux.  Since then I&#8217;ve produced several small little projects and put them under the GPL in hopes that it would [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using and promoting open source for about 7 years now- it started back in 2000 when I began writing php and playing with apache. In 2003 I made the full switch to Linux.  Since then I&#8217;ve produced several small little projects and put them under the GPL in hopes that it would help someone else. I&#8217;ve also written many articles and how-tos for my site to help spread what I&#8217;ve learned.</p>
<p>This past week has been a major milestone for me as I&#8217;ve <a href="http://sourceforge.net/forum/forum.php?forum_id=703487">joined the Luma team</a>.   For those of you not familiar, Luma is an LDAP browser and administration tool written in Python and QT.  My capacity is limited at the moment, since I don&#8217;t really know python and am only remotely familiar with QT development- I have, however, been using luma for 2 years now for various ldap based projects.</p>
<p>I&#8217;ve already cleaned up and helped organize the bugtracker, and am currently working on an LDIF Importer plugin to feel my way around Luma&#8217;s API and python in general. I finally feel like I am giving back to the community.</p>
<p>If you have access to an LDAP server (be it AD, OpenLDAP, Domino, Novell&#8217;s, etc), give Luma a try and give us some feedback. We&#8217;re looking for beta-testers and python developers- Heck, if you wanted to just comment the code, that&#8217;d be great as well. Feel free to stop by #luma on freenode- we&#8217;re always minimally paying attention and can probably answer any questions you may have.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2007/06/08/205/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Utility: diff</title>
		<link>http://morgajel.net/2007/03/29/85</link>
		<comments>http://morgajel.net/2007/03/29/85#comments</comments>
		<pubDate>Thu, 29 Mar 2007 14:55:16 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">http://morgajel.net/2006/02/21/85/</guid>
		<description><![CDATA[Diff is a handy little command used to compare two text files- useful if trying to determine what&#8217;s changed in different versions of files, used by subversion to show what files have been changed, and can even create patch files for updating sourcecode. So what are some of the more useful flags?
*  -i lets [...]]]></description>
			<content:encoded><![CDATA[<p>Diff is a handy little command used to compare two text files- useful if trying to determine what&#8217;s changed in different versions of files, used by subversion to show what files have been changed, and can even create patch files for updating sourcecode. So what are some of the more useful flags?</p>
<p>*  -i lets us ignore any capitalization changes<br />
*  -b lets us ignore any spacing changes<br />
*  -B ignore blank lines<br />
*  -w just ignore all white spaces<br />
*  -q just say if the files are different<br />
*  -y side by side comparison<br />
*  -r recursively compare directories<br />
*  -d find a smaller set of changes<br />
*  -u unified format</p>
<p>I often use the unified format(-u) simply because I find the +/- more intuitive than >/< .  The whitespace and capitalization ignoring is great if you change the indentation of a file or fix a comment's capitalization, but don't want to make a big deal of it. Another great use is comparing directories- for example, before upgrading apache,  make a backup copy of /etc/apache, run the upgrade, then run diff -rq /etc/apache.bak /etc/apache to see a list of files that were modified. Once you get that list, you can use diff to compare the two versions on a more granular level. Not a great example, but I have been in situations were I needed to compare two directories to see what had changed.</p>
<p>So what are some of the more unique uses? You can use the -s flag to confirm two files are the same or exclude files from a recursive compare with -x pattern. You can also use stdin for one of the comparisons with cat foo|grep badstuff | diff - bar or cat foo|grep badstuff | diff bar -. You can even create a patch file with diff -Naur file.old file.new >file.patch.</p>
<p>If you have any other uses for diff, leave them in the comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2007/03/29/85/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Utility: route</title>
		<link>http://morgajel.net/2007/03/24/112</link>
		<comments>http://morgajel.net/2007/03/24/112#comments</comments>
		<pubDate>Sat, 24 Mar 2007 07:25:37 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">http://morgajel.net/2007/03/24/112/</guid>
		<description><![CDATA[Route is one of these hate-inspiring, jaw droppingly obtuse programs that you always get the syntax wrong on.  The purpose is simple enough-  show and/or change the routing table. The most common uses are:

route &#8211; shows the current entries
route add  &#8211; adds a new entry
route del &#8211; removes an entry
route flush- removes [...]]]></description>
			<content:encoded><![CDATA[<p>Route is one of these hate-inspiring, jaw droppingly obtuse programs that you always get the syntax wrong on.  The purpose is simple enough-  show and/or change the routing table. The most common uses are:</p>
<ol>
<li><b>route</b> &#8211; shows the current entries</li>
<li><b>route add</b>  &#8211; adds a new entry</li>
<li><b>route del</b> &#8211; removes an entry</li>
<li><b>route flush</b>- removes all entries</li>
</ol>
<p><b>Checking out your Routes</b><br />
The simplest use of route is to simply run route at the command line:</p>
<pre>
morgajel@p-nut ~ $ /sbin/route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
</pre>
<p>You&#8217;ll see 3 routes total in this example (which is very simple)- The first route points all 192.168.0.x traffic to the network card(eth0), the second points all loopback traffic (127.x.x.x) back to the local device (lo), and anything that doesn&#8217;t fit into either of those categories goes to the network card (eth0).  You may wonder why that first route is in there if the default would just catch it anyways- you see, this allows multiple network cards to point traffic to different gateways or routers on the same network.<br />
Take the next example:</p>
<pre>
morgajel@p-nut ~ $ /sbin/route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.100.0.0     10.100.0.1              255.255.0.0   U     0      0        0 eth1
192.168.7.0     192.168.7.1               255.255.0.0   U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
</pre>
<p>all of your normal traffic would proceed to 192.168.0.1, but any traffic to 192.168.7.x would go to a different gateway(192.168.7.1) and all traffic to 10.100.x.x would go to a secondary network card(eth1) and be sent to yet another gateway (10.100.0.0). This would be useful if you were using a load balancing device like a Netscalar or F5, or if you had an internal network and a secondary DMZ&#8217;d network or something.</p>
<p><b> Adding and Removing Routes</b><br />
if you&#8217;re manually setting up routes for a static IP, you&#8217;ll generally do something like</p>
<pre>
route add default gw 192.168.0.1
</pre>
<p>or remove it with </p>
<pre>
route del default
route del -net 192.168.0.0 netmask 255.255.0.0 eth1
</pre>
<p>Deleting routes is always the pain- the default route you can simply remove like the first example, but anything else needs the netmask specified and the -net flag used. If you want to see some more examples of routes, try</p>
<pre>
route -C
</pre>
<p>This will show you&#8230; uh, I guess the dynamic routes that have been recently used and cached. If you&#8217;re unsure about how to remove or add a route, you can run &#8220;route add&#8221; or &#8220;route del&#8221; without any addition parameters to see more options- I think the most I&#8217;ve used is something like</p>
<pre>
route add -net 10.100.32.0 netmask 255.255.248.0 gw 10.100.32.1 eth0
</pre>
<p><b>Final Thoughts</b><br />
One thing that I learned while writing this is that there is an additional parameter called &#8220;reject&#8221; which you can append to the end of an add line to basically form a crude firewall to that route ( note- it&#8217;s not really a firewall, but it will reject packets). And of course, to get rid of any line you&#8217;ve added, you can change an add to a del and it&#8217;ll probably remove it (you may need to remove some add-specific parameters like reinstate or mss).</p>
<p>The manpage is pretty straightforward and has some decent examples- Looking at it, I&#8217;m not sure why I&#8217;ve had such problems with route in the past. Overall it seems pretty simple as long as you get the del syntax correct. Overall I think writing this helped me more than it&#8217;ll probably help you.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2007/03/24/112/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ldapifying an ubuntu server</title>
		<link>http://morgajel.net/2007/03/19/184</link>
		<comments>http://morgajel.net/2007/03/19/184#comments</comments>
		<pubDate>Mon, 19 Mar 2007 19:01:50 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Entertainment]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://morgajel.net/2007/03/19/184/</guid>
		<description><![CDATA[I recently wrote a nice little script in ruby for ldapifying new ubuntu servers- all the server needs is a ssh key set up for root, the rest is cake&#8230;

jmorg@util3:~/base_configs# ./ldapify -h
Usage: ldapify --install hostname [$options]
       ldapify --check hostname
       ldapify --uninstall hostname
  [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wrote a nice little script in ruby for ldapifying new ubuntu servers- all the server needs is a ssh key set up for root, the rest is cake&#8230;</p>
<pre>
jmorg@util3:~/base_configs# ./ldapify -h
Usage: ldapify --install hostname [$options]
       ldapify --check hostname
       ldapify --uninstall hostname
        --install hostname           hostname to ldapify(foo.pub.local)
        --uninstall hostname         removes ldapification from hostname
    -a, --access_group access_group  access_group that has access to hostname
        --no_group_dn                No access_group limitations- use with caution.
    -c, --clusters x,y,z             clusters in which hostname belongs
        --aliases x,y,z              other aliased hostnames for the host
        --ignore-home                don't mount/unmount home
    -v, --verbose                    enable verbosity
    -q, --quiet                      silence all unneeded messages
    -h, --help                       Show this message

jmorg@util3:~/base_configs# ./ldapify --install log1.pub.local -a devboxes
backing up sources.list...
updating sources.list...
updating package list...
adding nfs entry to /etc/fstab...
Complete.
Mounting home, please wait...
complete.
installing debconf-utils...
patching debconf selections...
installing libnss-ldap ...
symlinking ldap.conf...
copy ssl cert and ldap.conf...
complete.
No Access group was given, using admin_only by default.
backup nsswitch.conf and pam.d files...
complete.
install nsswitch.conf and pam.d files...
complete.
ldap requires the manager password:
please verify the manager password:
store manpass...
installing sudo-ldap...

jmorg@util3:~/base_configs# ./ldapify --uninstall log1.pub.local
restore nsswitch.conf and pam.d files...
complete.
remove ssl cert and ldap.conf...
complete.
removing nfs entry...
complete.
unmounting home...
complete.
removing debconf-utils, libnss-ldap and libpam-ldap ...
removing ldap.conf symlinks...
removing sudo-ldap, restoring sudo...
retore sources.list...
updating package list...
ldap requires the manager password:
please verify the manager password:
jmorg@util3:~/base_configs#
</pre>
<p>So what all does it do?</p>
<ul>
<li>Sets up ldap authentication of user accounts</li>
<li>mounts the nfs-based home directory</li>
<li>Sets up ldap-based sudo rules</li>
<li>Creates a host entry in the ldap server</li>
<li>Adds an entry in the ldap server for the distro&#8217;s cluster and ldapified hosts cluster</li>
<li>Can completely revert back to the original state</li>
</ul>
<p>This script takes about 2:45 to run (mostly due to the 120 seconds of waiting for the /home dir to mount), and saves roughly half an hours worth of work. It&#8217;s not very stable (pre-ldapified boxes cause it to freak out when trying to re-install/remove) , but it will be a lot of help as we move towards ubuntu as our standard distro.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2007/03/19/184/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Useful Utility: tee</title>
		<link>http://morgajel.net/2006/11/21/55</link>
		<comments>http://morgajel.net/2006/11/21/55#comments</comments>
		<pubDate>Tue, 21 Nov 2006 15:30:42 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Utility]]></category>

		<guid isPermaLink="false">http://morgajel.net/2006/11/11/55/</guid>
		<description><![CDATA[I have two requirements for a program being on this list: the first one is it has to be a utility- something scriptable or usable on the command line.  The second is it also needs to have multiple arcane flags that I can write about, or just be so unknown that it&#8217;ll bring it [...]]]></description>
			<content:encoded><![CDATA[<p>I have two requirements for a program being on this list: the first one is it has to be a utility- something scriptable or usable on the command line.  The second is it also needs to have multiple arcane flags that I can write about, or just be so unknown that it&#8217;ll bring it to the attention of people that have never heard of it.  Tee falls into the &#8220;never heard of it&#8221; group. It may only have two flags, but it&#8217;s useful nonetheless.</p>
<p>Tee splits a STDIN stream in two, sending one stream out output to a file, and the other to STDOUT. The data is identical; this just allows you to take a snapshot of what the data is like at a certain point a long piped command. For example, lets suppose you had a nice pretty command like this:</p>
<pre>
ls -lrt |awk '{print $6" "$7" "$8" "$3"  "$9}'|grep morgajel|tail -n 3
</pre>
<p>This provides you with the date, owner and filename of the 3 newest files in the current directory.  Suppose you wanted a list for all the users as well as just morgajel&#8217;s latest three</p>
<pre>
ls -lrt |awk '{print $6" "$7" "$8" "$3"  "$9}'|tee all.txt|grep morgajel|tail -n 3
</pre>
<p>By adding the &#8220;tee all.txt&#8221; a copy of the stream at that point is diverted into a text file. you can view that later. The example is a bit fake, but you&#8217;ll eventually run into something needing this functionality. When you do, you can use tee. The only two real flags of interest are -a which appends data to the file rather than recreating it, and -i to ignore interrupts, but that could be really bad if you need to ctrl-c out of something&#8230;</p>
<p>either way, enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2006/11/21/55/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Intro to Vim Tip #4 (Pasting)</title>
		<link>http://morgajel.net/2006/07/14/145</link>
		<comments>http://morgajel.net/2006/07/14/145#comments</comments>
		<pubDate>Fri, 14 Jul 2006 12:56:42 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://morgajel.net/2006/07/14/145/</guid>
		<description><![CDATA[If you need to paste into vim from somewhere else, and your code has tabs or spaces in it, you&#8217;ll notice that vim may add extra tabs.  see, vim doesn&#8217;t see it as a paste event, it sees it as &#8220;you typing really fast&#8221;- and one thing vim does will is auto-indent.  The [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to paste into vim from somewhere else, and your code has tabs or spaces in it, you&#8217;ll notice that vim may add extra tabs.  see, vim doesn&#8217;t see it as a paste event, it sees it as &#8220;you typing really fast&#8221;- and one thing vim does will is auto-indent.  The problem is when you paste, you don&#8217;t want auto-indentation because your code is already indented.</p>
<p>to temporarily turn off auto-indenting, try this from insert mode:</p>
<pre>[esc]:set paste[enter]</pre>
<p>go back to insert mode and you should be able to paste without the extra tabs.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2006/07/14/145/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Intro to Vim Tip #3 (Visual Mode)</title>
		<link>http://morgajel.net/2006/07/10/141</link>
		<comments>http://morgajel.net/2006/07/10/141#comments</comments>
		<pubDate>Mon, 10 Jul 2006 14:38:19 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://morgajel.net/2006/07/10/141/</guid>
		<description><![CDATA[Another well used mode is Visual Mode, which turns your cursor into a hilighter.
open a textfile with several lines of text ad move the cursor to the middle
switch from command mode to visual mode:
v
You&#8217;ll notice as you move the cursor around, you highlight different sections from the point you started to the point you left. [...]]]></description>
			<content:encoded><![CDATA[<p>Another well used mode is Visual Mode, which turns your cursor into a hilighter.<br />
open a textfile with several lines of text ad move the cursor to the middle</p>
<p>switch from command mode to visual mode:</p>
<pre>v</pre>
<p>You&#8217;ll notice as you move the cursor around, you highlight different sections from the point you started to the point you left. you can press [esc] to return to command mode.</p>
<p>hilight a few lines of text from command mode:</p>
<pre>[shift]v[upkey]</pre>
<p>my adding the modifier [shift] when pressing V, you switch to &#8216;visual line mode&#8217;. This allows you to copy paragraphs easily.</p>
<p>hilight a block of text from command mode:</p>
<pre>[ctrl]v[upkey][upkey][rightkey]</pre>
<p>Now what good is visual mode? we&#8221; for deleting or replacing, of course!  This is great when you have the following block of text:</p>
<pre>
           [option min="1"  max="10"   ][/option]
            [option min="11" max="19"   multiplier="10000" ]cp[/option]
            [option min="20" max="38"   multiplier="1000"  ]sp[/option]
            [option min="39" max="95"   multiplier="100"   ]gp[/option]
            [option min="96" max="100"  multiplier="10"    ]pp[/option]
</pre>
<p>and you&#8217;ve decided you no longer need min and max.<br />
- move the cursor in command mode over the &#8216;m&#8217; in &#8216;min&#8217; on the first line<br />
- press [ctrl]v[downkey][downkey][downkey][downkey]<br />
- press the right arrowkey until the closing quote on &#8220;100&#8243; is covered<br />
- press &#8216;d&#8217;<br />
all your text will be gone. But suppose you didn&#8217;t want the text to be gone, you wanted to replace it with something else?<br />
- press &#8216;u&#8217; and the text will reappear<br />
- re-highlight it and press &#8216;c&#8217;  (text should disapepar)<br />
- type your replacement string (use=&#8221;false&#8221;) and press [esc]<br />
within a moment or two,  use=&#8221;false&#8221; should jump up across all five lines</p>
<p>Visual modes are also useful for narrowing the scope of a search and replace, but I&#8217;ll get to that when I cover search and replacing.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2006/07/10/141/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to Vim Tip #2 (deleting)</title>
		<link>http://morgajel.net/2006/07/10/140</link>
		<comments>http://morgajel.net/2006/07/10/140#comments</comments>
		<pubDate>Mon, 10 Jul 2006 14:14:24 +0000</pubDate>
		<dc:creator>morgajel</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://morgajel.net/2006/07/10/140/</guid>
		<description><![CDATA[Deleting in vim can be done several ways- in insert mode, the delete key and backspace key perform as you&#8217;d expect them to, but what if you want more?
delete the character to the left of the cursor:
[esc]d[left arrow]
delete the character to the right of the cursor:
[esc]d[right arrow]
deleting the current line from insert mode:
[esc]dd
deleting the current [...]]]></description>
			<content:encoded><![CDATA[<p>Deleting in vim can be done several ways- in insert mode, the delete key and backspace key perform as you&#8217;d expect them to, but what if you want more?</p>
<p>delete the character to the left of the cursor:</p>
<pre>[esc]d[left arrow]</pre>
<p>delete the character to the right of the cursor:</p>
<pre>[esc]d[right arrow]</pre>
<p>deleting the current line from insert mode:</p>
<pre>[esc]dd</pre>
<p>deleting the current line and the one below from insert mode:</p>
<pre>[esc]d[downkey]</pre>
<p>deleting the current line and the one above from insert mode:</p>
<pre>[esc]d[upkey]</pre>
<p>deleting current character and 4 to the right:</p>
<pre>d5[rightkey]</pre>
<p>deleting current line and 2 below:</p>
<pre>d2[downkey]</pre>
<p>You&#8217;ll notice from those last two examples that deleting characters to the left and right include the current character in the count, but deleting lines above and below do not.  Weird.</p>
]]></content:encoded>
			<wfw:commentRss>http://morgajel.net/2006/07/10/140/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
