30 December 2007

Blocking Flash Content with Squid Proxy

To block unwanted flash content while allowing movies from e.g. youtube.com add

acl mimeblock rep_mime_type ^application/x-shockwave-flash$
acl mimeallowurl dstdomain .youtube.com

http_reply_access deny mimeblock !mimeallowurl

to the ACL section in the squid config file. Flash just works as an example here, other mime types can be blocked as well.

http://en.wikipedia.org/wiki/Internet_media_type

06 July 2007

RegEx Ad blocking with Squid Proxy

ACL's provided in squid are not only good to control access by users, but also useful to keep away unwanted content like ads or xxx sites by using Regular Expressions. In addition to the common 'allow all local user' something like:

acl adserver_regex dstdom_regex -i ^ad\. ^ads\.
http_access deny adserver_regex

is nice to have, just to give an example. The 'Access Denied' Error Page that squid will deliver in case of a blocked add might be replaced to something more eyecandy / non-technical output for the common user.

www.squid-cache.org
pgl.yoyo.org/adservers/

06 June 2007

Suspend-to-disk with kpowersave

Do at your own risk
Check powersaved and kpowersave doc
Backup data first before trying that


Angry about my yearly-increasing electricity bill, i setup suspend-to-disk power saving mode on a 7-year old Epox 8KTA+ mobo based comp:

Using Debian/Etch, KDE, i installed kpowersave (v0.6.2)
sudo apt-get install kpowersave

and adding the everyday user username to the powerdev group
sudo adduser username powerdev

plus disabling event handling by acpi
sudo rm /etc/acpi/events/* (backup files previously)
sudo touch /etc/acpi/events/default

Though doc of powersaved says restarting the powersaved will be sufficient to make that work i had to reboot

After going to suspend mode for several times the bootloader grub was sometimes corrupted after restart. Switching the filesystem from reiserfs to ext3 solved the problem, was on the agenda anyway.

Now the comp turns off after 20 minutes of idletime, saving my current work and not running from morning to night like before - saving me money and makes planet earth happy too :)

powersave.sourceforge.net
dkukawka.blogspot.com/search/label/KPowersave

22 May 2007

Using KDE Style for Gnome Applications

for setting the same style colors in Gnome applications that are used at the KDE Desktop:
sudo apt-get install gtk-qt-engine [Debian/etch]

and check "Use my KDE style in GTK applications" in
KDE Control Center -> GTK Styles and Fonts

17 May 2007

Compile JAVA with gcj

to compile the common helloworld example

public class HelloWorld {

public static void main(String[] args) {
System.out.println("Hello, World!");
}
}

with the gnu gcj compiler to JAVA bytecode
gcj -C HelloWorld.java

and interprete with the VM
gij HelloWorld

... or compile it to native code
gcj --main=HelloWorld -o HelloWorld HelloWorld.java
./HelloWorld


Guide to GNU gcj
yolinux.com - LinuxTutorialJava
Linux Journal - Developing Gnome Applications with JAVA

15 May 2007

working with ISO files

to copy a CD to a .iso file:
dd if=/dev/hdc of=nameofcd.iso

to make an iso file of the content of a local directory:
mkisofs -o nameofiso.iso directorywithisocontent/

cmdline audio recording

for audio recording from ALSA sound devices arecord can be used
arecord -f cd -d 1800 audioCD.wav

this will record 1800 secs of audio in CD-quality, 44.1kHz, 16 bit