March 4, 2008 at 9:54 pm
· Filed under AcmeCal, Open source (english)
Finally. With notification implemented I’m able to release the latest and greatest of AcmeCal. At the moment AcmeCal can do notification by either mail or XMPP (aka. Jabber). Still some polishing to do, like having the XMPP plugin test for presence before notifying.
Having notification implemeted makes it even more clear that I need to improve the argument handling code. At the moment I’m using this in my crontab: acmecal-notify –type XMPP –from “$(date +”%F %R”)” –to “$(date -d “now + 30 min” +”%F %R”)”
This version also brings AcmeCal right at the 1 KLoC-mark and it is now my primary calendar.
Download AcmeCal version 0.3 - hey, it works this time
Permalink
February 26, 2008 at 9:27 pm
· Filed under AcmeCal, Open source (english)
Just a minor update on AcmeCal. The new feature is the Import/Export frameworks. At the moment I can export to an YAML stream of the internal representation and import from the same YAML string or from a subset of the iCal standard. At the moment no unfolding of recurrent events take place. Calling it a framework might be a bit of a stretch but support for other formats should be as easi as handling these formats.
To prove that everything is to be considered unstable I renamed the scripts from acme-(\w+)cal to acmecal-$1.
Download AcmeCal version 0.2
Permalink
February 21, 2008 at 8:33 am
· Filed under AcmeCal, Open source (english)
What do you do when you suddenly get a free evening? Writing a calendar system seemed the obvious thing to do. Neither Google Calendar nor flat unstructured text files seemed to fit my needs. So I proudly present: AcmeCal version 0.1.
The main novelties includes:
- Usability: combines the two greatest user interfaces: CLI commands and $EDITOR
- Simplicity: everything is optional but the start time of an event.
- Scriptability: it is just a couple of simple perl modules
- Readability: events is formatted with YAML
And all that in just under 400 lines of code. As of version 0.1 some important features remains to be implemented, for example documentation.
Warning: Neither the comand line interface, nor the perl API, nor plutonium is stable.
Download AcmeCal -0.1
Permalink
October 15, 2007 at 10:34 am
· Filed under Open source (english)
Mike Hommey explains how to get VCS information in his bash prompt. Cool idea but not quite the way I like it, so I did a few more iterations…
The main problem is that it doesn’t play nice with symlinks. I often find myself making a large checkout of a the full project and then have symlinks to the parts I’m working with.
Minor details is that I don’t like having a bold font in my prompt, I don’t care about the URI-part of the prompt, and I’m only using Subversion. So my quick 5 minutes hack: (See Mike’s blog for the explanations)
# Fancy svn enabled PROMPT
__vcs_dir() {
local vcs base_dir sub_dir ref get_dir
get_dir() {
( cd $1
echo ${PWD} )
}
sub_dir() {
local sub_dir
sub_dir=${PWD}
sub_dir=${sub_dir#$1}
echo ${sub_dir#/}
}
svn_dir() {
[ -d ".svn" ] || return 1
base_dir=$PWD
while [ -d "$(get_dir $base_dir/..)/.svn" ]; do base_dir=$(get_dir “$base_dir/../”); done
sub_dir=$(sub_dir “${base_dir}”)
ref=$(svn info “$(readlink -f $base_dir)” | awk ‘/^Revision/ { sub(”[^0-9]*”,”",$0); print “rev:”$0 }’)
vcs=”svn”
}
svn_dir ||
base_dir=”$PWD”
echo “${base_dir/$HOME/~}${vcs:+[$ref]}${sub_dir}”
}
PS1=’\u@\h:$(__vcs_dir)\$ ‘
Permalink
September 14, 2007 at 3:50 pm
· Filed under Open source (english)
Ok, just going to do something scary:
$_=pack"C*",33..86;$o='NRCRIMGZLLLCXZBCVUIOR';$o=~s/./chr((ord($&)-13-&f)%26+97)
/eg;$_=$o;s/r/r /;s/l/l /;sub v{$v=ord(substr($_,pop))-32;$v>53?53:$v}s/p/P/;sub
f{s/U$/U$`/;s/U(.)/$1U/;s/V$/V$`/;s/V(.)/$1V/;s/(.*)V$/V$1/;s/V(.)/$1V/;s/(.*)([
UV].*[UV])(.*)/$3$2$1/x;$c=v 53;s/(.{$c})(.*)(.)/$2$1$3/;(v v)>52?&f:v v}s/t/t /
;print”\\u$_,\\n”;[substr qr/(.*)([UV].*[UV])(.*)/i,qw(Just another Perl hacker,)]
and now back to the regular schedule….
Permalink
August 29, 2007 at 11:27 am
· Filed under Open source (english)
While SPF seems to be among the currently used technologies for spam protection, SRS looks rather dead. But forwarding mail breaks SPF without workarounds. So what is the best current practice?
- Completly ignore the existence of SPF
- Implement SPF but just implement forwarding “the old way”
- Inform you users that forwarding breaks SPF and they have to whitelist you mail server
- Implement SRS (but keep it a secret)
The forwarding part of SRS is rather simple, but I havn’t found any clear way to implement the actual handling of bounces. It wouldn’t be hard to hack some usage of Mail::SRS onto postfix but there doesn’t seem to be an off the shelves solution?
Permalink
August 21, 2007 at 7:47 pm
· Filed under Open source (english)
Watching the popular Inbox Zero video would probally improve my email handling skills better. But this took less time and I wanted to play around with Net::XMPP;
#!/usr/bin/perl -l
use warnings;
use strict;
use Config::Simple;
use Linux::Inotify2;
use Email::Abstract;
use Net::XMPP; # aka Jabber and Gtalk
use POSIX;
my $DEBUG = 0;
our %config;
Config::Simple->import_from("$ENV{HOME}/.mailnotifyrc", \%config);
deamonize() unless $DEBUG;
my $inotify = new Linux::Inotify2
or die "Unable to create new inotify object: $!";
# Different Maildir implementations triggers different events"
# IN_MOVED_TO: rename("tmp/file","new/file")
# IN_CREATE: link("tmp/file", "new/file") && unlink("tmp/file")
#
# At this point the file should be written and closed.
$inotify->watch("$config{Maildir}/new", IN_MOVED_TO|IN_CREATE, sub {
my $e = shift;
my ($fh, $xmpp, $email, $message);
debug('Got event for ' . $e->fullname);
open $fh, "<", $e->fullname;
$email = new Email::Abstract join("", <$fh>);
close $fh;
$message = 'Mail from ' . $email->get_header('From') .
' concerning "' . $email->get_header('Subject') .'"';
debug("Getting ready to send [$message]“);
my $sender = new Net::XMPP::JID ($config{Sender});
my $receiver = new Net::XMPP::JID ($config{Receiver});
$xmpp = new Net::XMPP::Client();
$xmpp->Connect( hostname => $sender->GetServer,
port => $config{port} || 5222,
tls => $config{usetls} || 0,
);
$xmpp->AuthSend( username => $sender->GetUserID,
password => $config{password},
resource => $sender->GetResource || ‘mailnotify’,
);
$xmpp->MessageSend( to => $receiver,
type => $config{MessageType} || ‘chat’,
body => $message,
);
$xmpp->Process(1);
$xmpp->Disconnect;
debug(”Event done”);
});
1 while $inotify->poll;
sub deamonize {
my $pid = fork();
if ($pid) {
exit 0;
}
### close all input/output and separate
### from the parent process group
open STDIN, ‘</dev/null’ or die “Can’t open STDIN from /dev/null: [$!]\n”;
open STDOUT, ‘>/dev/null’ or die “Can’t open STDOUT to /dev/null: [$!]\n”;
open STDERR, ‘>&STDOUT’ or die “Can’t open STDERR to STDOUT: [$!]\n”;
### Change to root dir to avoid locking a mounted file system
### does this mean to be chroot ?
chdir ‘/’ or die “Can’t chdir to \”/\”: [$!]“;
### Turn process into session leader, and ensure no controlling terminal
POSIX::setsid();
}
sub debug { return unless $DEBUG; print STDERR for @_; }
__END__
Permalink
August 18, 2007 at 9:04 pm
· Filed under Open source (english)
While testing Debian Live I suddenly discovered that something had installed a library in my home directory: ~/cbt/lib/libcbtsysinfo_0.so.
Google gives two hints: Some discussion on the danish usenet group dk.edb.mac and some discussion on debian-user.
It looks like it get installed when I log into my internet bank. By lookin at the symbols extracted by objdump (a couple of symbols stating with Java_com_ibm_cbt_slight_CbtSysInfo) it seems to be IBM’s Crypto-base Transaction system.
Evil to install such thing without asking. (Well, it’s a Linux/x86 library even though I’m using Linux/PPC)
Permalink
August 8, 2007 at 11:08 am
· Filed under Open source (english)
Russel Cooker asks two questions to free software Contributors. Here is my answers:
The most important advice I can give to someone who wants to contribute to the free software community is “Take it easy, it’s only software”. If you’re not able to take criticism or to be drawn into tough discussions without taking it personal, you should consider if it it worth it to contribute. Most free software project have their part of to big egos, regular kooks and people with less than good communication skills. And worst of all, nor really good way of coercing people to behave or work together.
My own advantage of participationg in open source projects is the famous itch. For me the most convincing argument for working with open source is “Scratching you own itch while being lazy and not reinvent everything else.” If you dn’t have that itch, then you shouldn’t care about joining a project.
Permalink
July 9, 2007 at 10:31 am
· Filed under Open source (english), Syre
Some random perl code I threw together:
use Data::Dumper;
use List::Util (reduce);
@p = (580, 420, 355, 335, 275, 215);
$target = 1505;
$A[0] = [0, [], 0];
foreach $i (1 .. $target) {
my @tmp;
foreach $a (@A) {
next unless defined($a);
push @tmp, [$a->[0], $a->[1], $i];
push @tmp, [$a->[0] + $_, [@{$a->[1]}, $_], $i] foreach (@p);
}
@tmp = grep({$_->[0] == $i;} @tmp);
# ok, prefer the shortes solution for no other reason
# than 7 times mixed fruit is so boring.
$A[$i] = reduce { if ($a->[0] == $b->[0]) {
@{$a->[1]} < @{$b->[1]} ? $a : $b
} else {
$a->[0] > $b->[0] ? $a : $b
}
} @tmp;
}
print Dumper($A[$target]);
Mixed fruit? You probally have to read this xkcd strip
Update: Changing the grep statement from testing for less than or equal to strict equality seems to be about 30 times faster with the same result.
Permalink