Hello 2017

The year 2017 has barely begun, but somehow it is already looking up. At least in my personal bubble.

Son is suddenly confident enough to try a lot of new words, with mixed success in pronunciation or even correctness, but he is leaping forward amazingly. I am really happy with him on this, as he is able to express himself a lot better this way.

Phase 1 was cleaning up my desk and then the rest of my home office. Cleaning up the mess around my desk was kind of a challenge, as it was also a bit of a list of physical todo items. Decluttering it all was also a metaphor of leaving 2016 behind me and creating a more airy, distraction-free space to work and be in. It helps me staying focused and actually inspires me to fix and clean up other things.

My wife was so happy with the whole operation that she promptly put another two big boxes with stuff (electronics, boxes, documents) into my now roomy room. We will sort these out in the near future, as they are now an instant eye-sore :)

Phase 2 will consist of me getting more physical exercise. I will try to run more often, and more regularly. Apart from that, I would like to get some strength training, be it by doing some kind of push-up challenge, getting myself some dumbbells and working out with those or some other way. Semi-regular walks would be welcome too, also some shorter ones in the evening.

Phase 3 is a bit of an unknown yet, as I don't generally do up-front new-years resolutions.

Apart from that I am going to read more books this year and I would like to make a big dent in my Pocket backlog.

Before

After

Bonus colours

Can you tell I'm rather happy with my desk? Such a simple but useful pleasure.

  • Michiel Scholten
  • Home
  • 🕔

Goodbye 2016

2016 was... interesting. Globally, it was overshadowed by some almost-disastrous events, and a lot of great and/or famous people left us (I won't even speak about the political... issues the world is having).

Personally, the year was challenging. Having a second kid eliminates all chances of getting some decent sleep. I'm not complaining (well actually I am), but it made me feel worthless. Zombie-like state at the office at times, guilt towards my colleagues about not getting enough done (in my opinion at least).

Thankfully, they actually think I'm balancing my life and work well, which was great to hear.

Kid number one meanwhile is having his toddler puberty episodes, which frankly makes him rather annoying at times, but he also struggles with his frustration regarding not always being able to express what he wants (I empathise greatly with this), or of course not always getting what he wants.

In December, I took a few weeks off (including the first week of January), which helped me clear my head a bit and focus on other things, including my wish to write my own gallery website (imagine-gallery), as I don't like how other gallery software works. However, because of all kinds of factors, I also ended up with quite some days of entertaining our kids, which is both big fun and rather exhausting.

This meant that the ending of 2016 was spent less on relaxing while catching up with some books, series and movies than I intended, but I did spend some time enjoying my kids and programming (what I also wanted to do).

I think one of the things that made me feel so tired and strung out, was (and is) the lack of me-time. I think most young parents will recognise the huge amount of time that goes into taking care of your children, starting with being woken up early in the morning with their cries, getting them dressed, fed and maybe bring them to daycare, after which they will have to be picked up again, fed, your food has to be re-warmed in the microwave, bed time ritual and then finally some plunking-down on the couch, which is halfway through the evening and tiredness is rapidly catching up meaning that not much energy is left for hobbies or even meaningful conversations with your significant other. This of course wears one down after a few years, which means that regular downtime needs to be scheduled in order not to get fed up with things too much. This is one of the reasons I took some time off in December, apart from the obvious ones and the fact that apparently I don't take days off often enough.

This would also be a tip for every young parent: as hard as it is, get some time for yourself. Be it an evening able to spend on your hobbies every other week, a random day off, an afternoon and evening with your significant other with the kids at their grandparent's place, for your sanity's sake Just Do It :)

It's not all bleakness and sleep deprivation though. The first year of a child is a roller-coaster in developments. Our daughter went from the helpless newborn at the start of the year to a little girl with a big smile standing on wobbly legs, refusing to take a few steps yet but moving rapidly through the rooms in a style rather similar to what chimpanzees can be seen doing when holding something in one hand. She is chattering happily along with the din of the household, terrorised at times by her big brother who of course does not want to have her touch his precious toys, but who in turn also keeps gravitating back to what she is doing and trying to join in on the play or run with her toys (he is a big collector of toys, stashing them in piles in his fortresses).

We also started with dancing lessons again. While we forgot some moves in our ballroom and Latin dances, it's great spending 1.5h every week with just the two of us doing something enjoyable.

2016 was not a bad year per se, but I'm sort of glad it is over. Somehow 2017 is inviting me, even though the world is setting up some really interesting plays to behold.

  • Michiel Scholten
  • Home
  • 🕔

Happy 13th birthday, dear diary

Er, weblog. Lots happened this year, lots of good and some less good things. We enjoyed our little girl growing from baby to toddler. We less enjoyed the continuing broken nights.

The world is a weird, scary, but also a wonderful place. Let's make 2017 great.

  • Michiel Scholten
  • Home
  • 🕔

Get a push notification when your laptop is low on battery

A while ago I wrote about getting notified on battery low. It is quite useful when you leave your laptop unattended for a while, to get a notification on your phone and/or smartwatch when that laptop is about to run out of juice. It has saved me a few hard shutdowns (or interrupted tasks because of forced hibernation).

