mrt 082018

I have just started testing Ubuntu 18.04. The first thing I noticed was how different it handles network interfaces. The way Ubuntu manages network interfaces has completely changed.

Have you heard of NetPlan? Probably not, if you have, then you’re a step ahead of many. NetPlan is a new network configuration tool introduced in Ubuntu 17.10 to manage network settings.

It can be used write simple YAML description of the required network interfaces with what they should be configured to do; and it will generate the required configuration for a chosen renderer tool.

Continue reading »

 Posted by at 16:41
okt 012017

De laatste tijd ben ik bezig geweest met het vervangen van mijn KaKu schakelaars. Zo zat er KaKu in mijn hanglampen en werden ook de staande lampen via KaKu bediend. Omdat KaKu via 433mhz werkt en dus geen feedback kan geven heb ik besloten om ze te gaan vervangen. Via het Youtube kanaal van Bruh kwam in in aanraking met Sonoff.

De Sonoff is een WIFI bestuurbare schakelaar gemaakt door het bedrijf itead.
Deze is schakelaar is natuurlijk te gebruiken via de eigen app, maar handiger zou zijn om deze te kunnen aansturen middels Home Assistant icm MQTT. Om dit te bereiken moeten we nieuwe firmware flashen. Dit klinkt moeilijker dan het is.
Continue reading »

 Posted by at 16:30
okt 012017

So I ordered one of these Sonoff Wifi Switches off of Amazon. The idea is pretty neat. For around $10 you get a WIFI connected switch that you can control with your phone.

The problem:

I wanted to control my garage door with the Sonoff Wifi Switch but found out that the device passes power through it instead of just closing a contact.  Despite many requests on the manufacturers website forum they have not made the change yet.

The solution:

You can convert the Sonoff Wifi Switch into a dry contact with a Soldering Iron, someSolder and a Cheap Dremel.

Danger:  Make sure the unit is not plugged in before continuing.

Step 1:  Run your finger nail around the base of the unit to separate the cover.  I keep my nails really trimmed so I used a small flat head screwdriver.  It’s fairly obvious where the seam is but if you can’t find it, leave a comment and I’ll add some pictures of the process.

Step 2:  Removed the circuit board.

Step 3:  Removed the pathways with the Dremel from BOTH sides of the circuit board as shown in the picture below.  Hold it up to that light as shown to make sure you did not miss any of the connection.  If you’re gap is too small the voltage will make the jump.

Step 4:  Solder across the gap as shown so that the connection will actually close when the relay switches.  You should be able to see what I’m talking about in the picture below.  You can see the solder pointed to by the red arrow.  If you can’t get the solder to stretch that far, you can use a single strand of copper from a stranded wire to give your solder something to hang on to.

Step 5:  Test your product with a voltage meter to make sure it all went as planned.

 Posted by at 16:17
jul 202016


I came across a few warnings when I wanted to list the modules of an
apache 2.4.7. server on an Ubuntu 14.04 server.


This shocked me, but analyzing the server further showed me that
everything was up and running.

What’s going on?

There is nothing going on, except that if you request output from
the /usr/sbin/apache2 binary directly, the /etc/apache2/envvars file isn’t sourced.

Running the same command with apache2ctl gives correct output:

mrt 032016

When you use rrdtool, it can happen that you first create your databases, then collect a whole bunch of data and decide later you want more accuracy/longer periods.
Especially when using zenoss (the monitoring solution I mostly work with at Kangaroot), which uses very conservative RRD settings by default (i.e. 5-minute intervals for only the first 50 hours). Zenoss provides a way for you to change the way RRD’s are created, but not to apply those settings to already existing RRD files, which I found out *after* I started monitoring everything 😉

rrdresize can help: it (just) adds or removes locations for rows.
In my case it was not good enough because zenoss uses a variety of resolutions (step sizes), and so if you add rows to all of them rrdtool – when graphing – will often pick a higher resolution RRA that just had rows added (and hence contain unknown values), even though you have the values, albeit at a lower resolution.

So you need a way to update all rows in the RRA’s.
I found a perl tool that does just that. (I think, I didn’t study all details). So, you install that in your /home/zenoss for instance and then you run the following script, which creates new rrd files with the new settings and uses the perl script to copy all data into it.

# invoke me like this:
# find /usr/local/zenoss/zenoss/perf/ -name '*.rrd' -exec ./ {} \; >> newrrd-logfile

