Puoli
vuotta sitten listasin hyviä ohjelmia Nokia N9:lle. N9 kehittyy ja
lisää ohjelmia putkahtelee joka tuutista, joten tässä päivitystä, eli
tämän hetken kuumat N9-ohjelmat.
- Qneptunea. Tosi
hyvä Twitter-ohjelma. Hyvän hintainen myös ovikaupassa (10 euroa). Saa
ilmaiseksi projektin sivuilta jos haluaa, mutta suosittelen maksamaan,
sen verran onnistunut ohjelma kyseessä.
- Sophie
Cam. Efektejä kuviin. Kivasti 60-lukua tarjolla.
- QuickBeer. Kaljottelu
on pop. QuickBeer listaa hyvä oluet ja tarjoaa viivakoodinlukijan
oluen ystävien avuksi.
- A Nice
Cuppa. Periaatteessa ohjelma mittaa teen kypsymysaikaa (tms.),
mutta toimii erittäin hyvin myös kaikelle muulle. Pitsa 13 minuuttia,
ranskalaiset 20.
- Alkoon. Kompassi
lähimpään alkoon sekä tiedot aukioloajoista.
- Pinkit. Oma ohjelma, joka listaa
työpaikalle sopimattomia kuvia suoraan reddit-sijoituksen mukaan, Panoptikos-sivuston
hengessä.
- Mosh. Lagittomat SSH-sessiot
mobiiliverkossa. Vaatii jonkin verran säätämistä, mutta on sen
arvoista.
Jos ylläoleva lista ei miellytä tai se ei tunnu muuten vaan
kattavalta, niin pari hyvää N9-ohjelmia listaavaa sivustoa löytyy
Internetistä: N9 Apps ja My-MeeGo.
Some time ago I wrote superb Jabber/XMPP
client based on the ideas of even more superb IRC client ii. I named the client jj and put the source code to github. Since
then me and my friends have been using jj for our Jabber MUC
(multiuser chat room, something like channel in IRC). And it has been
serving us nicely.
Our jj bot resolves URL titles and aggregates Twitter, Google Plus
and some RSS feeds to our MUC. The process how this is done is quite
easy. Jj has outfile and input FIFO for each channel it sits on. The
bot functionality can be distinguished into two different tasks: 1)
reacting to input and 2) cron jobs:
URL resolving is done by reacting to what input is coming
in. There is one shell script that listens our mucs outfile with
inotify. When it gets notified that something is said on the MUC it
will inspect the line. If it finds URL on that line, it will call the
title resolver and write the resolved title to the MUC in file.
Here is pseudo bash for it (external tools fecho and gettitle.py
are used), note also that I divided the long greps to multiple lines
without testing the code:
nickname="botbot"
outfile="jabber.tld/mucs/conf@conference.jabber.tld/out"
infile="jabber.tld/mucs/conf@conference.jabber.tld/in"
while true; do
inotifywait -e modify $outfile
line=$(tail -1 "$outfile" |\
grep -v "^[0-9][0-9][0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]\
[0-9][0-9]:[0-9][0-99][0-9] <$nickname>" |\
grep "^[0-9][0-9]"|\
grep -v "[0-9] -\!-" |\
tac|\
grep -m 1 -i -E "https?://")
if [ ! -z "$line" ]; then
url=$(echo "$line"| grep -o -i -E "https?://.*" | cut -d" " -f1)
title=$(echo "$url" | gettitle.py)
fecho "$title" $infile
fi
done
Basically this can be used for any kind of reaction tasks. For
example for the classic sed like line "s/from/to".
- Feeds (Twitter, Google Plus, RSS etc.) are done with cron
jobs. Here is pseudo bash example for that (it uses external tools
feedcheck and fecho):
feedlist=$(cat <<EOF
http://twitter.com/statuses/user_timeline/petteri_.rss
http://github.com/petteri.atom
http://23.fi/blogi/feed
EOF
)
# Set IFS to newline only. See BASH(1) manpage for details on IFS.
IFS=$'\n'
for feed in $feedlist; do
for x in $(feedcheck $feed); do
fecho "$x" jabber.tld/mucs/conf@conference.jabber.tld/in
sleep 5
done
done
Sadly I had to write the external tools fecho, gettitle.py and
feedcheck, since there we no proper ones available. Fecho is already
in jj source code repository, but the other ones are not yet. For fecho
source see here.
Hopefully these examples will illustrate how to make jj bots. I
will try to polish the instructions later and add these to jj source
code repository as examples.