Skip to content
jgoerzen edited this page Sep 14, 2010 · 3 revisions

HOWTOs

Here is some information on doing some things with Twidge.

Scheduling

Posting updates in the future

Use twidge with the standard command at:

at 22:00
at> twidge update "Hey, it's 10PM"
at> Ctrl-D

at will fire off twidge at 22:00 and run that command. Easy, eh?

lsrecent width tied to terminal

Try:

twidge lsrecent -w `tput cols`

Email

Sending Yourself An Email For Updates

Maybe you’d like to get a message whenever someone replies to you, or whenever one of the people you follow post an update. Here’s how to do it.

First, I’d suggest making a script. Let’s call it twidge.cron, and let’s put this in it:

#!/bin/sh
twidge lsrecent -asu -m [email protected]
twidge lsreplies -asu -m [email protected]

Now, edit your crontab with

crontab -e
. Say you want to run this twice an hour. Add this line:
0,30 * * * * /path/to/twidge.cron

Posting Emails As Updates

You can also go the other way: you can send an email to a special address, and twidge can post it on twitter.

You’ll need to establish an email address to receive these posts, and arrange to get the messages there to twidge. Unix/Linux users typically use procmail or maildrop to get that mail to twidge.

One nice feature that your system administrator can enable is address extensions. A certain character, usually the plus sign, can separate the username from the extension. So, say, [email protected] will cause email to be delivered to username, and “foo” is the extension that you can filter on.

We’ll use “twidgepost” here as the extension. I recommend you pick something unguessable; if anybody can guess this address, they can post updates as if they were you!

But, by far the simplest way, is to just set up a dedicated email address for this stuff and use twidge in your .forward.

Configuring your mail server

First, you’ve got to configure your mail server to pass along the extension. Here are some tips for various mail servers:

How exactly you get the extension to your filtering program will vary by mail server and configuration.

Configuring maildrop

Let’s say that I have a header X-Extension to match on, added by your MTA. I’d say this:

if (/^X-Extension: twidgepost/)
  to "|twidge update -r"

Configuring procmail

I don’t use it, but it should be doable ;-)

Replies

If you are using the above tips for sending updates to you by email, you can use your mailer’s reply button to post replies. Set mailfrom in [DEFAULT] in ~/.twidgerc to be the address where you’re receiving the posts. Then just make sure that you reply without quoting.

Other

Set the address to plain text, no MIME, signatures, or attachments.

Interactive Use

Quick Check of New Stuff

Here’s an easy way:

(twidge lsrecent -su; twidge lsreplies -su) | less

Once you’ve done this once, you could also do this:

(twidge lsrecent -asu; twidge lsreplies -asu) | less

Like that? Then save some typing and add this to your ~/.bashrc (or appropriate file):

alias twidgecheck='(twidge lsrecent -asu; twidge lsreplies -asu) | less'

Now you can just type twidgecheck to see all new traffic. Slick, eh?

Posting to Twitter and Identica

You can do that with two separate config files. You can select them with -c. You can make a simple shell script to post to both places:

#!/bin/bash
twidge -c ~/.twidge-twitter update "$1"
twidge -c ~/.twidge-identica update "$1"

Save it as twidge-updateboth. chmod a+x twidge-updateboth and put it someplace on your PATH.

Now, you can run something like:

twidge-updateboth "At home, cooking dinner."

and it will be posted to both sites.

See the FAQ for info on setting up Twidge with identica.

Fancy twidge-update

This variant of the twidge-update script reads a line from stdin [which avoids accidentally posting the same message twice by hitting the up arrow in your console], gives a tweet length guide, and updates both Twitter and Identi.ca.

#!/bin/bash
echo "---------|---------|---------|---------|--------=|=--------|---------|---------|---------|--------=|=--------|---------|---------|---------|"
read TXT
twidge -c ${HOME}/.twidge-twitter update "${TXT}" 
twidge -c ${HOME}/.twidge-identica update "${TXT}"