<?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"
	>

<channel>
	<title>celsobarriga-dot-com</title>
	<atom:link href="http://www.celsobarriga.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.celsobarriga.com</link>
	<description>Wasting bandwidth in style!</description>
	<pubDate>Mon, 28 Jul 2008 06:21:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>How to determine DST time changes</title>
		<link>http://www.celsobarriga.com/2008/02/01/how-to-determine-dst-time-changes/</link>
		<comments>http://www.celsobarriga.com/2008/02/01/how-to-determine-dst-time-changes/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 17:44:28 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Mac OS X]]></category>

		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2008/02/01/how-to-determine-dst-time-changes/</guid>
		<description><![CDATA[Here&#8217;s how to determine the dates when the Daylight Savings Time changes for a given year (I keep forgetting how to do this.):


zdump -v /etc/localtime&#124;grep 2008

/etc/localtime  Sun Mar  9 06:59:59 2008 UTC =
    Sun Mar 9 01:59:59 2008 EST isdst=0 gmtoff=-18000
/etc/localtime  Sun Mar  9 07:00:00 2008 UTC =
 [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to determine the dates when the Daylight Savings Time changes for a given year (I keep forgetting how to do this.):</p>
<pre><code>
<blockquote>
zdump -v /etc/localtime|grep 2008

/etc/localtime  Sun Mar  9 06:59:59 2008 UTC =
    Sun Mar 9 01:59:59 2008 EST isdst=0 gmtoff=-18000
/etc/localtime  Sun Mar  9 07:00:00 2008 UTC =
    Sun Mar 9 03:00:00 2008 EDT isdst=1 gmtoff=-14400
/etc/localtime  Sun Nov  2 05:59:59 2008 UTC =
    Sun Nov 2 01:59:59 2008 EDT isdst=1 gmtoff=-14400
/etc/localtime  Sun Nov  2 06:00:00 2008 UTC =
    Sun Nov 2 01:00:00 2008 EST isdst=0 gmtoff=-18000
</blockquote>

</code></pre>
<p>Obviously, change <strong>2008</strong> to whatever year you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2008/02/01/how-to-determine-dst-time-changes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Uninstall Perl Module</title>
		<link>http://www.celsobarriga.com/2008/01/10/uninstall-perl-module/</link>
		<comments>http://www.celsobarriga.com/2008/01/10/uninstall-perl-module/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 21:00:41 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2008/01/10/uninstall-perl-module/</guid>
		<description><![CDATA[Here&#39;s how to cleanly uninstall any Perl module:



#!&#47;usr&#47;local&#47;bin&#47;perl

use ExtUtils::Packlist;
use ExtUtils::Installed;

$ARGV&#91;0&#93; or die &#34;Usage: $0 Module::Name\n&#34;;

my $mod = $ARGV&#91;0&#93;;

my $inst = ExtUtils::Installed-&#62;new();

foreach my $item (sort($inst-&#62;files($mod))) {
         print &#34;removing $item\n&#34;;
         unlink $item;
}

my $packfile = $inst-&#62;packlist($mod)-&#62;packlist_file();
print &#34;removing $packfile\n&#34;;
unlink $packfile;



]]></description>
			<content:encoded><![CDATA[<p>Here&#39;s how to cleanly uninstall any Perl module:</p>
<p><code>
<pre>
<blockquote>
#!&#47;usr&#47;local&#47;bin&#47;perl

use ExtUtils::Packlist;
use ExtUtils::Installed;

$ARGV&#91;0&#93; or die &quot;Usage: $0 Module::Name\n&quot;;

my $mod = $ARGV&#91;0&#93;;

my $inst = ExtUtils::Installed-&gt;new();

foreach my $item (sort($inst-&gt;files($mod))) {
         print &quot;removing $item\n&quot;;
         unlink $item;
}

my $packfile = $inst-&gt;packlist($mod)-&gt;packlist_file();
print &quot;removing $packfile\n&quot;;
unlink $packfile;
</blockquote>
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2008/01/10/uninstall-perl-module/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Find Out the Top 10 CPU Hogs</title>
		<link>http://www.celsobarriga.com/2007/08/29/find-out-the-top-10-cpu-hogs/</link>
		<comments>http://www.celsobarriga.com/2007/08/29/find-out-the-top-10-cpu-hogs/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 21:48:23 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.barriga.net/notes/2007/08/29/85/</guid>
		<description><![CDATA[I found this command useful in finding out which top 10 processes are hogging my CPU resources. Note that this command is specific to the Red Hat flavor of Linux. See the man page for ps for the correct output format to use for your specific platform:

ps -eo pcpu,pid,user,args &#124; sort -k1 -r &#124; head [...]]]></description>
			<content:encoded><![CDATA[<p>I found this command useful in finding out which top 10 processes are hogging my CPU resources. Note that this command is specific to the Red Hat flavor of Linux. See the man page for ps for the correct output format to use for your specific platform:</p>
<pre>
<blockquote><code>ps -eo pcpu,pid,user,args | sort -k1 -r | head -11</code></blockquote>
</pre>
<p>Substitue <code>pcpu</code> above with <code>pmem</code> to see the memory hogs instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2007/08/29/find-out-the-top-10-cpu-hogs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bourne Shell Logging Routine</title>
		<link>http://www.celsobarriga.com/2007/08/28/bourne-shell-logging-routine/</link>
		<comments>http://www.celsobarriga.com/2007/08/28/bourne-shell-logging-routine/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 03:20:19 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Cpp]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Mac OS X]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.barriga.net/notes/2007/08/28/84/</guid>
		<description><![CDATA[Here&#8217;s another logging routine, this one is written in Bourne shell:


#!/bin/sh

log_message() {
    echo `date "+%m/%d/%y %H:%M:%S %Z"` "$1" &#124; tee -a aaa.out
}

log_message "Hello there"
log_message "Goodbye"


Sample output:


08/28/07 23:16:13 EDT Hello there
08/28/07 23:16:13 EDT Goodbye


]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another logging routine, this one is written in Bourne shell:</p>
<blockquote><p><code>
<pre>
#!/bin/sh

log_message() {
    echo `date "+%m/%d/%y %H:%M:%S %Z"` "$1" | tee -a aaa.out
}

log_message "Hello there"
log_message "Goodbye"
</pre>
<p></code></p></blockquote>
<p>Sample output:</p>
<blockquote><p><code>
<pre>
08/28/07 23:16:13 EDT Hello there
08/28/07 23:16:13 EDT Goodbye
</pre>
<p></code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2007/08/28/bourne-shell-logging-routine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Setting MySQL Password</title>
		<link>http://www.celsobarriga.com/2006/08/23/setting-mysql-password/</link>
		<comments>http://www.celsobarriga.com/2006/08/23/setting-mysql-password/#comments</comments>
		<pubDate>Wed, 23 Aug 2006 17:40:47 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2006/08/23/78/</guid>
		<description><![CDATA[To set up root password the first time:
$ mysqladmin -u root password NeWPasSwORd

To change an existing root password:
$ mysqladmin -u root -p oldpassword newpass
Enter password:


To change a normal user password:
$ mysqladmin -u dbuser-p oldpassword newpass

]]></description>
			<content:encoded><![CDATA[<p>To set up root password the first time:</p>
<blockquote><pre><code>$ mysqladmin -u root password NeWPasSwORd</code></pre>
</blockquote>
<p>To change an existing root password:</p>
<blockquote><pre><code>$ mysqladmin -u root -p oldpassword newpass
Enter password:
</code></pre>
</blockquote>
<p>To change a normal user password:</p>
<blockquote><pre><code>$ mysqladmin -u dbuser-p oldpassword newpass</code></pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2006/08/23/setting-mysql-password/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sorting IP Addresses</title>
		<link>http://www.celsobarriga.com/2006/07/13/sorting-ip-addresses/</link>
		<comments>http://www.celsobarriga.com/2006/07/13/sorting-ip-addresses/#comments</comments>
		<pubDate>Thu, 13 Jul 2006 18:12:42 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2006/07/13/76/</guid>
		<description><![CDATA[The following will sort an array of IP addresses in @in and the sorted IP addresses will be in @out.


@out = sort {
    pack('C4' => $a =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/)
    cmp
    pack('C4' => $b =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/)
} @in;


What this does is it forms a string of four bytes out [...]]]></description>
			<content:encoded><![CDATA[<p>The following will sort an array of IP addresses in @in and the sorted IP addresses will be in @out.</p>
<blockquote>
<pre><code>
@out = sort {
    pack('C4' => $a =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/)
    cmp
    pack('C4' => $b =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/)
} @in;
</code></pre>
</blockquote>
<p>What this does is it forms a string of four bytes out the IP address octet using the <code>pack()</code> function then sorts it lexicographically.</p>
<p>See also <a href="http://www.barriga.net/2004/07/02/27/">Sorting Section Numbers</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2006/07/13/sorting-ip-addresses/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Determining the External IP Address</title>
		<link>http://www.celsobarriga.com/2006/06/07/find-external-ip-address/</link>
		<comments>http://www.celsobarriga.com/2006/06/07/find-external-ip-address/#comments</comments>
		<pubDate>Wed, 07 Jun 2006 17:33:15 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Mac OS X]]></category>

		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2006/06/07/71/</guid>
		<description><![CDATA[Here&#8217;s how to find out your external IP address courtesy of this hint:
http://www.macosxhints.com/article.php?story=20060602180942480


curl --silent http://checkip.dyndns.org
    &#124; awk '{print $6}' &#124; cut -f 1 -d "]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to find out your external IP address courtesy of this hint:</p>
<p><a href="http://www.macosxhints.com/article.php?story=20060602180942480">http://www.macosxhints.com/article.php?story=20060602180942480</a></p>
<blockquote>
<pre><code>
curl --silent http://checkip.dyndns.org
    | awk '{print $6}' | cut -f 1 -d "<"
</code></pre>
</blockquote>
<p>If you are using Apple&#8217;s Airport Extreme Basestation (mine is particularly the Time Capsule and this is where I have tested this), and you have the SNMP interface enabled, you can run the following command</p>
<pre><code>
prompt$ snmpwalk -Os -c public -v 1 192.168.63.1 ipAdEntAddr IpAddress \
    | grep -E -v '(127.0.0|169.254|192.168.63.1)' \
    | cut -d : -f 2 | sed 's/ //g'
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2006/06/07/find-external-ip-address/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Write a Daemon in Perl</title>
		<link>http://www.celsobarriga.com/2006/05/24/write-a-daemon-in-perl/</link>
		<comments>http://www.celsobarriga.com/2006/05/24/write-a-daemon-in-perl/#comments</comments>
		<pubDate>Wed, 24 May 2006 19:55:14 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Notes]]></category>

		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2006/05/24/70/</guid>
		<description><![CDATA[The code below is a template for a daemon written in Perl. Use the code below as a starting point when you have to write a program that has to persist in the background to do its things and without a gui.


use POSIX qw(setsid);

chdir '/' or die "Can't chdir to /: $!";
umask 0;
open STDIN, '/dev/null'
 [...]]]></description>
			<content:encoded><![CDATA[<p>The code below is a template for a daemon written in Perl. Use the code below as a starting point when you have to write a program that has to persist in the background to do its things and without a gui.</p>
<blockquote>
<pre><code>
use POSIX qw(setsid);

chdir '/' or die "Can't chdir to /: $!";
umask 0;
open STDIN, '/dev/null'
    or die "Can't read /dev/null: $!";

#open STDOUT, '>/dev/null'
#    or die "Can't write to /dev/null: $!";

open STDERR, '>/dev/null'
    or die "Can't write to /dev/null: $!";

defined(my $pid = fork)
    or die "Can't fork: $!";

exit if $pid;

setsid or die "Can't start a new session: $!";

while(1) {
    sleep(5);
    print "Hello...n";
}
</code></pre>
</blockquote>
<p>Note that one of the lines above is commented out to let the output print to the screen. Uncomment this in the final code to silence your program. For more on this code, see this tutorial: <a href="http://www.webreference.com/perl/tutorial/9/">http://www.webreference.com/perl/tutorial/9/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2006/05/24/write-a-daemon-in-perl/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Line Terminations</title>
		<link>http://www.celsobarriga.com/2006/04/13/line-terminations/</link>
		<comments>http://www.celsobarriga.com/2006/04/13/line-terminations/#comments</comments>
		<pubDate>Thu, 13 Apr 2006 21:11:13 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Mac OS X]]></category>

		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2006/04/13/66/</guid>
		<description><![CDATA[Line terminations for different operating systems:


unix
0&#215;0a
LF


Classic Mac
0&#215;0d
CR


Windows
0&#215;0d 0&#215;0a
CR LF


To convert a text file with DOS line termination to UNIX line termination:

tr -d '\015' < winfile.txt > unixfile.txt


or

sed s/.$// winfile.txt > unixfile.txt


To convert a unix file to a DOS file:

sed s/$/\x0d/ unixfile.txt > winfile.txt


]]></description>
			<content:encoded><![CDATA[<p>Line terminations for different operating systems:</p>
<table border="1">
<tr>
<td>unix</td>
<td>0&#215;0a</td>
<td>LF</td>
</tr>
<tr>
<td>Classic Mac</td>
<td>0&#215;0d</td>
<td>CR</td>
</tr>
<tr>
<td>Windows</td>
<td>0&#215;0d 0&#215;0a</td>
<td>CR LF</td>
</tr>
</table>
<p>To convert a text file with DOS line termination to UNIX line termination:</p>
<blockquote><pre><code>
tr -d '\015' < winfile.txt > unixfile.txt
</code></pre>
</blockquote>
<p>or</p>
<blockquote><pre><code>
sed s/.$// winfile.txt > unixfile.txt
</code></pre>
</blockquote>
<p>To convert a unix file to a DOS file:</p>
<blockquote><pre><code>
sed s/$/\x0d/ unixfile.txt > winfile.txt
</code></pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2006/04/13/line-terminations/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Run Periodic Maintenance Scripts Manually</title>
		<link>http://www.celsobarriga.com/2006/02/11/run-periodic-maintenance-scripts-manually/</link>
		<comments>http://www.celsobarriga.com/2006/02/11/run-periodic-maintenance-scripts-manually/#comments</comments>
		<pubDate>Sun, 12 Feb 2006 02:58:33 +0000</pubDate>
		<dc:creator>celso</dc:creator>
		
		<category><![CDATA[Mac OS X]]></category>

		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.barriga.net/2006/02/11/55/</guid>
		<description><![CDATA[Mac OS X has to run some maintenance scripts in the middle of the night to do some important housekeeping tasks. If you have a Mac that sleeps in the middle of the night, as you do, you need to run these manually by running this from the shell:

sudo periodic daily weekly monthly


]]></description>
			<content:encoded><![CDATA[<p>Mac OS X has to run some maintenance scripts in the middle of the night to do some important housekeeping tasks. If you have a Mac that sleeps in the middle of the night, as you do, you need to run these manually by running this from the shell:</p>
<blockquote><pre><code>
sudo periodic daily weekly monthly
</code></pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.celsobarriga.com/2006/02/11/run-periodic-maintenance-scripts-manually/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
