<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Replaying High School in a Business Suit</title>
  <link>http://megaversal.livejournal.com/</link>
  <description>Replaying High School in a Business Suit - LiveJournal.com</description>
  <lastBuildDate>Fri, 20 Nov 2009 22:37:04 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>megaversal</lj:journal>
  <lj:journalid>4810731</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <atom10:link rel='hub' href='http://pubsubhubbub.appspot.com/' />
  <image>
    <url>http://l-userpic.livejournal.com/23569772/4810731</url>
    <title>Replaying High School in a Business Suit</title>
    <link>http://megaversal.livejournal.com/</link>
    <width>80</width>
    <height>73</height>
  </image>

<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/106127.html</guid>
  <pubDate>Fri, 20 Nov 2009 22:37:04 GMT</pubDate>
  <title>Nutrition Facts</title>
  <link>http://megaversal.livejournal.com/106127.html</link>
  <description>I recently bought some chocolates from a coworker&apos;s kid&apos;s school&apos;s sale.&lt;br /&gt;&lt;br /&gt;From the package:&lt;br /&gt;&lt;br /&gt;Nutrition Facts&lt;br /&gt;Serving Size 3 pieces (47 g)&lt;br /&gt;Servings Per Container 4&lt;br /&gt;&lt;br /&gt;I opened up the box and found 10 pieces.</description>
  <comments>http://megaversal.livejournal.com/106127.html</comments>
  <category>lausd education</category>
  <category>math</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/105978.html</guid>
  <pubDate>Fri, 20 Nov 2009 08:36:57 GMT</pubDate>
  <title>End of the World</title>
  <link>http://megaversal.livejournal.com/105978.html</link>
  <description>Holy shit, the last two days have been insane. At least things are calming down.</description>
  <comments>http://megaversal.livejournal.com/105978.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/105695.html</guid>
  <pubDate>Sun, 11 Oct 2009 21:30:36 GMT</pubDate>
  <title>New Lesson</title>
  <link>http://megaversal.livejournal.com/105695.html</link>
  <description>Auto-save is not turned on by default in Visio. =(</description>
  <comments>http://megaversal.livejournal.com/105695.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/105246.html</guid>
  <pubDate>Sat, 10 Oct 2009 05:14:12 GMT</pubDate>
  <title>Cloverfield</title>
  <link>http://megaversal.livejournal.com/105246.html</link>
  <description>Watching my first Netflix movie: Cloverfield.&lt;br /&gt;&lt;br /&gt;All I have to say is I’m midway-ish through and I do not want them to get out alive.</description>
  <comments>http://megaversal.livejournal.com/105246.html</comments>
  <category>netflix</category>
  <category>cloverfield</category>
  <category>shitty movies</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/105002.html</guid>
  <pubDate>Fri, 09 Oct 2009 07:43:35 GMT</pubDate>
  <title>Such a Drunkard</title>
  <link>http://megaversal.livejournal.com/105002.html</link>
  <description>I’ve become quite the drunk since Yuki left. With at least one glass a night and usually hard liquor, I think I’m starting to need it instead of want it. I think it’s time to take a few days off (after tonight, of course).&lt;br /&gt;&lt;br /&gt;+15 minutes later update: On the upside, it seems I am able to roll around on my bed and flip around while holding a glass of alcohol upright. Hey man, there&apos;s a beverage here!</description>
  <comments>http://megaversal.livejournal.com/105002.html</comments>
  <category>alcohol</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/104849.html</guid>
  <pubDate>Mon, 14 Sep 2009 06:59:28 GMT</pubDate>
  <title>Disgusting Americans</title>
  <link>http://megaversal.livejournal.com/104849.html</link>
  <description>I think I’ve spent too much time with Japanese people.&lt;br /&gt;&lt;br /&gt;I realized lately that I feel really uncomfortable when watching TV shows where people walk into houses wearing their shoes and don’t take them off. They even go into bedrooms still wearing their shoes. How is that not disgusting? You sleep there. You walk barefoot there. Your shoes get gum and shit and diseases and everything else on them and yet you put them in the same area where you sleep, eat, and get clean.&lt;br /&gt;&lt;br /&gt;Weirdos.</description>
  <comments>http://megaversal.livejournal.com/104849.html</comments>
  <category>文化</category>
  <category>culture</category>
  <category>japanese habits</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/104599.html</guid>
  <pubDate>Thu, 10 Sep 2009 01:34:19 GMT</pubDate>
  <title>From the Days of Free Printing</title>
  <link>http://megaversal.livejournal.com/104599.html</link>
  <description>Free printing for me at least, when I was in my first years of college.&lt;br /&gt;&lt;br /&gt;I’m cleaning out my storage unit to try to move everything into the apartment. Among the things I’m throwing out are old manuals and documentation I printed like:&lt;br /&gt;&lt;br /&gt;A Slackware install guide. No mention of version, but the print out date is “1/29/00 4:20 PM.”&lt;br /&gt;“Introduction to Unix” from Ohio State University (1998).&lt;br /&gt;Chapter 2 of O’Reilly’s “Internet Core Protocols: The Definitive Guide” printed “3/7/00 6:58 PM.”&lt;br /&gt;&lt;a href=&quot;http://www.isi.edu/in-notes/iana/assignments/ip-parameters&quot;&gt;http://www.isi.edu/in-notes/iana/assignments/ip-parameters&lt;/a&gt; (now points to &lt;a href=&quot;http://www.iana.org/assignments/ip-parameters&quot;&gt;http://www.iana.org/assignments/ip-parameters&lt;/a&gt;) printed “3/7/00 4:12 PM.”&lt;br /&gt;&lt;a href=&quot;http://www.isi.edu/in-notes/rfc1466.txt&quot;&gt;http://www.isi.edu/in-notes/rfc1466.txt&lt;/a&gt; “Guidelines for Management of IP Address Space” printed “3/7/00 4:13 PM.”&lt;br /&gt;Various chapters from something called “Internetworking Technology Overview, June 1999” that I think must have been from Cisco.&lt;br /&gt;Chapter 23 “Windows 98 in Windows NT Domains” from ”Windows 98 Professional Reference” featuring the awesome line “For bigger networks…say, larger than either or nine PCs…”&lt;br /&gt;&lt;br /&gt;Edit: I just found a folder full of RFCs that I printed (and read!). Weirdo.</description>
  <comments>http://megaversal.livejournal.com/104599.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/104229.html</guid>
  <pubDate>Tue, 08 Sep 2009 02:46:51 GMT</pubDate>
  <title>T-Shirt Breakdown</title>
  <link>http://megaversal.livejournal.com/104229.html</link>
  <description>I just sorted through (most) of my t-shirts.&lt;br /&gt;&lt;br /&gt;Japanese band related: 12.&lt;br /&gt;Japan related: 6.&lt;br /&gt;Computer related: 4.&lt;br /&gt;Work related: 1.&lt;br /&gt;Other: 7.&lt;br /&gt;&lt;br /&gt;There are probably &amp;lt;5 floating around that didn’t make it into the counting, but I think they mostly match the above.&lt;br /&gt;&lt;br /&gt;Four of the &quot;Japan related&quot; are from the same company (&lt;a href=&quot;http://www.cune.jp/&quot;&gt;CUNE&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Half of the “Japanese band related” are specifically &lt;a href=&quot;http://breast.co.jp/gogo7188/top.html&quot;&gt;GO!GO!7188&lt;/a&gt; related which is only mildly creepy.&lt;br /&gt;&lt;br /&gt;Of the computer ones, two are from &lt;a href=&quot;http://www.socallinuxexpo.org/&quot;&gt;SCALE&lt;a&gt;. I was surprised because 90% of my shirts used to be computer-related (plus a few Metallica, Tool, etc ones). I figured I would have more, even if the percentage had dropped.&lt;/a&gt;&lt;/a&gt;</description>
  <comments>http://megaversal.livejournal.com/104229.html</comments>
  <category>tshirts</category>
  <category>clothing</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/104038.html</guid>
  <pubDate>Fri, 04 Sep 2009 21:19:38 GMT</pubDate>
  <title>I Love Wikipedia History Logs</title>
  <link>http://megaversal.livejournal.com/104038.html</link>
  <description>(cur) (prev) 20:52, 4 September 2009 Freshman5000 (talk | contribs) (3 bytes) (←Replaced content with &apos;gay&apos;)</description>
  <comments>http://megaversal.livejournal.com/104038.html</comments>
  <category>wikipedia</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/103898.html</guid>
  <pubDate>Tue, 01 Sep 2009 03:13:28 GMT</pubDate>
  <title>Spam</title>
  <link>http://megaversal.livejournal.com/103898.html</link>
  <description>Subject: 4chan delivered&lt;br /&gt;&lt;br /&gt;Body: Have you become an elephant with a &quot;trunk&quot; pointed down?</description>
  <comments>http://megaversal.livejournal.com/103898.html</comments>
  <category>spam</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/103626.html</guid>
  <pubDate>Tue, 04 Aug 2009 03:39:43 GMT</pubDate>
  <title>I made dinner and Yuki didn&apos;t hate it!</title>
  <link>http://megaversal.livejournal.com/103626.html</link>
  <description>The subject says it all!</description>
  <comments>http://megaversal.livejournal.com/103626.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/103417.html</guid>
  <pubDate>Mon, 03 Aug 2009 17:43:33 GMT</pubDate>
  <title>Wtf?</title>
  <link>http://megaversal.livejournal.com/103417.html</link>
  <description># cat /etc/resolv.conf &lt;br /&gt;search domain.com&lt;br /&gt;nameserver 192.168.1.2&lt;br /&gt;&lt;br /&gt;# cat /etc/resolv.conf | grep -v nameserver&lt;br /&gt;search domain.com&lt;br /&gt;&lt;br /&gt;# cat /etc/resolv.conf | grep -v nameserver &amp;gt; /etc/resolv.conf&lt;br /&gt;&lt;br /&gt;# cat /etc/resolv.conf&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;....?&lt;br /&gt;&lt;br /&gt;It must be somehow reading it and not being able to write out fast enough or something somehow. Fuck if I know, but annoying.&lt;br /&gt;&lt;br /&gt;EDIT: Aha, I guess this is just normal magic. Doing this now instead:&lt;br /&gt;&lt;br /&gt;sed -i &apos;/nameserver/d&apos; /etc/resolv.conf</description>
  <comments>http://megaversal.livejournal.com/103417.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/103096.html</guid>
  <pubDate>Fri, 24 Jul 2009 17:25:31 GMT</pubDate>
  <title>Expectations</title>
  <link>http://megaversal.livejournal.com/103096.html</link>
  <description>&quot;If you see a band that&apos;s wearing all black you don&apos;t know what to expect.&quot; - Davis LeDuke&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.amazon.com/dp/B0025X4OXE&quot;&gt;http://www.amazon.com/dp/B0025X4OXE&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Wow.&lt;br /&gt;&lt;br /&gt;Just wow.</description>
  <comments>http://megaversal.livejournal.com/103096.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/102682.html</guid>
  <pubDate>Mon, 20 Jul 2009 17:58:52 GMT</pubDate>
  <title>Layer 8</title>
  <link>http://megaversal.livejournal.com/102682.html</link>
  <description>From &lt;a href=&quot;http://siblog.mcafee.com/?p=1099&quot;&gt;http://siblog.mcafee.com/?p=1099&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I’m not sure if he’s the first person to use the term, but I really like it. “Security starts at layer 8, the users.”</description>
  <comments>http://megaversal.livejournal.com/102682.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>4</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/102432.html</guid>
  <pubDate>Sat, 18 Jul 2009 02:53:34 GMT</pubDate>
  <title>Tepidity</title>
  <link>http://megaversal.livejournal.com/102432.html</link>
  <description>&lt;img src=&quot;http://s3.amazonaws.com/data.tumblr.com/tLky7MuaQq01vovrNnMKoNJDo1_1280.jpg?AWSAccessKeyId=0RYTHV9YYQ4W5Q3HQMG2&amp;amp;Expires=1247938834&amp;amp;Signature=AHn7Feet3P0c6cCw1UKajMqZtDQ%3D&quot; /&gt;</description>
  <comments>http://megaversal.livejournal.com/102432.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>9</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/102379.html</guid>
  <pubDate>Sat, 27 Jun 2009 08:11:42 GMT</pubDate>
  <title>Words of Wisdom</title>
  <link>http://megaversal.livejournal.com/102379.html</link>
  <description>I&apos;m an optimist. I starting filling my cup with the vodka, kahlua, and milk (yeah yeah, not half and half) to a white russian. Once I got done, my glass was still only half full. So I added vodka to the other half.</description>
  <comments>http://megaversal.livejournal.com/102379.html</comments>
  <category>drinking</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/101903.html</guid>
  <pubDate>Fri, 26 Jun 2009 11:38:59 GMT</pubDate>
  <title>Dream.</title>
  <link>http://megaversal.livejournal.com/101903.html</link>
  <description>I just woke up from a dream. I was my (current) age, I thought. My teeth were falling out. Somehow I was living with my grandparents. My grandfather has been dead for about 9 years, but he was alive in this. We were hanging out, but then he had to pick my grandmother up from the airport, so I got ready for bed.&lt;br /&gt;&lt;br /&gt;As I tried to go to sleep, it took me a long time as something was bothering me. Just after I managed to doze off, I woke up and spit 3 teeth out. I freaked out and grabbed the teeth and ran into my grandparents&apos; bedroom. My grandfather had just tried to go to sleep as well after picking my grandmother up at the airport (I did not go with him). He was mumbling and couldn&apos;t say full words and then my grandmother woke up from the other room (for some reason my grandfather and grandmother weren&apos;t sleeping in the same room) and she ran in and started to help me. I&apos;m not sure what happened with him after that. It fades away so quickly after you wake up.&lt;br /&gt;&lt;br /&gt;Something about me wanting her to get me milk to put the teeth in to keep them for the dentist and her wanting to bring me something better than milk.&lt;br /&gt;&lt;br /&gt;I guess I have death on my mind after Michael Jackson&apos;s death (how odd is that?).</description>
  <comments>http://megaversal.livejournal.com/101903.html</comments>
  <category>dream</category>
  <category>death</category>
  <category>sleep</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/101769.html</guid>
  <pubDate>Thu, 04 Jun 2009 20:59:43 GMT</pubDate>
  <title>Nothing makes a man manlier than a few extra inches in pants.</title>
  <link>http://megaversal.livejournal.com/101769.html</link>
  <description>A recent junk mail I just received began with the subject: &quot;Nothing makes a man manlier than a few extra inches in pants.&quot;&lt;br /&gt;&lt;br /&gt;&quot;…in pants?&quot; Did they mean &quot;in the pants&quot; or perhaps they meant &quot;in pant size.&quot; Yes, nothing makes a man manlier than going from a size 34&quot; to a size 40&quot;.&lt;br /&gt;&lt;br /&gt;Then, I opened up the email to find out how I can buy a new pair of larger jeans to discover: &quot;Your bedroom got cold and you think you know the reason? If you blame your little size for everything, stop doing it and start doing something to increase both the dimensions and the passion in bed.&quot;&lt;br /&gt;&lt;br /&gt;I know the reason my bedroom is cold. The window faces west so we don&apos;t get any sunlight during the day. Plus, I live in California so nights are usually colder than daytime.&lt;br /&gt;&lt;br /&gt;&quot;If you blame your little size for everything&quot; Oh, so now you&apos;re calling me short? Way to get me to buy your jeans, buddy.&lt;br /&gt;&lt;br /&gt;&quot;…increase…the dimensions…in bed.&quot; Is this another fat thing again? Either they&apos;re asking me to buy a bigger bed (to go along with the pants?) or maybe they&apos;re trying to sell me pajamas (also, to go along with the pants).</description>
  <comments>http://megaversal.livejournal.com/101769.html</comments>
  <category>spam</category>
  <category>amusing</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/101409.html</guid>
  <pubDate>Thu, 21 May 2009 20:38:34 GMT</pubDate>
  <title>The Beatles</title>
  <link>http://megaversal.livejournal.com/101409.html</link>
  <description>I hate the Beatles.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Actually, I love the Beatles, but I can’t listen to them at work because I only keep one earphone in so I can hear people call for me. The Beatles have albums which are very stereo and it means that you can’t really listen to their stuff with only one ear.&lt;br /&gt;&lt;br /&gt;I either need to reencode them in mono or buy some kind of mono earphone. Annoying.</description>
  <comments>http://megaversal.livejournal.com/101409.html</comments>
  <category>music</category>
  <category>beatles</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/101164.html</guid>
  <pubDate>Mon, 11 May 2009 06:56:28 GMT</pubDate>
  <title>I don&apos;t even have words...</title>
  <link>http://megaversal.livejournal.com/101164.html</link>
  <description>My latest bill from my ER debacle (I think this makes four or five separate bills now) puts me at over $2k (after deductible and insurance coverage). I don&apos;t even understand how anyone in the world can think our medical system isn&apos;t broken. I have been sick to my stomach since I opened the envelope.&lt;br /&gt;&lt;br /&gt;So much for insurance plans that says &quot;ER visit == $100&quot; because they don&apos;t say that &quot;ER visit&quot; means walking in the door, not the room you stay in, the doctor you see, or any supplies they use. Thanks, insurance.</description>
  <comments>http://megaversal.livejournal.com/101164.html</comments>
  <category>holy fuck</category>
  <category>medical</category>
  <category>insurance</category>
  <category>raped by insurance companies</category>
  <category>emergency room</category>
  <lj:security>public</lj:security>
  <lj:reply-count>6</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/100944.html</guid>
  <pubDate>Thu, 30 Apr 2009 21:22:09 GMT</pubDate>
  <title>Quick /etc/network/interfaces changer</title>
  <link>http://megaversal.livejournal.com/100944.html</link>
  <description>&lt;p&gt;I quickly threw this together even though I know it’s really awful. It gets the job done at least and lets me auto-configure interfaces for dhcp or static on new (Debian and probably Ubuntu) machines that don&apos;t have perl or puppet or anything yet. I&apos;ve got a totally different piece of crap for CentOS/RHEL.&lt;/p&gt;

&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt; 
&lt;pre&gt;
#!/bin/bash

DEBUG=0
debug() {
	if [ &quot;$DEBUG&quot; -eq &quot;1&quot; ]; then
		echo -e &quot;$1&quot;
	fi
}


check_parameters() {
	INTERFACE_FILE=$1
	CHANGE_SECTION=$2
	
	if [ &quot;$CHANGE_SECTION&quot; == &quot;iface&quot; ]; then
		if [ -z &quot;$4&quot; ]; then
			echo &quot;Method not specified, nothing to change.&quot;
			exit 1
		fi
		if [ &quot;$4&quot; != &quot;dhcp&quot; ] &amp;&amp; [ &quot;$4&quot; != &quot;static&quot; ]; then
			echo &quot;Method not supported, only dhcp and static are supported.&quot;
			exit 1
		fi
		INTERFACE_NEW_NAME=$3
		INTERFACE_NEW_ADDRFAM=&quot;inet&quot;
		INTERFACE_NEW_METHOD=$4
		if [ &quot;$4&quot; == &quot;static&quot; ]; then
			if [ -z &quot;$3&quot; ] || [ -z &quot;$5&quot; ] || [ -z &quot;$6&quot; ]; then
				echo &quot;Not all necessary values supplied to use static method.&quot;
				exit 1
			else
				INTERFACE_NEW_address=$5
				INTERFACE_NEW_netmask=$6
				INTERFACE_NEW_gateway=$7 #optional
				INTERFACE_NEW_broadcast=$8 #optional
			fi
		fi
	else
		echo &quot;Unknown or no options specified, cannot change.&quot;
		echo &quot;Syntax:&quot;
		echo &quot;  $0 filename change_section change_section_options&quot;
		echo &quot;  $0 filename iface iface_name iface_method&quot;
		echo &quot;  $0 filename iface iface_name static ip_address netmask [gateway [broadcast_address]]&quot;
		echo &quot;  $0 filename iface iface_name dhcp&quot;
		echo &quot;Examples:&quot;
		echo &quot;  $0 /etc/network/interfaces iface eth0 dhcp&quot;
		echo &quot;  $0 /etc/network/interfaces iface eth0 static 192.168.1.2 255.255.255.0 192.168.1.1 192.168.1.255&quot;
		exit 1
	fi
}

read_interfaces_file() {
	oldifs=&quot;$IFS&quot;
	IFS=&quot; &quot;
	count=0
	while read LINE; do
		ARRAY[((count++))]=$LINE
		debug &quot;reading: ${ARRAY[$count-1]}&quot;
	done &amp;lt;$1
	IFS=&quot;$oldifs&quot; 
}


declare -a ARRAY # holds interfaces file line by line

check_parameters &quot;$1&quot; &quot;$2&quot; &quot;$3&quot; &quot;$4&quot; &quot;$5&quot; &quot;$6&quot; &quot;$7&quot; &quot;$8&quot;

read_interfaces_file &quot;$INTERFACE_FILE&quot;

# Initialize variables
IFACE_SECTION=0 
unset IFACE_SECTION_MATCH #integer corresponding to location of match
AUTO_SECTION=0
MAPPING_SECTION=0
ALLOW_SECTION=0
IN_SECTION=0 # generic non-implented section

debug &quot;----------\n\nPrinting original file: \n&quot;
for (( i=0; i &amp;lt;${#ARRAY[@]}; i++)); do
	debug &quot;${i}: ${ARRAY[${i}]}&quot;
done

# First loop looks for section to be changed, modifies any lines
ELEMENTS=${#ARRAY[@]}
for (( i=0; i &amp;lt;$ELEMENTS; i++)); do
	# ignore blank lines and comments
	if	[ $(expr match &quot;${ARRAY[${i}]}&quot; &quot;^\(#\).*&quot;) ] ||
		[ &quot;${ARRAY[${i}]}&quot; == &quot;&quot; ]; then
		continue
	fi
	
	# found an interface section
	if	[ $(expr match &quot;${ARRAY[${i}]}&quot; &quot;^iface.*&quot;) -ne 0 ]; then
		IFACE_SECTION=1
		AUTO_SECTION=0
		MAPPING_SECTION=0
		ALLOW_SECTION=0
		IN_SECTION=0
		debug &quot;found iface section header -- ${ARRAY[${i}]}&quot;
		INTERFACE_NAME=$(expr match &quot;${ARRAY[${i}]}&quot; &quot;^iface[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:]]*\)[[:space:]].*&quot;)
		# found the interface section we&apos;re looking for
		if [ &quot;$INTERFACE_NAME&quot; == &quot;$INTERFACE_NEW_NAME&quot; ]; then
			IFACE_SECTION_MATCH=$i
			# if the method hasn&apos;t changed, do nothing with that line, if it has, update that line
			INTERFACE_METHOD=$(expr match &quot;${ARRAY[${i}]}&quot; &quot;^iface[[:space:]][[:space:]]*$INTERFACE_NAME[[:space:]][[:space:]]*inet[[:space:]][[:space:]]*\([[:alnum:]][[:alnum:]]*\).*&quot;)
			if [ &quot;$INTERFACE_METHOD&quot; == &quot;$INTERFACE_NEW_METHOD&quot; ]; then
				debug &quot;configuration method matches, no need to change&quot;
			else
				debug &quot;different configuration method, changing...&quot;
				ARRAY[${i}]=&quot;iface $INTERFACE_NEW_NAME $INTERFACE_NEW_ADDRFAM $INTERFACE_NEW_METHOD&quot;
			fi
		else
			unset IFACE_SECTION_MATCH
		fi

		continue
	fi

	# found a (non-iface) section
	if	[ $(expr match &quot;${ARRAY[${i}]}&quot; &quot;^\(mapping\|auto\|allow-\).*&quot;) ]; then
		debug &quot;found section ${ARRAY[${i}]}&quot;
		IN_SECTION=1
		IFACE_SECTION=0
		continue
	fi
	
	# inside the matched iface section, update any options
	if [ &quot;$IFACE_SECTION_MATCH&quot; -gt &quot;0&quot; ]; then
		if [ &quot;$INTERFACE_NEW_METHOD&quot; == &quot;dhcp&quot; ]; then
			debug &quot;looking at ${ARRAY[${i}]}&quot;
			if  [ $(expr match &quot;${ARRAY[${i}]}&quot; &quot;^[[:space:]]*\(address\|netmask\|broadcast\|network\|metric\|gateway\|pointopoint\|media\|mtu\).*&quot;) ]; then # options not possible for dhcp (previously set for static, etc)
				unset ARRAY[${i}]
			fi
		elif [ &quot;$INTERFACE_NEW_METHOD&quot; == &quot;static&quot; ]; then
			if  [ $(expr match &quot;${ARRAY[${i}]}&quot; &quot;^[[:space:]]*\(address\|netmask\|broadcast\|network\|metric\|gateway\|pointopoint\|media\|mtu\).*&quot;) ]; then # possible options for static
				IFACE_OPTION=$(expr match &quot;${ARRAY[${i}]}&quot; &quot;^[[:space:]]*\([^[:space:]]*\).*&quot;)
				debug &quot;found $IFACE_OPTION, updating&quot;
				eval FOUND_$IFACE_OPTION=1
				INTERFACE_NEW_OPTION=&quot;INTERFACE_NEW_${IFACE_OPTION}&quot;
				ARRAY[${i}]=$(echo &quot;${ARRAY[${i}]}&quot; | sed -e &quot;s/^\([[:space:]]*$IFACE_OPTION\).*/\1 ${!INTERFACE_NEW_OPTION}/&quot;)
			fi
		fi
	fi

done

# Add elements if any are missing
if [ &quot;$INTERFACE_NEW_METHOD&quot; == &quot;static&quot; ] &amp;&amp; [ -n &quot;${IFACE_SECTION_MATCH}&quot; ]; then
	for interface_option in address netmask gateway broadcast; do
		FOUND_INTERFACE_OPTION=&quot;FOUND_${interface_option}&quot;
		INTERFACE_NEW_OPTION=&quot;INTERFACE_NEW_${interface_option}&quot;
		if [ &quot;${!FOUND_INTERFACE_OPTION}&quot; != &quot;1&quot; ]; then # need to add the option
			debug &quot;need to add ${interface_option} option&quot;
			# ** $IFACE_SECTION_MATCH+1 is the line after the iface section header
			# temporarily store everything from the beginning of the iface section to the end of the file
			for (( i=$IFACE_SECTION_MATCH+1; i &amp;lt;${#ARRAY[@]}; i++)); do
				TEMPARRAY[((j++))]=&quot;${ARRAY[${i}]}&quot;
			done
			# add the new option 
			ARRAY[$IFACE_SECTION_MATCH+1]=$(echo -e &quot;\t$interface_option ${!INTERFACE_NEW_OPTION}&quot;)
			ELEMENTS=${#ARRAY[@]}
			TEMPELEMENTS=${#TEMPARRAY[@]}
			# ** $IFACE_SECTION_MATCH+2 is the line after the iface section header and the option just added above
			for (( j=0; j&amp;lt;${#TEMPARRAY[@]}; j++)); do
				ARRAY[$IFACE_SECTION_MATCH+2+$j]=&quot;${TEMPARRAY[${j}]}&quot;
			done
		fi
	done
fi

debug &quot;----------\n\nPrinting updated file: \n&quot;
ELEMENTS=${#ARRAY[@]}
for (( i=0; i &amp;lt;$ELEMENTS; i++)); do
	debug &quot;${i}: ${ARRAY[${i}]}&quot;
done

echo &amp;gt;&quot;$INTERFACE_FILE&quot;
ELEMENTS=${#ARRAY[@]}
for (( i=0; i &amp;lt;$ELEMENTS; i++)); do
	echo &quot;${ARRAY[${i}]}&quot; &amp;gt;&amp;gt;&quot;$INTERFACE_FILE&quot;
done
&lt;/pre&gt;
</description>
  <comments>http://megaversal.livejournal.com/100944.html</comments>
  <category>bash</category>
  <category>code</category>
  <category>computers</category>
  <category>sysadmin</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/100786.html</guid>
  <pubDate>Fri, 24 Apr 2009 03:43:06 GMT</pubDate>
  <title>Encouragement</title>
  <link>http://megaversal.livejournal.com/100786.html</link>
  <description>“Progress isn’t made by early risers. It’s made by lazy men trying to find easier ways to do something.”&lt;br /&gt;— Robert Heinlein&lt;br /&gt;&lt;br /&gt;That’s right up there with the systems administrator’s informal creed too. Automate so you don’t have to do something manually every time.</description>
  <comments>http://megaversal.livejournal.com/100786.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/100592.html</guid>
  <pubDate>Thu, 16 Apr 2009 17:51:32 GMT</pubDate>
  <title>testing2</title>
  <link>http://megaversal.livejournal.com/100592.html</link>
  <description>test&lt;br /&gt;&lt;br /&gt;edit edit</description>
  <comments>http://megaversal.livejournal.com/100592.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/99953.html</guid>
  <pubDate>Mon, 13 Apr 2009 18:30:26 GMT</pubDate>
  <title>Quick puppet Notes</title>
  <link>http://megaversal.livejournal.com/99953.html</link>
  <description>puppet assumes the default server is at puppet.domain. If it isn’t, it needs to be added to the client’s /etc/puppet/puppet.conf:&lt;br /&gt;&lt;br /&gt;[main]&lt;br /&gt;==&amp;gt; server = 192.168.1.121 &amp;lt;== here&lt;br /&gt;logdir=/var/log/puppet&lt;br /&gt;vardir=/var/lib/puppet&lt;br /&gt;ssldir=/var/lib/puppet/ssl&lt;br /&gt;rundir=/var/run/puppet&lt;br /&gt;factpath=$vardir/lib/facter&lt;br /&gt;pluginsync=true&lt;br /&gt;&lt;br /&gt;Enable the fileserver:&lt;br /&gt;&lt;br /&gt;in: /etc/puppet/fileserver.conf&lt;br /&gt;[files]&lt;br /&gt;  path /etc/puppet/files&lt;br /&gt;==&amp;gt; allow 192.168.1.0/24 &amp;lt;==&lt;br /&gt;&lt;br /&gt;By default, files should be placed in /etc/puppet/files.</description>
  <comments>http://megaversal.livejournal.com/99953.html</comments>
  <category>configuration</category>
  <category>sysadmin</category>
  <category>servers</category>
  <category>puppet</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://megaversal.livejournal.com/99661.html</guid>
  <pubDate>Mon, 30 Mar 2009 04:19:25 GMT</pubDate>
  <title>Pain.2</title>
  <link>http://megaversal.livejournal.com/99661.html</link>
  <description>The most interesting part about my brain pain is the cycle.&lt;br /&gt;&lt;br /&gt;Pain.&lt;br /&gt;Take (1) Advil. The recommended dosage is 1 every 4-6 hours, max 6 per 24 hour period, which amounts to the same thing.&lt;br /&gt;Advil takes about 30-60 minutes to start working.&lt;br /&gt;Advil lasts 2 hours.&lt;br /&gt;Last hour deal with the pain.&lt;br /&gt;Take Advil. Deal with 30-60 minutes more of pain.&lt;br /&gt;Hope the Advil lasts as long into the 4 hour cycle as possible.&lt;br /&gt;&lt;br /&gt;I think you get the pattern.&lt;br /&gt;&lt;br /&gt;When will it end?</description>
  <comments>http://megaversal.livejournal.com/99661.html</comments>
  <category>neck</category>
  <category>brain</category>
  <category>pain</category>
  <category>head</category>
  <lj:security>public</lj:security>
  <lj:reply-count>6</lj:reply-count>
</item>
</channel>
</rss>
