This script below will accept a URL parameter, download the HTML, convert it to a .mobi file with kindlegen, and copy the file onto your Kindle.
Rlib is a report writing engine that takes report specifications in an XML language. It emits reports in several formats including HTML and PDF.
I stumbled across RLIB while figuring out how to implement some MS Access report writing features in PHP. MSA users will know what writing a report is, but PHP coders probably don't, so I'll explain.
This was an odd project. Taking several PDFs of layoff data and turning them into text, so they might be used more like a database. This info should be offered up by the state as a database, but it's not (at least it wasn't to me). I ended up using a PDF to Text application to generate text files, then wrote these scripts to scrape the data out of the text. My goal was to dig up all the unionized workplaces.
This script is being used to move files around in a Maildir. A bunch of spam goes into the "new" directory.
If you're cheap and have a low-end, generic MP3 player that will also display text files, you can read your RSS feeds on it with the help of this script.
In the last entry, log lines were being "compressed" by placing them into a database table. There were a few bugs in that code that have been fixed, and features added to the new script, below, that save us from losing some log data. Explanation after the code:
Network traffic was growing, and it was getting hard to really "see" what was sucking up the capacity. It could be spam, or YouTube, viruses, hack attempts, or anything.
This is a script that takes an RSS URL as an argument, and emits the headlines. Potentially useful if you have a small text-reading device that doesn't handle HTML.
#! /usr/bin/perl Sometimes, you have textual data, like log files, with IP addresses. You sometimes want this data to show hostnames instead.
Perl still rocks. People still say it's hard to read (true), but it's because the language is terse.
sub getAccountIdsOfSitesToSuspend
{
$sql = <<EOQ;
SELECT account_id
FROM account
WHERE
account.account_balance < (SELECT triggerAmount FROM fk_suspension_rules)
AND (
SELECT IF(SUM(transaction_ammount), SUM(transaction_ammount), 0)
FROM transaction
WHERE transaction_date > DATE_SUB( CURDATE(),
INTERVAL (SELECT paymentWindow FROM fk_suspension_rules) DAY)
AND transaction.account_id = account.account_id Here's a perl script that takes email addresses as arguments, and returns javascript code that hides your email address from web spiders. The email address is also linked so it's clickable.
#! /usr/bin/perl
foreach my $email (@ARGV) {
$email =~ s/@/ @ /;
$email =~ s/\./ . /;
@parts = split( ' ', $email );
print "\n";
print "document.write('');";
foreach my $word (@parts) {
print "document.write('".$word."');\n";
}
print "document.write('');\n";
print "\n\n";
} Vim has a couple features to make it easy to read C (and PHP and Perl) code.
First is the "go to file" feature. If you move the cursor onto a file name, and type gf, you'll be taken to that file. To return to the previous file, press Control-o. The file opens are kept on a stack, so you can drill down into file, and climb back out. This is useful for reading code with "includes".
This is a Perl version of the VB FileMirror class shown earlier on this site. The class helps you write scripts to (semi) safely mirror or move a file system from one directory to another. It does this by building the correct destination paths, making destination directories, and deleting files only after they appear to have been copied over.
Docs are in FileMirror.txt, attached.
DriveGMover.pl is a script that uses the class.
This is a repository of "novice" articles, written with the intent of driving more traffic to the site, and getting more ad clicks. It's pretty crass, I know, but the information may be very useful.