From fellow classmates I have been asked to show how to install PyQT5 on a Windows 10 system for use in Python 3 in our programming classes. Coming from Linux I initially just said "Well, install it" but it turns out to be a little more involved than that. The PyQT homepage, seems to no longer have Windows binaries available for download, there are other sources, but I wanted to find something that was as reliable as installing the package on a Linux system.

There are probably easier ways of achieving this, but this is the method I settled on:

Find your Python 3 directory

Python will install itself under your user directory. My Windows user name is olebole, and Python 3.6 is at:


When using the Windows Explorer you will have to enable showing hidden folders and files to see the AppData folder in your home directory.

You need to find your Python location since this is where pip is installed. Pip is used to install packages from PyPI - the Python Package Index.

Install PyQT5

Now that you have your Python installation path, proceed to start a command shell (Win+R, cmd, Enter) and change into the Scripts directory in the Python installation directory and use pip.exe to install PyQT5.

cd c:\Users\oblivion\AppData\Local\Programs\Python\Python36\Scripts

pip install PyQT5

Setting the PATH

If you expect on doing this a lot it would be a good idea to add the path of pip.exe to the PATH environment variable. I leave this as an exercise to the reader, while I hurry back to my trusted terminal window.

I have made a gist with a script I am using to deploy Flask applications to VirtualBox:

I used the following beep sequence to remotely play "Happy birthday" for a friend at his office through VPN.

beep -f 261.6 -n -f 261.6 -n -f 293.7 -n -f 261.6 -n -f 349.2 \
     -n -l 500 -f 329.6 -n -f 1 -n -f 261.6 -n -f 261.6 -n -f 293.7 \
     -n -f 261.6 -n -f 392.0 -n -l 500 -f 349.2 -n -f 1 -n -f 261.6 \
     -n -f 261.6 -n -f 523.2 -n -f 440.0 -n -f 349.2 -n -f 329.6 \
     -l 200 -n -f 293.7 -n -f 1 -n -f 523.2 -n -f 523.2 -n -f 440.0 \
     -n -f 349.2 -n -f 392.0 -n -f 349.2

Since I first learned of rsync, copying files have not been the same. If you do not know rsync, you should read up on it now.

Though I like rsync I have always been a little bothered that there was seemingly no way of forcing rsync to count the total number of files before transferring them, thus making the --progress option partially useless. This time I did some research, and found that if your rsync is newer than version 3.1.0 there is an --info option.

From the rsync manual page:

This option lets you have fine-grained control over the information output you want to see. An individual flag name may be followed by a level number, with 0 meaning to silence that output, 1 being the default output level, and higher numbers increasing the output of that flag (for those that support higher levels). Use --info=help to see all the available flag names, what they output, and what flag names are added for each increase in the verbose level. Some examples:

    rsync -a --info=progress2 src/ dest/
    rsync -avv --info=stats2,misc1,flist0 src/ dest/

Note that --info=name's output is affected by the --out-format and --itemize-changes (-i) options. See those options for more information on what is output and when.

This option was added to 3.1.0, so an older rsync on the server side might reject your attempts at fine-grained control (if one or more flags needed to be send to the server and the server was too old to understand them). See also the "max verbosity" caveat above when dealing with a daemon.

With the --info=progress2 i get the following kind of output:

receiving incremental file list
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1001/71529)
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1000/71612)
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1000/73443)
Documents/ebooks/Humble bundle/
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1014/73485)

Which seem what I have wished for.

Lately I have had the need for a device to do some simple logging. After some brianstorming I made this list of features:

  • Battery operated.
  • Self contained.
  • Log data readable wirelesly.

I came to the conclusion that the events I wanted to log, were on/off type events, like logging whenever my doorbell is rung. Using an ESP8266 module (ESP12), to log the events to the flash memory on the module, seemed feasible even using battery power, since the module only needed power when an event triggered it. To keep track of the time, when the ESP8266 was off, a real-time clock was needed.

  • Use the ESP8266 as microcontroller, log storage and wireless interface.
  • Use a DS3231 RTC module to keep the time.
  • Leave the RTC running at all times.
  • Power the ESP8266 only when an event needs to be logged.

The ESP8266 firmware performs the following tasks. GitHub

  • Write a log entry whenever power is applied. The log entry is written to a ring buffer, ensuring that the data will not overflow. If the flash memory is full, the firmware starts overwriting the oldest entries.
  • Try connecting to a predefined access point. When logging at some remote connection, simply create the access point using the phones WIFI hotspot feature.
    • Update the ESP8266 clock and the RTC from an NTP server.
    • Create a WebSocket server. This serves the log to the phone, and enabled configuration of the predefined access point.
    • Delete the logs from flash memory.

The client is Android specific, I have no I-devices (except an Ipod), and Microsoft, well ya'know... GitHub

  • Download the log from the WakeLog device.
  • Export the log (Google spreadsheet?).
  • Configure the access point used by the WakeLog hardware.

Sometimes you end up with a system having files modified in the future. At one time this happened to my Raspberry Pi, who was set up to sent me an email when something was wrong. After a friendly reminder every hour, I set out to find the files, and change their date to something sane.

Using find, this give a list of the files:

find . -newermt "5 days" -ls

Combine it with touch , to change the date to the current.

find . -newermt "5 days" -ls -exec touch -c {} \;

This setup is used on a ECM3610 Debian machine serving as a firewall, DHCP server, and DNS server. The following assumes that you have a working installation something like this:

  • eth0 is connected to the local ( network.
  • eth1 is connected to the internet.
  • Shorewall is installed and configured for regular firewall duty.
  • dnsmasq is installed and configured to act as DHCP and DNS server.
  • lighttpd is installed and only exposed on the local network.

Functional description.

This setup allows requests to a list of domains to be redirected to an internal web server. Use this setup to block for instance known tracking servers on the internet.

Somewhere along investigating how to do this I read, in the ArchWiki privoxy page that blocking trackers creates a unique browser signature. I have absolutely no reason to doubt this, but there were some servers that I simply did not want to talk to.

Using dnsmasq to redirect domains.


If your dnsmasq is configured to listen on an interface, reconfigure it to use addresses to make stuff prettier when assigning another IP address to the interface in a little while.


Use files in /etc/dnsmasq.d/ as configuration files. Uncomment or add the following:


Get a list of servers to block, spits out a list formatted for dnsmasq, if you ask it to. The list uses as target, replace it with the address of a local web server if you want to inform the user that something was blocked, in this case.

curl -s '' | sed -r 's/' > /etc/dnsmasq.d/block2local

This could be made into a cron job to update the list from time to time.

Setting up a web server to show an information page.

I have lighttpd serving some pages to the local network, so I add another IP address to eth0, and configure lighttpd to serve this address from another directory.


Add this:

iface eth0 inet static


Add this:

$SERVER["socket"] == "" {
   server.document-root = "/var/www/blocked"

Add something that serves your purpose to the server.document-root directory. Simplest is something like:


<title>Server blocked.</title>
<p>This server is blocked on this network.</p>

Generated on 2017-03-19 22:52:04.496062