The udev rule in that article should still work (if your device/battery emits those kinds of events at least), but for me the PushBullet method used there stopped working.

As I recently started using PushOver next to PushBullet, I decided to redo the little setup with a cronjob and a PushOver shell script. The cronjob works around the battery subsystem not emitting an event when you need it, the shell script has less dependencies than a Python script.

An example with the udev rule could look like this:

/etc/udev/rules.d/99-lowbat.rules

# Suspend the system when battery level drops to 5% or lower
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="/home/youruser/bin/powerlow_notification.sh"

(Rule based on a snippet found on this handy wikipage)

Myself, I wrote a cronjob to be run every 5 minutes (you can use whatever interval you prefer of course), which looks like this:

#!/bin/bash

BATTERYLEVEL=$(cat /sys/class/power_supply/BAT0/capacity)

if [ $BATTERYLEVEL -lt 15 ]; then
    /home/youruser/workspace/pushover.sh/pushover.sh -t "Power low on $HOSTNAME" "Battery power now is ${BATTERYLEVEL}%"
fi

This takes the current battery level from the udev system path, checks whether the value is less than 15 (percent) and sends a message through PushOver if it is. It will do so every 5 minutes until it's over 15 again, but that's fine with me (and a small price to pay on a system without the battery events). It might be made a bit more clever with keeping track of 'did I just send a message already' state files, but that exercise is left for the reader :)

Then, the crontab entry looks thusly:

# Check battery level every five minutes, PushOver message when below a certain percentage
*/5 * * * * /home/youruser/bin/cron/check_battery_level

N.B.: the little pushover.sh) script that I used, has a config file, located in ${HOME}/.config/pushover.conf, which takes your PushOver application token, your user token and optional CURL options:

TOKEN="your application's token here"
USER="your user/group key here"
CURL_OPTS="options to pass to curl"

Your user token is on the homepage of PushOver if you are logged in. The Application Token ('TOKEN') you can create by scrolling down that page and create a new application in Your Applications. There you can give it a nice icon and such too.

  • Michiel Scholten
  • Work
  • 🕔

I made a thing: a simple bookmarking service

A while back I started scratching an itch that I had and that wasn't relieved by some existing software or services I could find: a central place to keep track of interesting places on the web I wanted to follow up on, without having them saved as read-later in Pocket (which is an excellent tool, but I'd like to keep it for articles only).

One of the requirements was that I should be able to easily add some URL from my phone, so I can remember it for when I have more time or a bigger screen to research something or watch a video. Also, it needed to be cross-browser, preferably environment agnostic. That ruled out the various bookmark syncing systems of the respective browsers, also because I tend to use Firefox on the desktop and Chrome or Flyperlink on my mobile devices.

A web application seemed like a good fit, so I started on a Flask based website with peewee as uncomplicated ORM. To make it all look good, I used MaterializeCSS which is a great toolkit to create Google Material style websites (I also use it on aquariusoft.org for example). As backend, instead of choosing a 'big' database management system like MariaDB or PostgreSQL, I decided that peewee would store its models in a SQLite file.

This all resulted in a project that is quite portable: after creating a virtualenv and filling it with the requirements, one is already able to run the web app by just running python digimarks.py, which will run Flask's debug server, but that's fine for the casual use that a bookmarking system gets. The frontend is fully responsive, so looks just fine on a phone screen and big desktop monitor.

Of course, running it under nginx/uwsgi or Apache/mod_wsgi in a central location is a bit more useful, so for myself I did just that.

While toying around with the functionality after having implemented automatic retrieval of the title of the linked page, tags and stars/favourites were among the first to go in. I would want to find things easily by having relevant labels attached to the bookmarks, and if I especially liked something, a star can be added. Filtering on these, along with search for text makes it easy to find things again.

As I now have tagging, and occasionally want to share research with friends and other people, I decided to make it easy to create a read-only view of a certain tag, where the bookmark cards are available for review by whoever you share the (private-ish) url with, but do not disclose any other information about them, like the other tags attached, 'star' status, or edit possibility. An example is my list of useful Python resources.

All of this is open sourced on its own GitHub page, so check it out if you're interested. Installation instructions are included (you can either pip install it, or clone the project and go from there). An aquariusoft.org project page is online too, with currently slightly outdated screenshots.

  • Michiel Scholten
  • Home
  • 🕔

When your Pebble doesn't want to talk web anymore

A few weeks ago I started noticing an odd problem: my Pebble Time Steel didn't want to update its various apps anymore. The watchface showed stale weather data, the public transports apps didn't want to tap into the latest departure times and so on. This of course annoyed me a bit, especially because I couldn't really find someone else with the same issue.

When I reinstalled a watchface that was bought through KiezelPay (yes, you can buy watch faces nowadays, and I think you should if you find a neat one; devs put a lot of time into their products), the only thing I got was a big error message that KiezelPay and the internet could not be reached. Cue me mailing the watchface developer, who in turn hooked up the people from KiezelPay. I got a test app, which of course was also not able to reach the webs. Colour us baffled.

