Voder-Vocoder

The Log of Hal Canary

Navigation: Home | THE LOG | Log Archives | Resume | Contact Info | Public Key | SSL | Math Applets | Site Map | WP Backend | RSS2 | Atom

Archive for 2006-09

Next Entries »

txt2html

#!/bin/sed -f
#DTPD#
#txt2html Cleans up HTML control characters <.",&,>
s/\&/\&amp;/g;
s/\"/\&quot;/g;
s/</\&lt;/g;
s/>/\&gt;/g;
s/\\/\&\#0092;/g;

Hal Canary | Computers & Code | 2006-09-11 15:44:34 EDT
Permanent Link | Comments Off

another funny html thingy: blockquote

Good html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title></title></head><body>
<div>
<blockquote>
<div>
X
</div>
</blockquote>
</div>
</body></html>

Bad html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title></title></head><body>
<div>
<blockquote>
X
</blockquote>
</div>
</body></html>

Check it yourself.

Hal Canary | Computers & Code | 2006-09-11 15:35:53 EDT
Permanent Link | Comments Off

Possibly a medusa.

Dean: THEY’RE HERE!!

Hank: Dude, sit down! We have to play it cool. Observe how I scope out my mystery date whilst I pretend to look at my watch- Holy moley, look at my date! She’s a super villain! Possibly a medusa. Dean, I am not kidding. She has rope for hair and a shiny costume! Aw, not fair, she’s wearing goggles! Told ya she would dig my Batman suit, but no!

Hal Canary | TV | 2006-09-09 20:46:30 EDT
Permanent Link | Comments Off

lpr-text for CUPS

If you are using CUPS for your printing, there is no reason to continue using Enscript.

#!/bin/sh
#DTPD#
# http://cups.org/documentation.php/options.html
# ~/bin/lpr-2col-text
exec lpr -o page-left=36 \
        -o page-right=36 \
        -o page-top=72 \
        -o page-bottom=36 \
        -o columns=2 \
        -o landscape \
        -o cpi=16.842 \
        -o lpi=10.1052 "$@"
# 80 columns width x 70 columns high x 2 columns

That’s about 140 80-character lines per page, in two columns. Somewhat analagous to “enscript -2r -B”. I leave room at the left margin for hole-punches, to make binding easier.

In theory, this should handle Unicode characters much better than enscript or a2ps does. If you are still having issues with unicode printing, try “ooffice - file”.

Here’s the one-column version:

#!/bin/sh
#DTPD#
# http://cups.org/documentation.php/options.html
# ~/bin/lpr-1col-text
exec lpr -o page-left=72 \
        -o page-right=36 \
        -o page-top=36 \
        -o page-bottom=36 \
        -o cpi=11.43 -o lpi=6.858 "$@"
# 80 columns width x 68 columns high

Hal Canary | Computers & Code | 2006-09-08 09:52:37 EDT
Permanent Link | Comments Off

the library again?

I read Blind Lake today. New hypothesis: RCW does not write bad books.

Hal Canary | Books | 2006-09-05 19:23:19 EDT
Permanent Link | Comments Off

otpasswd

#!/usr/bin/perl
## otpasswd --- One Time Passwd
## Generate a random password unsuitable
## for memorization.
## Example output: 2HPxfca3W2tDAPPrhFw8
## Copyright 2006 Hal Canary
## DTPD (Dedicated to the Public Domain)
use strict;
use warnings;
foreach my $x (0 .. 19) {
	my $num = int(rand(62));
	if ($num < 10) {
		$num += 48;
	} elsif ($num < 36) {
		$num += (65-10);
	} else {
		$num += (97-36);
	}
	printf("%c",$num);
}
print "\n";

Hal Canary | Computers & Code | 2006-09-03 12:57:58 EDT
Permanent Link | Comments Off

Next Entries »

Copyright 1997-2007 by Hal Canary.
mailto: h3 at halcanary dot org
xmpp:halcanary@jabber.org
aim:halwcanary
http://halcanary.org