Introduction
Introduction Statistics Contact Development Disclaimer Help
----------------------------------------
twtxt
November 30th, 2017
----------------------------------------
I finally got around to setting up twtxt! [0]
I didn't install the utility yet. I was more concerned with
writing microblogs than reading them for now. I knew I wanted to
host it on my sdf site, which is hosted on meta (ma.sdf.org).
I also knew I wanted to be able to author the microblog from any
of my servers. It's not as robust as the phlog, so I shouldn't
need to log in somewhere specific with a bunch of environment
variables or scripts or anything. Here's what I've got:
#!/usr/bin/env bash
twt(){
local TWTXT=${TWTXT:-"/meta/www/t/tomasino/twtxt.txt"}
if [ $# -eq 0 ]; then
read -ep 'Message: ' input
if [ ! -z "$input" ]; then
echo -e "`date -Im`\t$input" >> "$TWTXT"
else
echo "No message. Abort."
fi
else
echo -e "`date -Im`\t$@" >> "$TWTXT"
fi
}
meta="ma.sdf.org"
host=$(hostname)
if [ $host != $meta ]; then
ssh -t [email protected] twt "$@"
else
twt "$@"
fi
It's not super clean or polished, but it works. If I'm not on
meta, it ssh's to ma silently and runs the twt script on the right
server. I can either 1-line it or I can just run the command and
have it prompt me for my message. Then it's a simple append to the
file with the datestamp and done.
I guess I'll link it on the phlog? I'll have to figure out what
I want to do about reading other people's twtxt's too. I think
I need to write my own phlog aggregator before that, though.
[0] tomasino's twtxt
You are viewing proxied material from gopher.black. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.