Monthly Archives: December 2009

uzbl follow.js: link following with settable keys

EDIT: this script is no longer up-to-date and won’t work with the current version of uzbl.

This is a diff to current follow_Numbers.js. The new script, which I called follow.js, is more versatile, since the characters used for labels and key navigation can be set using the hintKeys variable.

<  * Its pretty stable, only using numbers to navigate.
> //This string should be 10 characters long. Play around!
> var hintKeys = 'asdfghjkl;';
< //Make onlick-links "clickable"
> //Make onclick-links "clickable"
> //Map 0123456789 to hintKeys
> function mapNumToHintKeys(label) {
>     label = label + '';
>     for (var j = 0; j < label.length; j++) {
>     var pos = parseInt(label[j]);
>     label = label.replace(label[j], hintKeys[pos]);
>     }
>     return label;
> }
> //Map hintKeys to 0123456789
> function mapHintKeysToNum(label) {
>     label = label + '';
>     for (var j = 0; j < label.length; j++) {
>     var pos =[j]);
>     if (pos < 0 || pos > 9) return;  // bad input, key not in hintKeys
>     label = label.replace(label[j], pos+'');
>     }
>     return parseInt(label);
> }
<     var linknr = parseInt(follow, 10);
>     var linknr = mapHintKeysToNum(follow);
>         label = mapNumToHintKeys(label);


Exim 4.69 (or 4.71) ACL for SpamAssassin

I was having trouble with Exim not adding headers to SpamAssassin-checked emails. One day, when I should have really been doing something else, I read Chapter 40 of Exim’s specification, and all became clear.

Here’s what my appropriate ACL (in /etc/mail/exim.conf) looks now, almost completely by-the-book:

  # ...
  # malware section
  # ...
  # Add headers to a message if it is judged to be spam. Before enabling this,
  # you must install SpamAssassin. You may also need to set the spamd_address  
  # option above.
  # spams are never big and spamassassin can die on big emails, so we  
  # limit its use under 100kb  
  accept  condition = ${if >={$message_size}{100k}{yes}{no}}

  # put headers in all messages (no matter if spam or not)
  warn  spam = spamd:true
        add_header = X-Spam-Score: $spam_score ($spam_bar)
        add_header = X-Spam-Report: $spam_report
  # add second subject line with *SPAM* marker when message
  # is over threshold
  warn  spam = spamd
        add_header = Subject: *SPAM* $h_Subject:

  # reject spam at high scores (> 20)
  deny  message = This message scored $spam_score spam points.
        spam = spamd:true
        condition = ${if >{$spam_score_int}{200}{1}{0}}

  # Accept the message.

Emacs with Tramp using zsh

First off, I recommend reading the relevant parts of the user manual, you might find the answer there.

Now, to the issue.

I installed tramp and added this to ~/.emacs:

(require 'tramp)
(setq tramp-default-method "scp")

Nothing special here, except it didn’t work. (The message was something like “waiting 60s for local shell”. Of course, I didn’t write it down, and it got lost in the browsing cache.)

So I turned on more verbose debugging, in ~/.emacs also:

(setq tramp-debug-buffer t)
(setq tramp-verbose 10)

The “logs”, mind you, are written into buffers: *debug/scp remotehost* are the messages and *tramp/scp remotehost* is the medium-rare (as compared to raw) data received.

If you open the latter and see characters like ^]]C4 or ^M, then it might be due to the shell prompt setting on the remote host. The manual advises wisely as to what should be considered.

One solution found floating on the internets is checking for the terminal type. Add this to the remote host’s .zshenv:

if [ "$TERM" = "dumb" ]
unsetopt zle
unsetopt prompt_cr
unsetopt prompt_subst
# unfunction precmd # these two are not
# unfunction preexec # working for me
PS1='$ '

Also, make sure you’re not re-setting it somewhere else later, say .zshrc. A check should be enough even if you do:

if [ "$TERM" != "dumb" ]; then
# Set prompts
PROMPT='%m%# '