Blocking some DIV ad boxes with Privoxy

November 10, 2009 by thandle

If you want to block one of those shiny-ass ads (think workplace sanitation), here’s a few simple one-liners. (Everything’s in /etc/privoxy.)

user.filter:
FILTER: div-ads DIV ad blocks.
s/<div id="banner_box"/<div id="crap" style="display:none;"/g

user.action:
{ +filter{div-ads} }
.

Don’t forget to uncomment that actionsfile user.action from your config file.

Info lifted from here.

Samsung ML-2015 with CUPS 1.4 on Arch Linux

October 27, 2009 by thandle

As you might know (yeah, right), I am a proud owner of a Samsung ML-2015 laser printer, this paper-munching, smoke-exhausting hellish machine (which is, in fact, an ML-2010 re-branded for the russian and post-soviet states, so that Samsung can provide localised support).

Updating to CUPS 1.4 on Arch Linux kind of broke the printer. It’s still visible in the CUPS interface, but doesn’t print anything (the jobs are on hold, “waiting for the printer to become available”). The kernel is 2.6.31.4, usblp module disabled as per Arch newsfeed suggestion.

The solution was simple – getting to the “Printers” tab in the web interface and modifying the printer to use a different connection (the one without “usb://”).

How to determine raw (unmounted) disk file system type

October 5, 2009 by thandle

sudo fdisk -ls

Analog Devices AD1984A (snd-hda-intel) on HP 6730s, Arch Linux

October 4, 2009 by thandle

Here’s a great table for all your snd-hda-intel needs: Ubuntu Wiki audio_intel_da.

Making a GRUB boot floppy

September 20, 2009 by thandle

mkfs -V -t msdos /dev/fd0
mount /dev/fd0 /media/floppy
cd /media/floppy
mkdir boot
mkdir boot/grub
cp -pa /boot/grub/* /media/floppy/boot/grub
umount /media/floppy
/sbin/grub --batch --device-map=/dev/null <<EOF
device (fd0) /dev/fd0
root (fd0)
setup (fd0)
quit
EOF

Lifted from Linux-SXS and GNU Hurd FAQ.

Kiddies playing

September 17, 2009 by thandle

Here’s what exim caught:

> 2009-09-15 23:59:31 SMTP protocol synchronization error (input sent without waiting for greeting):
+rejected connection from H=[220.139.127.112] input="GET http://www.scanproxy.com:80/p-25.html
+HTTP/1.0\r\nContent-Type: text/html\r\nProxy-Connection: keep-alive\r\nHost: www.scanproxy.com\r\nAccept:
+image/gif,"
> 2009-09-15 23:59:32 SMTP protocol synchronization error (input sent without waiting for greeting):
+rejected connection from H=[220.139.127.112] input="0401"
> 2009-09-15 23:59:33 SMTP protocol synchronization error (input sent without waiting for greeting):
+rejected connection from H=[220.139.127.112] input="0501"

220.139.127.112 is Chunghwa Telecom Co., Ltd. in Taiwan.

Common Lisp: how to split a program (project) into many files

September 2, 2009 by thandle

This here is good if you move from other languages and wish to know fast.

SpamAssassin and Exim on Arch Linux: some config trouble

August 22, 2009 by thandle

I had this happen – SA wasn’t reading user_prefs out of a proper home dir:

[12071] info: spamd: creating default_prefs: //.spamassassin/user_prefs
[12071] dbg: config: using "/.spamassassin" for user state dir
[12071] dbg: config: mkdir /.spamassassin failed: mkdir /.spamassassin: Permission denied at /usr/share/perl5/vendor_perl/Mail/SpamAssassin.pm line 1577
[12071] dbg: config: Permission denied
[12071] warn: config: cannot write to //.spamassassin/user_prefs: No such file or directory
[12071] info: spamd: failed to create readable default_prefs: //.spamassassin/user_prefs
[12071] dbg: config: read_scoreonly_config: cannot open "//.spamassassin/user_prefs": No such file or directory

I thought this was due to the way spamassassin was invoked, so I tried specifying the user and homedir explicitly. It didn’t work. I tried creating a ’spamd’ user, a homedir, changing the invocation to that:

sudo spamd -c --max-children 3 --username spamd -H "/var/lib/spamassassin/" -s stderr -D

Didn’t help.

Then I RTFMed some. That reminded me of writing something about user ‘nobody’ in exim.conf. That’s the user for which spam filtering is invoked; so if you allow per-user configuration, it doesn’t really matter that you specify “/var/lib/spamassassin” as a homedir, that’s just for the parent spamd process. For every child, the directory will be changed; for ‘nobody’ it’s ‘/’.

So I changed that line to have ’spamd’ instead, and voila!

[12071] info: spamd: creating default_prefs: /var/lib/spamassassin/.spamassassin/user_prefs
[12071] dbg: config: using "/var/lib/spamassassin/.spamassassin" for user state dir
[12071] warn: config: created user preferences file: /var/lib/spamassassin/.spamassassin/user_prefs
[12071] dbg: conf: finish parsing

Tor on per-tab basis

August 15, 2009 by thandle

I have just had this idea: since uzbl_tabbed.py in fact reads the config file for every new tab (i.e. every new uzbl instance), it should be very easy to allow tor be enabled on a per-tab basis, something I wanted badly for Firefox. Nais!

Configuring Exim to use SpamAssassin in ArchLinux

August 15, 2009 by thandle

There’s a lot of outdated stuff floating on the internets. This one was most useful to me.

Basically, if you install Exim and SA from pacman, you’ve already got everything enabled. Filtering spam is done via an Access Control List (the last one in exim.conf). Don’t bother with transports unless you’re sure you want them.

Add spamd to daemons in rc.conf. If you want reject logging, append

-s /var/log/spamd.log -D check

to the string in /etc/config.d/spamd.