<?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>Sysop Blog &#187; Uncategorized</title>
	<atom:link href="http://sysopblog.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://sysopblog.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 21 Apr 2010 20:38:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>using find plus xargs with whitespace</title>
		<link>http://sysopblog.com/2010/04/using-find-plus-xargs-with-whitespace/</link>
		<comments>http://sysopblog.com/2010/04/using-find-plus-xargs-with-whitespace/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 20:38:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sysopblog.com/?p=16</guid>
		<description><![CDATA[Often I find myself needing to search the filesystem or a particular directory for anything containing a certain phrase. This was done by find . &#124; xargs grep &#8220;phrase&#8221; However if a file or directory contained a space or any other whitespace in the name it would barf. An easy way to overcome this is [...]]]></description>
			<content:encoded><![CDATA[<p>Often I find myself needing to search the filesystem or a particular directory for anything containing a certain phrase.<br />
This was done by find . | xargs grep &#8220;phrase&#8221;<br />
However if a file or directory contained a space or any other whitespace in the name it would barf.</p>
<p>An easy way to overcome this is to run find like this:<br />
find . -print0 | xargs -0 grep &#8220;phrase&#8221;</p>
<p>What this does is tells find to print the path to the file and terminate it with a NULL character. Then &#8220;-0&#8243; tells xargs to split arguments on NULL instead of whitespace.</p>
]]></content:encoded>
			<wfw:commentRss>http://sysopblog.com/2010/04/using-find-plus-xargs-with-whitespace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Akismet Spam Assassin Plugin</title>
		<link>http://sysopblog.com/2009/12/akismet-spam-assassin-plugin/</link>
		<comments>http://sysopblog.com/2009/12/akismet-spam-assassin-plugin/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 20:05:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sysopblog.com/?p=9</guid>
		<description><![CDATA[This is a plugin I wrote a while back to test using Akismet with spam assassin for outbound email coming off our web cluster. It seemed to work nicely and caught a large volume of spam with not too many false positives. We didn&#8217;t end up using it because of the prices of the commercial license [...]]]></description>
			<content:encoded><![CDATA[<p>This is a plugin I wrote a while back to test using <a href="http://akismet.com/">Akismet</a> with spam assassin for outbound email coming off our web cluster. It seemed to work nicely and caught a large volume of spam with not too many false positives. We didn&#8217;t end up using it because of the prices of the commercial license the <a href="http://akismet.com/">Akismet</a> folks wanted. Anyways I thought I would post it here in case anyone was interested and before it got lost forever in a clutter of files.</p>
<p><code><br />
#package sa_akismet;<br />
use strict;<br />
use Mail::SpamAssassin;<br />
use Mail::SpamAssassin::Plugin;<br />
use Akismet;</p>
<p>our @ISA = qw(Mail::SpamAssassin::Plugin);</p>
<p>sub new {<br />
    my ($class, $mailsa) = @_;<br />
    $class = ref($class) || $class;<br />
    my $self = $class->SUPER::new($mailsa);<br />
    bless ($self, $class);<br />
    $self->register_eval_rule ("check_sa_akismet");<br />
    return $self;<br />
}</p>
<p>sub parse_config {<br />
  my ($self, $opts) = @_;</p>
<p>  my $key = $opts->{key};</p>
<p>  if ($key eq 'akismet_api_key') {<br />
    $opts->{conf}->{api_key} = $opts->{value};<br />
    $self->inhibit_further_callbacks();<br />
    return 1;<br />
  }<br />
  if ($key eq 'akismet_url') {<br />
    $opts->{conf}->{akismet_url} = $opts->{value};<br />
    $self->inhibit_further_callbacks();<br />
    return 1;<br />
  }</p>
<p>  return 0;<br />
}</p>
<p>sub check_sa_akismet {<br />
  my ($self, $permsgstatus) = @_;<br />
  my $array = $permsgstatus->get_decoded_stripped_body_text_array();<br />
  my $str = join (' ', @$array);<br />
  $str =~ s/\s+/ /gs;</p>
<p>  my $rule_name = "check_sa_akismet";<br />
  my $api_key =  $permsgstatus->{conf}->{api_key};<br />
  my $url     =  $permsgstatus->{conf}->{akismet_url};<br />
  my $email_name =  $permsgstatus->get("From:name");<br />
  my $email_addr =  $permsgstatus->get("From:addr");<br />
  my $userip = "10.10.10.11";<br />
     $userip =  $permsgstatus->get("X-Remote-Ip:");<br />
  if($userip eq "") {<br />
      $userip = "10.10.10.11";<br />
  }<br />
  my $akismet = Net::Akismet->new(<br />
		KEY => "$api_key",<br />
		URL => "$url",<br />
                ) or die('Key verification failure!');</p>
<p>  my $verdict = $akismet->check(<br />
		USER_IP                 => "$userip",<br />
		COMMENT_USER_AGENT      => 'Mozilla/5.0',<br />
		COMMENT_CONTENT         => "$str",<br />
		COMMENT_AUTHOR          => "$email_name",<br />
		COMENT_AUTHOR_EMAIL     => "$email_addr",<br />
		REFERRER                => "$url",<br />
	) or die("Is the server here? $api_key $url $userip ");</p>
<p>  if ('true' eq $verdict) {<br />
    $permsgstatus->got_hit("$rule_name", "");<br />
  }</p>
<p> return 0;<br />
}</p>
<p>1;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sysopblog.com/2009/12/akismet-spam-assassin-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back Plates keep more then just dust out</title>
		<link>http://sysopblog.com/2008/09/back-plates-keep-more-then-just-dust-out/</link>
		<comments>http://sysopblog.com/2008/09/back-plates-keep-more-then-just-dust-out/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 22:19:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sysopblog.com/?p=6</guid>
		<description><![CDATA[I received a call from a old co-worker today needing help to trouble shoot a T1 customer of his. The line kept bouncing up and down. The telco checked the line and said it looked fine up to the CSU/DSU. After talking to him for a few minutes and him explaining the situation to me [...]]]></description>
			<content:encoded><![CDATA[<p>I received a call from a old co-worker today needing help to trouble shoot a T1 customer of his. The line kept bouncing up and down. The telco checked the line and said it looked fine up to the CSU/DSU. After talking to him for a few minutes and him explaining the situation to me I told him we should replace the router. I told him to hook it up to a console so I could copy the config off of it. During this conversation he kept telling me how there was rat crap all over the place and how bad the place smelt. When he got the router to a console that I could log into I saw the output that shows below. He also told me that the router was missing one of the WIC card slots and rat crap had actually poured out of the router when he tipped on its back.  Rats in the router anyone?</p>
<p>Copyright (c) 1999 by cisco Systems, Inc.<br />
C1700 platform with 32768 Kbytes of main memory</p>
<p>program load complete, entry point: 0&#215;80008000, size: 0x7ee488<br />
Self decompressing the image : #################################################<br />
################################################################################<br />
######## [OK]</p>
<p>Smart Init is enabled<br />
smart init is sizing iomem<br />
ID            MEMORY_REQ         TYPE<br />
MainBoard       0X00027A80 1720<br />
0X000F3BB0 public buffer pools<br />
0X00211000 public particle pools<br />
0X0002          0X0000DC00 Card in slot 1<br />
TOTAL:          0X0033A230</p>
<p>If any of the above Memory Requirements are<br />
&#8220;UNKNOWN&#8221;, you may be using an unsupported<br />
configuration or there is a software problem and<br />
system operation may be compromised.</p>
<p>Memory required: 36400364 bytes, Memory available: 33554432 bytes<br />
INSUFFICIENT MEMORY TO LOAD IMAGE!<br />
The difference between Memory required and Memory available is the additional<br />
memory you need to run the router. Alternatel<br />
may cause the memory requirement to decrease, and may allow you to at least<br />
use the router with reduced functionality until you get more memory.</p>
<p>*** System received a Software forced crash ***<br />
signal= 0&#215;17, code= 0&#215;200, context= 0x8000620c<br />
PC = 0xffffffff, Vector = 0&#215;200, SP = 0xffffffff</p>
<p>System Bootstrap, Version 12.0(3)T, RELEASE SOFTWARE (fc1)<br />
Copyright (c) 1999 by cisco Systems, Inc.<br />
C1700 platform with 32768 Kbytes of main memory</p>
<p>$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $<br />
$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $<br />
*** line too large ***</p>
<p>$$  large ***</p>
<p>monitor: command &#8220;large&#8221; not found<br />
$$ und</p>
<p>monitor: command &#8220;und&#8221; not found<br />
$$ not found</p>
<p>monitor: command &#8220;not&#8221; not found<br />
$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$<br />
$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $<br />
*** line too large ***</p>
<p>AND it continues to repeat from there&#8230;.</p>
<p>Stay tuned for pictures of dead rats or whatever we may find inside the router.</p>
]]></content:encoded>
			<wfw:commentRss>http://sysopblog.com/2008/09/back-plates-keep-more-then-just-dust-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When perl and rpm don&#8217;t get along</title>
		<link>http://sysopblog.com/2008/04/when-perl-and-rpm-dont-get-along/</link>
		<comments>http://sysopblog.com/2008/04/when-perl-and-rpm-dont-get-along/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 19:29:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[exclude perl from requires]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[requires included file]]></category>
		<category><![CDATA[rpm requires]]></category>
		<category><![CDATA[rpmbuild]]></category>

		<guid isPermaLink="false">http://sysopblog.com/?p=5</guid>
		<description><![CDATA[Sometimes when building rpm packages you will get an rpm that requires a file that it already contains. This seems pretty lame (which it is) but here is an example and a workaround. Building a package for freepbx we see this output: rpmbuild -ba freepbx.spec --------snip----------------- Provides: config(freepbx) = 2.4.0-0 Requires(interp): /bin/sh /bin/sh Requires(rpmlib): rpmlib(CompressedFileNames) [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when building rpm packages you will get an rpm that requires a file that it already contains. This seems pretty lame (which it is) but here is an example and a workaround.</p>
<p>Building a package for freepbx we see this output:<br />
<code><br />
rpmbuild -ba freepbx.spec<br />
--------snip-----------------<br />
Provides: config(freepbx) = 2.4.0-0<br />
Requires(interp): /bin/sh /bin/sh<br />
Requires(rpmlib): rpmlib(CompressedFileNames) &lt;= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) &lt;= 4.0-1<br />
Requires(post): /bin/sh<br />
Requires(postun): /bin/sh<br />
Requires: /bin/bash /usr/bin/env /usr/bin/perl /usr/bin/php config(freepbx) = 2.4.0-0 perl(DBI) perl(FindBin) perl(retrieve_parse_amportal_conf.pl)</code></p>
<p><strong>The file we don&#8217;t want is: &#8220;perl(retrieve_parse_amportal_conf.pl)&#8221;</strong></p>
<p>What rpmbuild does is go through the list of files and run &#8220;ldd&#8221; against all executables to find required libraries.<br />
It also goes through each perl file and looks for &#8220;<strong>use </strong>/ <strong>require</strong>&#8221; flags to pull out required perl modules.<br />
When a developer does a legitimate thing like &#8216;<strong>require &#8220;retrieve_parse_amportal_conf.pl</strong>&#8220;&#8216; to include functions and such into their program, rpmbuild sees that this file is needed adds it too it&#8217;s list of required files.</p>
<p>Now rpmbuild also goes through and looks for what packages/files perl programs provide. It does this by scanning through the files and looking for &#8220;<strong>package</strong>&#8220;. If you just have an include file with functions, you don&#8217;t have a complete module and won&#8217;t have the package statement either. Thus rpmbuild will never see your file provides itself! Fortunatly there are a couple work arounds.</p>
<p>In your perl file that rpmbuild is requiring you can define &#8216; <strong>our $RPM_Provides = &#8220;yourfilename.pl&#8221;</strong> &#8216;. rpmbuild will pick this up and happily add it to the provided file list. The other method is slightly more complicated but works well if you don&#8217;t want to patch the source code.</p>
<p>In your rpm spec file under the <strong>%prep</strong> section after the <strong>%setup</strong> add the following code:<br />
<code><br />
cat &lt;&lt; \EOF &gt; %{name}-req<br />
#!/bin/sh<br />
%{__perl_requires} $* |\<br />
sed -e '/perl(yourperlfile.pl)/d'<br />
EOF<br />
%define __perl_requires %{_builddir}/%{name}-%{version}/%{name}-req<br />
chmod 755 %{__perl_requires}<br />
</code></p>
<p>Where <strong>yourperlfile.pl </strong>is the file you want to exclude from the rpm requires check.<br />
This should make your rpm build hapily and exlude that file from the requires check.</p>
<p>If you want to see the actuall files rpmbuild runs take a look at:<br />
/usr/lib/rpm/perl.prov<br />
and<br />
/usr/lib/rpm/perl.req</p>
]]></content:encoded>
			<wfw:commentRss>http://sysopblog.com/2008/04/when-perl-and-rpm-dont-get-along/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
