Increase avatar size in bbpress

I needed to increase the image dimensions for the avatars in bbpress. There is no direct filter available which lets you change the size for a specific avatar location. From the forums, I gather that you have to edit the template. I managed to make it work using the filter system. The filters get called for every avatar location, so I base my heuristic on the requested avatar size. The default ’small‘ avatar size is 14px and nearly useless. These are displayed inline. The faces next to the postings are 80px by default. I increased them to 110. Bigger images would likely break the formatting.

function my_bbp_change_avatar_size($author_avatar, $topic_id, $size) {
    $author_avatar = '';
    if ($size == 14) {
        $size = 24;
    if ($size == 80) {
        $size = 110;
    $topic_id = bbp_get_topic_id( $topic_id );
    if ( !empty( $topic_id ) ) {
        if ( !bbp_is_topic_anonymous( $topic_id ) ) {
            $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
        } else {
            $author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
    return $author_avatar;

/* Add priority (default=10) and number of arguments */
add_filter('bbp_get_topic_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
add_filter('bbp_get_reply_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
add_filter('bbp_get_current_user_avatar', 'my_bbp_change_avatar_size', 20, 3);

Note that we hook up three different filters. You can play around with different avatar locations this way, but I couldn’t be bothered to find out the details. The first one is for some inline avatars (likely for the topic author only), the second one probably for inline avatars for reply authors. The last one probably is for the avatars displayed next to full postings.

We also need some CSS:

/* We increased the tiny avatar size, so adjust the position */
#bbpress-forums p.bbp-topic-meta img.avatar, #bbpress-forums ul.bbp-reply-revision-log img.avatar, #bbpress-forums ul.bbp-topic-revision-log img.avatar, #bbpress-forums div.bbp-template-notice img.avatar, #bbpress-forums .widget_display_topics img.avatar, #bbpress-forums .widget_display_replies img.avatar {
    margin-bottom: -2px;
/* Increase max-width for the big avatars */
#bbpress-forums div.bbp-forum-author img.avatar, #bbpress-forums div.bbp-topic-author img.avatar, #bbpress-forums div.bbp-reply-author img.avatar {
/*margin: 12px auto 0;*/
max-width: 110px;

There is a filter available that will simply change the default avatar size, but that is only available for the user detail page – e.g. the profile. The code in BBPress looks like this:

echo get_avatar( bbp_get_displayed_user_field( 'user_email', 'raw' ), 
                       apply_filters( 'bbp_single_user_details_avatar_size', 150 ) );

I wish the authors had included this for every avatar location.

Bonus – Better Editor

By default, current BBPress releases only include the default HTML editor toolkit. Very useful. To get TinyMCE back, install bbpress-enable-tinymce-visual-tab and enable TinyMCE in Settings->Forums. I use the twentythirteen theme and the mode switching tabs (text<->visual) look weird. I also found the image insertion dialog horribly broken. Some CSS fixes that:

/* Fix tab switch in TinyMCE BBpress */
.wp-editor-tabs .wp-switch-editor {
    padding-top: 0px;

/* Hide image embedding widget in TinyMCE BBpress.
 * It's just horribly broken.
#bbp_topic_content_image {
    display: none;

Kategorien:informatik, oss

MythTV on the ASUS A78L-M/USB3

A couple of quick notes on my MythTV setup. My combined frontend/backend runs on an A78L-M/USB3 board on Arch Linux. I updated the BIOS from 0211 to 1503 without any problems today.

Wake on Lan

The MythTV Wiki on WOL says to use ethtool -s g to enable WOL. On my setup, I need ethtool -s bg. My box is running Arch with systemd, so my /etc/netctl/ethernet-static looks like this:

Description='A basic static ethernet connection'
ExecUpPost='/usr/bin/ethtool -s enp2s0 wol pg'

Don’t forget to enable „Wake on PME“ in the BIOS setup.

ACPI Wakeup

My box turns off automatically to save power. The backend sets a wake-up time to start it back up in time for the next recording. This works pretty much as described in the MythTV Wiki on ACPI Wakeup. However, I had to disable the HPET function to make it work.. Disable the HPET timer by adding hpet=disable to the boot parameters in /boot/grub/menu.lst. Mine looks like this:

# (0) Arch Linux LTS
title  Arch Linux LTS
root   (hd0,0)
kernel /boot/vmlinuz-linux-lts root=/dev/disk/by-uuid/92e04f63-eac7-40a3-b063-34a5daaddab1 ro hpet=disable init=/usr/lib/systemd/systemd
initrd /boot/initramfs-linux-lts.img

As you can see, I am using the LTS kernel.  This is Linux 3.0 right now, so your results might differ on a newer kernel. In the BIOS setup, you have to disable „Wake On RTC“. Yes, this is quite counter-intuitive.

That’s it

I hope my notes will help someone. I’ve had the hardware for quite some time now, but only got around to sharing my notes today as I was working on the box. Don’t forget to read the wiki articles I linked.


Web2py, JQuery Mobile and Caching

So I’ve been playing around with JQuery Mobile to build a nice mobile version of my web2py app. Once I had that running, I wanted to make the website load a bit faster, because waiting about five seconds is way too much! Time to install the Google Pagespeed extension into my trusty Firefox, set the UA string to something iphone-is and look at the recommendations!


The Pagespeed extension complained about my files not being compressed. Some googling turned up the necessary .htaccess magic to enable mod_deflate on HTML, CSS and JS files. The transfer size went down from 448kb to 124kb! That’s an insane improvement. Still, there was some work left. Speaking from memory, this took page load time from about 5s down to 3.4s.

Proper Caching

Another complaint by the pagespeed extension was the caching: I needed to set the expires header! By setting the timestamp in the expires header, you tell the browser not to worry for a while and just fetch the file from cache. If you don’t set that header (or „cache-control“, alternatively), the browser will perform a conditional request, asking the server „hey, did that file change since last time I downloaded it?“. This is not a lot of overhead, but still, setting the „expires“ header can save us quite a few network requests.

Modifying the header via .htaccess did not work because web2py was already setting it in gluon/ Apparently, if there is a timestamp included in the file name, the expires header is set to a date in the far future. This technique is called URL fingerprinting. I decided not to care and just hardcoded the expires header for all static files. This will eventually come back to bite me. The result for this tweak: page load time went down from 3s to 1.85s with a warm cache! The 3s case was with a warm cache and conditional requests – each request took 500ms to execute and not all of them were parallel. Page load time with cold cache was 3.4s!

To Do

All requests are currently handled via the CGI interface. Letting Apache handle static files directly would likely increase performance and magically make the expires header work without having to hack web2py.

The real WTF

JQuery: 91.4kB, JQuery Mobile: 141.1kB, JQuery Mobile CSS: 92.4kB. That’s about 300kB of code. I have not done any benchmarking yet to determine parsing and execution time, but it would seem that 300kB of code is a bit excessive for a puny mobile device.


Kategorien:informatik, oss

Rooting the Sony Xperia Go on Linux

This is for Gingerbread. My phone is still on stock software, fresh out of the box.

  •  Get Bootloader unlock code as per
  •  Download „SDK Tools“ from
  •  Extract SDK Tool, run tools/android to start the SDK Manager
  •  Install „Android SDK Platform Tools“ in SDK Manager
  •  You now have platform-tools/fastboot – I had a very old version I downloaded from HTC and it did not support the -i option
  • Shut down phone, unplug phone from computer, hold Volume+ button, plug phone back in. LED should be violet.
  • Run platform-tools/fastboot -i 0x0fce getvar version to verify the whole thing is working
  • platform-tools/fastboot -i 0x0fce oem unlock 0xYOURKEY

laga@moar:~/download/android-sdk-linux$ sudo platform-tools/fastboot -i 0x0fce oem unlock 0x7B6F8ECE8CFF162E

(bootloader) Unlock phone requested
OKAY [  0.089s]
finished. total time: 0.089s

You might need to obtain root privileges to be able to talk to the device node. Or fiddle with chown in /dev/bus/usb/ – YMMV.

Your bootloader is now unlocked. Congrats. Your user datas has been wiped as well.

Now on to the rooting part:

* Go to

  • Download and unzip
  • Make sure your phone is running the right firmware version!
  • Bring phone back to fastboot mode (violet LED) by shutting down, holding VOL+ and plugging in USB
  • platform-tools/fastboot -i 0x0fce flash boot kernel.sin
  • Download root_tools.rar and unrar
  • Unplug phone from USB, replug and start it
  • If necessary, enable debug mode on the phone
  • Execute shell commands listed on XDA page

You will probably notice that there is a v6 version of the download. That one did not have the kernel.sin file, so I used the v5 file.



Pogoplug B04 und Owncloud

Arch Linux ARM läuft nun auf dem Pogoplug. Installation war schmerzfrei. Kurze Notiz zur Installation von OwnCloud:

  • pacman -S owncloud php-apache php-sqlite
  • Config-dateien gemäß Ausgabe editieren
  • Apache starten
  • Die Adresse des Pogoplugs aufrufen mit / als pfad
  • Wenn du ein anderes Datenverzeichnis möchtest, musst du in /etc/httpd/conf/extra/owncloud.conf den pfad für openbasedir ergänzen
  • in /etc/php/php.ini muss man zusätzlich noch und aktivieren; das sagt OwnCloud aber
Kategorien:livehacking, oss

Kurze Zusammenfassung Heizungs-Setup

Ich habe gerade an einen Freund eine Mail mit Infos zu meinem Heimautomatisierungs-Setup geschrieben, die ich hier mal wiedergeben will:

Zur Heizung:

von ELV gibt es die Thermostat im Set als Bausatz für 55€; man spart 15€. Da ist dann drin: Stellmotor, Thermostat, Fenstersensor. Falls du mehrere Heizkörper oder Fenster in einem Zimmer hast, kannst du sie Sensoren und Aktuatoren separat bestellen und mit dem Thermostat koppeln. Das Thermostat kann man dann noch pro Tag mit zwei Zeitslots programmieren, an denen die Heizung feuern soll. Je nach Heizkörper brauchst du aber auch noch Adapter für das Ventil!
Das Zusammenlöten eines Bausatzes dauert bei mir 2h.

Das reicht erstmal für eine Heizungssteuerung. Wenn du das Ding noch zentral steuern willst, kaufst du dir entweder die zugehörige Zentrale FHZ-Irgendwas(die es auch mit USB-Anschluss gibt) oder du kaufst dir für 50€ bei einen CUL und verwendest den zusammen z.B. mit FHEM. Steht eigentlich alles hier im PDF – mehrmals lesen lohnt sich

Der CUL steckt bei mir einem TP-Link MR3420, der per USB-Stick mehr Speicher bekommen hat. Hier läuft FHEM auf OpenWRT in zufriedenstellender Geschwindigkeit, nachdem ich ein FHEM-Paket gefunden hatte.
Leider ist die Kiste sehr instabil, was einer Mischung aus halbkaputtem USB-Hub und schlechten Treibern geschuldet ist. Eventuell hast du ja einen schöneren Host dafür. Für Fritzboxen gibt es schon fertige Images mit FHEM drauf, je nach Modell. Mit der Android-App und einem SSL-Tunnel komme ich da auch von aussen komfortabel drauf:

Andere Fehlerquellen:
* manchmal, selten, spinnt der Stellantrieb und die Heizung feuert voll.
* manchmal vergisst das Thermostat die Kopplung mit dem CUL, da das Reverse Engineering des Protokolls offenbar nicht vollständig ist. Man kann das umgehen, indem man die Zentrale regelmäßig mit dem Thermostat sprichen lässt; automatisch per FHEM
* wenn man gegen den Stellmotor tritt, muss man ihn wieder anschrauben
* wenn der Fenstersensor zu oft runterfällt, geht er kaputt

Hoffe, das hilft dir erstmal weiter!


FHEM 5.3 on OpenWRT with WOL

I’ve finally installed the FHT80b thermostat in the bathroom. While I was fiddling with FHEM, I figured I wanted to use WOL for my media box. This required an update to FHEM 5.3.

On the OpenWRT box, some additional steps are required. My FHEM instance does not run with root privileges, so I’m also setting some +s bits.

# opkg install etherwake
# ln -s /usr/bin/etherwake /usr/bin/ether-wake
# chmod +s /usr/bin/etherwake

Ping is also provided by busybox, but I did not want to +s the whole busybox binary, so I installed a dedicated ping binaryand removed the symlink from /bin/ping to /bin/busybox.

# opkg install iputils-ping
# chmod +s /usr/bin/ping
# rm /bin/ping

Kategorien:informatik, oss, wohnung