<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://polibyte.com/lib/exe/css.php?s=feed" type="text/css"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>PoliByte code</title>
    <subtitle></subtitle>
    <link rel="alternate" type="text/html" href="http://polibyte.com/"/>
    <id>http://polibyte.com/</id>
    <updated>2010-09-10T21:06:31-04:00</updated>
    <generator>FeedCreator 1.7.2-ppt DokuWiki</generator>
<link rel="self" type="application/atom+xml" href="http://polibyte.com/feed.php" />
    <entry>
        <title>code:bbpress_banner</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/bbpress_banner?rev=1247287750&amp;do=diff"/>
        <published>2009-07-11T00:49:10-04:00</published>
        <updated>2009-07-11T00:49:10-04:00</updated>
        <id>http://polibyte.com/code/bbpress_banner?rev=1247287750&amp;do=diff</id>
        <summary>This is a plugin for bbPress that adds a message to the top of each page.


&lt;?php
/*
Plugin Name: bbPress Banner
Plugin URI:
Description: Add a customizable banner message in the header
Author: Brian Pitts
Author URI: http://www.polibyte.com
Version: 0.1
License: GNU General Public License 2.0 http://creativecommons.org/licenses/GPL/2.0/
*/

add_action('bb_admin_menu_generator', 'bb_banner_configuration_page_add');
add_action('bb_banner_configuration_page_pre_head', 'bb_banner_configuration_page…</summary>
    </entry>
    <entry>
        <title>code:check_nfs_mount</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/check_nfs_mount?rev=1283722664&amp;do=diff"/>
        <published>2010-09-05T17:37:44-04:00</published>
        <updated>2010-09-05T17:37:44-04:00</updated>
        <id>http://polibyte.com/code/check_nfs_mount?rev=1283722664&amp;do=diff</id>
        <summary>A simple script for checking whether an NFS mount is accessible. The only argument it requires is the mountpoint. It should be suitable for plugging in to a monitoring system like Nagios.


#!/usr/bin/perl

use strict;
use warnings;

my $timeout = 1;
my $mp      = $ARGV[0];
my $mtab    = &quot;/proc/mounts&quot;;

# First, we check if the OS thinks the filesystem is mounted

my $found;
open( MTAB, $mtab ) || die &quot;Could not open $mtab\n&quot;;
while (&lt;MTAB&gt;) {
    if (/\Q$mp\E/) {
        $found = 1;
        la…</summary>
    </entry>
    <entry>
        <title>code:combine_rss</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/combine_rss?rev=1247287988&amp;do=diff"/>
        <published>2009-07-11T00:53:08-04:00</published>
        <updated>2009-07-11T00:53:08-04:00</updated>
        <id>http://polibyte.com/code/combine_rss?rev=1247287988&amp;do=diff</id>
        <summary>I wrote this to answer a question  on Ask Metafilter. It takes a file with a list of RSS feeds and a file with a list of keywords and generates a new RSS feed with the items that include a keyword.


#!/usr/bin/perl

use strict;
use warnings;
use XML::RSS;
use LWP::Simple;

use vars qw{$feeds_path $keywords_path $output_path};

# one url per line
$feeds_path = 'feeds.txt';

# one lowercase search term per line
$keywords_path = 'keywords.txt';

$output_path = 'nickels.xml';

sub main {

  my $rss…</summary>
    </entry>
    <entry>
        <title>code:craigscrape</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/craigscrape?rev=1247288140&amp;do=diff"/>
        <published>2009-07-11T00:55:40-04:00</published>
        <updated>2009-07-11T00:55:40-04:00</updated>
        <id>http://polibyte.com/code/craigscrape?rev=1247288140&amp;do=diff</id>
        <summary>This program was intended to email me search results from craigslist. I wrote it before I realized you could get an rss feed of a search.


#!/usr/bin/env ruby
require 'mechanize'
require 'net/smtp'
require 'date'

# Sample configuration
city = 'atlanta'
terms = ['scsi', 'raid']
days_to_send = 3 # eg if run on the 15th return items posted on the 13th, 14th, and 15th
email_recipient = 'recipient@example.com'
email_html = true
email_server = 'localhost'

cutoff_date = Date.today - days_to_send
ite…</summary>
    </entry>
    <entry>
        <title>code:custom_feed</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/custom_feed?rev=1247611708&amp;do=diff"/>
        <published>2009-07-14T18:48:28-04:00</published>
        <updated>2009-07-14T18:48:28-04:00</updated>
        <id>http://polibyte.com/code/custom_feed?rev=1247611708&amp;do=diff</id>
        <summary>This program is part of a system that allows users to generate a custom news feed. The program at example.com/news returns an rss feed for specific categories of news. For example, news?categories=1,3,5 would return an rss feed with only the news from categories 1, 3, and 5.</summary>
    </entry>
    <entry>
        <title>code:focuser</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/focuser?rev=1271911268&amp;do=diff"/>
        <published>2010-04-22T00:41:08-04:00</published>
        <updated>2010-04-22T00:41:08-04:00</updated>
        <id>http://polibyte.com/code/focuser?rev=1271911268&amp;do=diff</id>
        <summary>The Focuser class is a python interface to rainbow from Andrew McCallum's 'Bow' Toolkit. You must have already trained rainbow. At the moment, tThe path to the model's parent directory is hard-coded into the program. For example, if you have a model in /home/username/models/free_trade you would replace /PATH/TO/MODELS/ with /home/username/models/. You could then create and use a new Focuser like this</summary>
    </entry>
    <entry>
        <title>code:just_weather</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/just_weather?rev=1247286745&amp;do=diff"/>
        <published>2009-07-11T00:32:25-04:00</published>
        <updated>2009-07-11T00:32:25-04:00</updated>
        <id>http://polibyte.com/code/just_weather?rev=1247286745&amp;do=diff</id>
        <summary>This program creates a weather page inspired by the now-defunct simpleweather.com. It depends on Yahoo's weather API, which is only available for non-commercial use. The perl program expects a zip code as input.


#!/usr/bin/env perl

use strict;
use warnings;
use LWP::Simple;
use XML::LibXML;
use XML::LibXSLT;

my $delay = 60 * 1;
my $path = &quot;$ARGV[0].html&quot;;
my $url = &quot;http://weather.yahooapis.com/forecastrss?p=$ARGV[0]&quot;;

if (-e $path) {
  my @stats = stat($path);
  if (time -$stats[9] &lt; $dela…</summary>
    </entry>
    <entry>
        <title>code:last_day</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/last_day?rev=1247287899&amp;do=diff"/>
        <published>2009-07-11T00:51:39-04:00</published>
        <updated>2009-07-11T00:51:39-04:00</updated>
        <id>http://polibyte.com/code/last_day?rev=1247287899&amp;do=diff</id>
        <summary>A simple wrapper script that executes a command only on the last day of the month. The success or failure of the command is logged.


#!/usr/bin/env/ruby

# Sample usage: lastday &quot;echo pay your rent&quot;

require 'date'
require 'syslog'

# reopen Date class to add new instance method
class Date
  def last_day_of_the_month?
    da = self
    (da += 1).month == self.month ? false : true
  end
end

if Date.today.last_day_of_the_month?
  log = Syslog.open(&quot;lastday&quot;)  
  ARGV.each do |arg|
    if system(…</summary>
    </entry>
    <entry>
        <title>code:wordpress_ppf</title>
        <link rel="alternate" type="text/html" href="http://polibyte.com/code/wordpress_ppf?rev=1247611536&amp;do=diff"/>
        <published>2009-07-14T18:45:36-04:00</published>
        <updated>2009-07-14T18:45:36-04:00</updated>
        <id>http://polibyte.com/code/wordpress_ppf?rev=1247611536&amp;do=diff</id>
        <summary>This is a plugin for Wordpress. It allows you to specify the number of posts you want returned as part of an rss or atom feed. I found the post_limits filter by using Xdebug to trace Wordpress. The development of this plugin was funded by IEHI.


&lt;?php
/*
Plugin Name: ppf
Plugin URI: http://polibyte.com
Description: Change the number of posts retrived in an feed by setting ppf in the query string. -1 will return all posts. A positive number will return that number of posts. E.G. http://foo.com/?…</summary>
    </entry>
</feed>
