Speed-up page loading time with pi-hole

Even though you are using pi-hole to stop showing ads which should speed-up page loading since it does not need to featch unwanted ad material.
But sometimes slow down your page loading, since many ads are delivered via HTTPS port 443.

Pi-hole only knows about domain being requested and it is blocking the ad domains on DNS level. It is not aware about the specific protocols used for ad delivery. Slowdown can occur waiting for HTTPS request to timeout to unreachable domain because you have blocked it on DNS level.

To speed things up you could use these three simple iptables rules:

iptables -A INPUT -p tcp -s 192.168.1.0/24 --destination-port 443 -j REJECT --reject-with tcp-reset
iptables -A INPUT -p udp -s 192.168.1.0/24 --destination-port 80 -j REJECT --reject-with icmp-port-unreachable
iptables -A INPUT -p udp -s 192.168.1.0/24 --destination-port 443 -j REJECT --reject-with icmp-port-unreachable

In this case my home network is 192.168.1.0 and all request coming from your local clients to pihole on ports 80,443 are rejected which should hopefully result in speedy page loading.

Save the rules in your local boot script or use iptables-save.

Mapping Sony Bravia remote RM-ED060 CEC for Android Kodi player

I recently bought an Android box to replace my Raspberry Pi 3 player running Xbian.

One of the features I love the most on Raspberry Pi is support for CEC, since I prefer to have only one remote in use. I have controlled Kodi by using my RM-ED060 remote from my Sony Bravia KDL-50W815B that looks like this:

I did some small customization to remote configuration in Kodi on Raspberry pi by hand and I wanted to keep as much of that with my new Android box.

In order to re-map keys I used Kodi add-on called keymap editor which allows you to map almost every key you want.

This is my current gen.xml file that can be found in Android/data/org.xbmc.kodi/files/.kodi/userdata/keymaps/

<keymap>
<global>
<keyboard>
<key id="61670">activatewindow(videos,tvshowtitles)</key>
<key id="61669">activatewindow(pictures)</key>
<key id="61668">activatewindow(music)</key>
<key id="61664">activatewindow(weather)</key>
<key id="61666">info</key>
<key id="61665">contextmenu</key>
<key id="61667">activatewindow(videos,files)</key>
</keyboard>
</global>
<fullscreenvideo>
<keyboard>
<key id="61453">osd</key>
<key id="61667">subtitledelayminus</key>
<key id="61668">subtitledelayplus</key>
<key id="61669">showsubtitles</key>
<key id="61670">activatewindow(subtitlesearch)</key>
<key id="61638">aspectratio</key>
<key id="61453">osd</key>
<key id="61665">info</key>
<key id="61666">codecinfo</key>
</keyboard>
</fullscreenvideo>
</keymap>

If you would like to have the same configuration without doing the re-configuration of the keys yourself, you should copy this file to the same directory.

If you are wondering what are those key id definitions, here are all the codes that I was able to identify with keymap editor for this TV:

61448 - Return/Back
61453 - Select/OK
61488 - 0
61489 - 1
61490 - 2
61491 - 3
61492 - 4
61493 - 5
61494 - 6
61495 - 7
61496 - 8
61497 - 9
61568 - Up
61569 - Down
61628 - Stop
61636 - Rew
61637 - Fwd
61638 - Rec
61664 - Guide
61665 - Options
61666 - Info
61667 - Red
61668 - Green
61669 - Yellow
61670 - Blue
61750 - Left
61751 - Right

Compile lcdproc hd44780 driver on Raspberry Pi running Debian Stretch

In order to get my 20×4 LCD display with cheap IIC/I2C/TWI/SPI Serial Interface Board running on Raspberry Pi I had to use patched hd44780.so file downloaded from NeighborGeek. You can check it out here

This worked fine on my RPi3 running Debian Jessie, but recently I have upgraded to Stretch and found out that his driver now is having issues. After running for longer period of time the screen would be full of garbage characters.

I thought I could repeat the steps, download source, patch the source, compile and use again hd44780.so file instead of the one provided by distribution.

First thing I did was to download latest source from GitHub:

wget https://github.com/lcdproc/lcdproc/archive/master.zip
unzip master.zip
cd lcdproc-master

Now I tried to apply the hd44780-i2c.c patch but it failed. Then I checked the hd44780-i2c.c file in the source I found out that patch is no longer needed just proper configuration in LCDd.conf.

In order to compile the latest driver from GitHub following steps are needed:

./autogen.sh
./configure --disable-libusb --disable-libusb-1-0 --enable-drivers=hd44780 --disable-libftdi
make

After you have compiled the driver, go to directory:

 cd /usr/lib/arm-linux-gnueabihf/lcdproc/

and backup existing file just in case something goes wrong:

cp hd44780.so hd44780.so.orig

Then copy the newly compiled driver in proper place:

cp /usr/local/src/lcdproc-master/server/drivers/hd44780.so .

Edit LCDd.conf and add the following after hd44780 part:

i2c_line_RS=0x01
i2c_line_RW=0x02
i2c_line_EN=0x04
i2c_line_BL=0x80
i2c_line_D4=0x10
i2c_line_D5=0x20
i2c_line_D6=0x40
i2c_line_D7=0x80
Backlight=yes
BacklightInvert=yes

You can download my newly compiled driver and LCDd.conf from this link  hd44780_debian_stretch.

I hope this has saved you some time and got your 20×4 LCD working with Debian Stretch.

Update

I have moved my LCD display to Pine64 SBC and since this is different architecture I needed to re-compile it using the same steps as above.

You can dowload aarch64 version hd44780.so aarch64.