Livejournal autoposting

People always seem semi-surprised that I autopost in some journals and communities. I do it because I’m forgetful and compulsive. Anyhow, should you feel the same need, here’s how I’m doing it.

Also, note, portions of this code were wrote by Emmie P. Lewis. Don’t who she/he is, but thanks for sharing, so now I’m doing the same.

[root@localhost root]# cat /dancron/

# How to send email with Net::SMTP
# Copyright 2000, Emmie P. Lewis
# Created 02/20/00
# This script is designed to show
# how to use Net::SMTP to send
# email from a Perl script.
# Modified by Daniel J. Doughty <daniel.j.##**!!>
# Now it sends a post to via Emmie’s code.
# Modified early 2005

use Net::SMTP;
use Getopt::Std;

# WARNING. This is a hardcoded value. You can tell I meant to catch it via a flag, but haven’t implemented it. Feel free to fix or hardcode your own community here.
$opt_c = “some_community_name”;


#debugging stuff
#print $opt_s;
#print $opt_b;
#print $opt_i;

chomp $opt_c;
#print $opt_c;

#print “Content-type: text/plain”, “\n\n”;

# This debug flag will print debugging code to your browser,
# depending on its value
# Set this to 1 to send debug code to your browser.
# Set it to 0 to turn it off.

my $DEBUG = 0;

$| = 1;
open(STDERR, “>&STDOUT”);

# Another hard-coded value.
# Set this variable to your smtp server name
my $ServerName = “”;

# Create a new SMTP object
# This is the debug option
#$smtp = Net::SMTP->new($ServerName, Debug => 1);
$smtp = Net::SMTP->new($ServerName, Debug => 0);

# If you can’t connect, don’t proceed with the rest of the script
die “Couldn’t connect to server” unless $smtp;

# Initiate the mail transaction
# Your “real” email address
# Another hard-coded value
my $MailFrom = “yourname\”;

# Recipient’s “real” email address, yup, you guessed it. Hard-coded. AND PAY REAL CLOSE ATTENTION HERE. REPLACE THE 1234 WITH YOUR OWN PIN THAT YOU SET UP AT LIVEJOURNAL.COM
my $MailTo = “someljname.$opt_c+1234\”;

$smtp->mail( $MailFrom );
$smtp->to( $MailTo );

# Start the mail

# Send the header
# This address will appear in the message
# Same as the note above. I don’t know why this is repeated. She did it, not me.
$smtp->datasend(“To: someusername.$opt_c+1234\\n”);

# So will this one
$smtp->datasend(“From: someemailname\\n”);
$smtp->datasend(“Subject: $opt_s\n”);
$smtp->datasend(“lj-userpic: $opt_i\n”);

# Send the body.

# Send the termination string
$smtp->dataend() ;

# Close the connection

Here’s the crontab entry I use to call it. It accepts 3 flags, -s for subject, -b for the body and -i for the image to post with. This image tag must already be uploaded and named correctly. If you post the wrong image name, it will just use your default image, if you have one.

29 17 */7 4-9 * /dancron/ -s “SUBJECT” -b “Body of text” -i “can’t remember what this flag is for”

$40 camera at wal-mart?

bad idea. but here’s how I came to decide to buy it.

I shopped on I was hoping that they had fixed the most annoying thing about That you can’t find out what something would cost in the store, or if it’s in stock.

So anyhow, I found they had a 4MP Elph on the web for $250. That’s not a bad deal. Plus it included free shipping to the local store. So I go to the store. They don’t have it. They have the 3MP Elph for $280. I asked for a price check, hoping that it would be less than $250. Nope, it’s $280. Stupid wal-mart. So I buy the cheapest camera they’ve got, figuring I’ll just return the POS if it doesn’t work out.

Yeah, so I’ll be returning it in short order.  Because it was awful.