Pebble customer support didn't seem to be able to help me either, as they asked me to look into battery saving settings and such. A valid course of action of course, but my Nexus 6P doesn't have the really aggressive battery savers of some vendors, and everything had been working just fine for years before.

The only thing that I could think of was me updating to Android 7.0. I didn't remember whether the issue had been around before that, so I was kind of focussing on that now.

Meanwhile, the Modular dev (Modular is a great watch face, you should check it out if you have a Pebble, or buy a Pebble because of it), and the Kiezel devs were keeping contact with me, and reaching out to their contacts within Pebble. A suggestion came back about the Overlay permission. This "Draw over other apps" permission, as it's called in the Android settings, allows an app to draw a window or similar on top of the app you are currently viewing. This can pose security problems as it can draw a fake button, so if you install an app, Android refuses the "Install" button to be enabled if it detects a screen overlay. Same when trying to change app permission settings.

As I had been experimenting with some apps and encountered the "Screen overlay detected!" warning a few too often times, I dove into the app permissions and found quite a few apps that had the "Draw over other apps" permission enabled. I disabled it for a few apps where I couldn't think of a good reason to have it and didn't think about it anymore until the suggestion from the Kiezel dev came in.

Low and behold, if I enabled it for the Pebble app again, all Javascript apps on my watch were able to connect to the internet again just fine. It only took me two weeks or something to find this out...

I still think it's a weird permission and I wonder how it is connected to the ability of Pebble apps to connect to the internet straight from the watch (of course, routed through your phone). In the meanwhile, I'm happy the issue has been resolved, as it was quite the mystery. Not having any related problems popping up on internet searches isn't something I'm used to anymore. I hope this little article might help any other persons that might run into this (admittedly, obscure) problem.

  • Michiel Scholten
  • Train
  • 🕔

How to fix Secure Settings on Android devices with SuperSU systemless root

Edit at 2017-01-21: see the comments about better ways, especially comment 6.

Secure Settings (Google Play) is a really helpful app to help Tasker (Google Play) do things automatically on your Android device.

However, it has not been updated for quite a while (January 2015 at the time of this writing) and since then SuperSU has changed its way of installing the su binary to your device, by preferring not to install this on the system partition.

As some older apps hardcode the complete path of this binary in their checks, and Secure Settings is one of these, it thinks it can not get root access.

On my quest of a fix for this problem, I found this post on XDA where a comment on Reddit was referenced, stating the following fix, running the commands from a command line (terminal) on your machine, having adb installed:


adb shell
su
mount -o remount,rw /system
touch /sbin/su /system/bin/su /system/xbin/su
mount -o remount,ro /system
exit
reboot

source

This creates some empty files in locations that older (incorrect) apps check for the su binary, so Secure Settings (and likely other applications) are made to believe they can get root (which they actually can, as you can not make those files without being root through su anyway).

You can also do this on your device by just omitting the first line and starting with su in a Terminal app (or for example JuiceSSH in a local session).

I hope this helps other people looking for a solution too.

  • Michiel Scholten
  • Work
  • 🕔

Nienke says "Hello World"

In the night of Sunday to Monday, at 4:17, Nienke rushed into this world. Where Daan took his time being delivered, I was barely awake (Ineke woke me at 4:01) when Nienke saw her first lamplight.

Needless to say, she was born at home, in the tub where Ineke thought she was going to relax a bit while the contractions that started at around 1AM where building up; the delivery went well (thankfully so, as the midwife/verloskundige wasn't even there yet - I was telling her live what was happening while she rushed to our place where she arrived just minutes late), and both Nienke and Ineke are fine, be it tired.

Of course, this was already a few days ago, so we had some interesting times already. She's doing great; a lot more quiet than Daan used to be her age, which is really welcome. We are enjoying our ruined nights, but are relaxed. Daan is being the sweet big brother.

Official "Hello World" post

  • Michiel Scholten
  • Home
  • 🕔

dammIT: 12 years of rants

Today it's 12 years ago I officially started this weblog and I finally have taken some steps to get the next generation of the codebase working on my server. It's getting there, looking forward to continue dammIT in its Django incarnation :)

This year has been fascinating; junior went from barely walking to running around, thrashing the place while ranting about the wind blowing a bit too hard outside. In the meanwhile, junior number two is about to be here too, so I'm sure next year we are going to have a really interesting, sleepless time.

Looking forward to all the weird, frustrating, wonderful, funny things waiting for us!

  • Michiel Scholten
  • Home
  • 🕔

I made a thing to make your phone go 'pling' (when your train goes 'whatever')

I made a thing: https://pypi.python.org/pypi/nsapi.

You can use it with my other thing at https://github.com/aquatix/ns-notifications to get notified when your train is late, or to know when you can do a sprint upstairs on the next station because your otherwise impossible transfer is delayed a bit and you can catch it now.

See the settings_example.py and the ns-notifications README to configure.

Enjoy!

PS: yeah, it makes use of the official Nationale Spoorwegen (NS/Dutch Railways) API, and you need to request a key with them to use it. That's easy though and worth it if you like timely notifications.

  • Michiel Scholten
  • Home
  • 🕔

« Old rants