[ -d "$backupdir" ] || mkdir -p "$backupdir" || exit 2
[ -d "$newdir"    ] || mkdir -p "$newdir" || exit 2
[ -f "$file"      ] || exit 3

echo "Processing $file .."
base="`basename "$file"`"
[ ! -f "$backupdir/$base" ] || mv "$backupdir/$base" "$backupdir/$base".old || exit 4
cp "$file" "$backupdir/$base"
cd "$newdir" && rrdtool create "$base" \
--step '300' \
--start '1230768000' \
'DS:ds0:GAUGE:900:U:U' \
'RRA:AVERAGE:0.5:1:122640' \
'RRA:AVERAGE:0.5:6:55536' \
/home/zenoss/ "$backupdir/$base" "$base" | grep -v 2009 # hide some output
cp "$base" "$file" || exit 5
echo "Done"

Oh and btw, rrdwizard is a cool webapp when you’re feeling too lazy/have forgotten how to write rrdtool commands

dec 162015

With the release of Ubuntu 14.04 and the proliferation of PHP 5.5, there is going to be a migration away from Alternative Performance Cache (APC) and toward PHP’s new built-in OPcache.

This is a logical move that seems destined for any interpreted language. As websites have become more and more complicated with many processes running, opcode caching has become a necessity – fortunately, it’s simple to implement.

The site has a nice page of all the runtime options available, but we will cover the basics here to get you started quickly.

All you need to do to get OPcache set up is to make changes in the php.ini file on your server.

Open php.ini In Your Favorite Text Editor
To get started open your php.ini file.

Apache web-servers


Enable the OPcache
To enable the OPcache, change to the following lines — easy enough!
Change to:

Note: you have to uncomment this line as well as change the “0″ to “1″.

Modify the Amount of RAM the OPcache Will Use
With OPcache, there is a trade-off between speed and the amount of RAM used. The more RAM you are willing to dedicate to storing opcode, the more opcode that can be stored. There is a diminishing return at some point, because some code will execute rarely, or your code base might not be that big. It is worth playing with this setting to see where you get the best performance-versus-RAM trade-off. This setting is in megabytes.

Change to:

Boost the Number of Scripts that Can Be Cached
OPcache has a strange setting that requires you to not only adjust the amount of RAM, but also define the number of scripts that can be cached. You have the option of tuning this parameter for your own application too, especially if you find that your hit rate is not close to 100 percent.

Change to:

Change the Revalidate Frequency
To make sure that the OPcache notices when you change your PHP code, you can set the revalidate frequency. Basically, this will tell the cache how often to check the timestamp on the files. This is measured in seconds.

;opcache_revalidate_freq = 2
Change to:

opcache_revalidate_freq = 240
Verify that the PHP OPcache Mod is Enabled
Believe it or not, that converts most of the settings you will need to get started. PHP5 has its own module system (since 5.4), so make sure that OPcache is enabled.

sudo php5enmod opcache
Restart PHP and Your Server
You should now be all set to start using PHP 5.5’s OPcache. You just need to restart your server to get it going.

Apache Web-Servers

sudo service apache2 restart
Nginx Web-Servers

sudo service nginx restart

okt 072015

PHP has different functions which can be used to test the value of a variable. Three useful functions for this are isset(), empty() and is_null(). All these function return a boolean value. If these functions are not used in correct way they can cause unexpected results.

isset() and empty() are often viewed as functions that are opposite, however this is not always true. In this post I will explain the differences between these functions.

Continue reading »

jan 272015

Exchange server has a recipient filter that prevents mail submissions to accounts that are not in the GAL (Global Address List).

First, let’s locate this configuration and then we’ll talk about how it works followed by thoughts about relay domains.

How to enable this feature

To enable this filter in Exchange 2003 you would visit the Message Delivery Properties screen, and select the checkbox next to Filter recipients who are not in the Directory. You would also need to enable it on each SMTP connection.

Continue reading »

jan 202015

Als IPv6 nu al was doorgebroken, hadden we ze niet meer nodig, VPN verbindingen en inbel verbindingen. Helaas zijn deze verbindingen nu nog nodig om met een netwerk op afstand te verbinden. In de loop van de jaren heb ik heel wat VPN verbindingen in mijn lijst staan. Dit is erg vervelend als ik achter een nieuwe computer zit. Hier zou ik alle instellingen weer opnieuw moeten doen. Gelukkig is hier een snelle oplossing voor. Met een extra tool is het zelfs mogelijk de wachtwoorden uit te lezen en te kopiëren.

Continue reading »