Skip to main content
 

My Let's Encrypt Setup

Scheduled Task (renewal)

$ sudo crontab -e

# Lets encrypt twice daily
0 7,19 * * * certbot -q renew

 

Script that reads le.txt and requests certificates for each domain

$ nano le.sh && chmod +x le.sh

DOMAINS=$(paste -s -d, le.txt)
sudo letsencrypt certonly --webroot -w /var/www/html -d $DOMAINS
sudo service nginx reload

Note: Recently certbot changed from seperating each domain with -d to comma seperated.

List of Domains (one per line, add to the end)

$ nano le.txt

vandragt.com
www.vandragt.com

 

 

PHPStorm font rendering on OpenSUSE

On Ubuntu LTS the font rendering on 2019.1 looked great by default, but on Tumbleweed I needed to tweak the settings a little to get the editor to look good. There is conflicting information out there for out of date versions of OpenSUSE and PHPStorm and it took a bit of research to figure out what works for me.

Under Help | Edit Custom VM Options... I added the following lines:

-Dswing.aatext=true
-Dawt.useSystemAAFontSettings=on

I also set antialiasing (within the main PHPStorm Settings | Appearance menu) to greyscale.

Finally, I added the Dreamweaver CC colour scheme to the editor by saving the xml file in ~/.PhpStorm2019.1/config/colors/.

Restart the application and select the color scheme from File | Settings | Editor | Color Scheme

Sources: sheelahb.com

 

 

WorkLog 2.2

WorkLog.py is a very simple script that allows you to keep track of what you are working on by writing a timestamped message to a CSV file.
It turns out it helps me stay on track during a long day of work.

Version 2.2 has some new quality of life improvements:

v2.2:

* ctrl-d or enter to quit.
* works on python2 default systems.
* f-strings,
* code more elegant.
* day based csv files.

https://gist.github.com/svandragt/080843c4ba632deaab6f3aea57ca9684

 

Fixing Virtualbox host network adapter cannot be created error

If when trying to start a vm, for example using vagrant, you get the error message that the host network adapter cannot be created:

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 94 of file VBoxManageHostonly.cpp

Make sure to first start the virtualbox GUI application. It does some extra checks, and sometimes highlights the permission problem:

In my case (OpenSuse 15.1 Leap), my user was not added to the vboxusers group. Via Yast > Users and Security .... and editing my user account it was a simple checkbox away. Remember to relog.

If that doesn't work, reloading the kernel extensions could help:

$ sudo dpkg-reconfigure virtualbox-dkms
$ sudo dpkg-reconfigure virtualbox
$ sudo modprobe vboxdrv
$ sudo modprobe vboxnetadp

 

WordPress Canonical URLs for Category/PostName Permalinks

When the permalink format is set to %category%/%postname%/ then a post is available under category/postname links for all categories, as well as under all parent/child/postname links.

If you use Yoast SEO and have set a primary category, that  becomes the canonical URL that's used for SEO. If you don't then the postname for whatever category has a lower ID (was created first) becomes the canonical URL.

 

What is the meaning of a site's Last Updated property?

When running a WordPress multisite, in the site directory each site has a Last Updated property. I previously incorrectly assumed this reflected  when the site's metadata changed, for example the site's attributes. However, archiving and deactivating a site does not change the Last Updated value, so what does it do in WordPress 5.2.1?

As usual the best place to look is the WordPress codebase. It turns out that, on a multisite, this value is updated whenever a post is updated or deleted. It reflects the last content update, not the site's metadata.

By inspecting the html and looking up the property name, we find that the function that updates this is called wpmu_update_blogs_date and there is an action hook wpmu_blog_updated that receives the site_id variable. This function can be called whenever we want to update the value. It isn't used anywhere else.

If we're looking to update this date whenever the site's status changes, then via the same process it appears that he actions to hook into site attribute updates are in wp_maybe_transition_site_statuses_on_update so one could write a quick mu-plugin that updates the Last Updated property whenever these fire.

 

Fix for Google Chrome Bouncing Forever in the macOS Dock

I had the issue where it was not possible to launch Google Chrome. It would bounce in the dock forever without actually starting. Trashing the application and associated files (with Hazel) did not work.

Other people had the same problem:

The following instructions will help get Chrome back up and running.

The Fix

The solution to this issue is to remove all application settings. Start a terminal:

cd "/Users/`whoami`/Library/Application Support/Google"
mv Chrome Chrome.old
mkdir Chrome
open "/Users/`whoami`/Library/Application Support/Google"

Now start Chrome. If it starts correctly, trash the Chrome.old folder. 

Restoring the folder

If the fix did not work in your case, use the following commands to restore the original folder.

rm -rf Chrome
mv Chrome.old Chrome

Good luck!

 

Countdown - a bash countdown timer

I was looking for a tea timer countdown but quickly realised I might as well use a countdown script for this. I based my script on the linked script but added a customizable notification at the end

$ nano ~/bin/countdown
#!/bin/bash
# v2 - 2019-05-01
secs=$1
msg=${2:-$1 seconds passed.}
while [ $secs -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done
notify-send 'Countdown Finished' "$msg"

$ chmod +x ~/bin/countdown
$ countdown 180 "Tea is ready."

 

macOS doesn't use a swap file when running from an external SSD

So I was seeing graphical glitches, freezes and Activity Monitor indicated memory pressure. Turns out macOS doesn't mount a swap file, as I am running from an external SSD install.

This is easily fixed. I can't believe it is a problem though.

By the way I had to change the end of line 4 (because the command in the Ask Different answer returned multiple results) to:

VM_VOLUME=$(/usr/sbin/diskutil list | grep "VM" | awk 'NR==1{print $7;exit }')

It's easy to add the launch item using Lingon X and start it with sudo ./mountvm.sh for the current session.

 

Stop OpenPGP passphrase prompting on login

As a security conscious person I setup my OpenPGP keys with a passphrase, however on OpenSUSE Leap 15 this causes a login prompt to appear that delays the network connection from initiating. The same issue also blocks software updates and means a browser restart due to DNS cache stopping connections to websites. This is fairly annoying.

It turns out that this can be fixed by sharing the network connection via Connections > open the connection > General Configuration > All users may connect to this network. This causes NetworkManager to cache the required  authorization tokens (this is my understanding).

Note that other software such as Kontact might set a daemon to startup by default, causing the same prompt. This can be unticked in its settings.

If everything else fails, then you could remove the passphrase for the PGP key but this is not recommended as this means someone can take on your identity should your key be exposed for any reason.

 

On doing good work

Aka why I keep having bad customer experiences.

Assuming the idea of a business (and us when we represent it) is to stay in business then it should aim to make the customer (a fellow person) happy as happy people are loyal.

This means the person needs to understand what the other person wants from the transaction to be happy. It also means both parties must understand the details of the transaction to know how this makes them happy. The product must be understood  to ensure maximum happiness.  And finally if the product or service offered is not making the customer happy then it’s the responsibility of a good business to help the customer find happiness another way. 

Doing good business is about understanding people, and having empathy. 

This is also why why car dealerships keep disappointing me. Stop pushing product. Start making people happy. 

 

Updating Known

I wrote a quick and dirty upgrade.sh script that sits in the parent directory of my Known site (updated now with the new composer setup). I'm using the following directory structure:

config.ini  
Uploads/
html/
upgrade.sh 

The offical Known git repository is checked out in html/. The config.ini and Uploads folder have been moved to the folder to sit alongside it.

The contents of the upgrade.sh script can be viewed as a gist on Github:

It's not elegant but it makes updating to the latest Known changes pretty seamless.

 

Spotify how to hide the "Find friends" bar

On Linux operating systems, Spotify does not always show the file and view menus. This makes it harder to hide the "Find Friends" bar as there is no close button on the sidebar itself.

However there's another way: Click on the chevron in the top right corner next to your spotify username, then on Settings > Display Options > untick Show Friend Activity.

 

Install Python 3.7.1 on OpenSUSE Tumbleweed

After another hour of resolving issues with pyenv and a personal project that requires Python 3.7 I thought it best to note the steps I used to install Python 3.7.1 on OpenSUSE Tumbleweed:

# Install requirements for compiling Python
sudo zypper in zlib-devel bzip2 libbz2-devel libffi-devel libopenssl-devel readline-devel sqlite3 sqlite3-devel xz xz-devel 

# Compile Python
cd ~/Downloads
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
tar xf Python-3.7.1.tar.xz
cd Python-3.7.1
./configure
make

# AltInstall ensures 3.7.1 is installed alongside your system python
sudo make altinstall

# Fix dynamic library loading
sudo ln -s /usr/local/lib64/python3.7/lib-dynload /usr/local/lib/python3.7/lib-dynload

I've updated the Common build problems · pyenv/pyenv Wiki page to reflect the updated required packages. Thanks to Andrew Cooke for the dynamic library fix

 

The Milk Chocolate Peanut

Aaron Gustafson wrote back in 2008:

Getting into the progressive enhancement mindset is quite simple: just think from the content out. The content forms the solid base on which you layer your style and interactivity. If you’re a candy fan, think of it as a Peanut M&M:

The Chocolatey Layers of Progressive Enhancement

JavaScript first websites have the peanut inside out!

 

Hide Trackbacks 1.1.3

Hide Trackbacks is a WordPress plugin that hides pingbacks and trackbacks from your website comments.

I’ve updated the plugin to indicate it works correctly with WordPress 4.9.9 and earlier. It's now also up to PHP 7.2 compatible, and has a number of small fixes to improve code legibility and alignment with the WordPress Coding Standards.

 

Transitioning to Gutenberg

The WordPress Project says:

The Classic Editor plugin will be officially supported until December 31, 2021.

[...]

Since the Classic Editor plugin is central in this transition, we are considering including it with upgrades to WordPress 5.0.

In the context of my professional work with WordPress it would be beneficial to see the Classic Editor plugin be included by default into the installation package. This would signal to plugin and theme developers that we are in a transition phase but supporting the existing installations, until Gutenberg is more fully accepted by the wider community. Not doing do could put pressure on smaller developers to just test their updates for Gutenberg only, resulting in a lot of broken sites or a security nightmare where people won’t be able to update to the latet versions of WordPress or their plugins until the teams and processes are ready.

 

Taking back control

Recently, I've come to the conclusion that it's the nature of realtime social media to cause drama and upset. In the search for ever increasing thirst for gossip, instant reactions are stimulated so heavily that  there is no time to research or read about the context of a story, and open discussion isn't possible when group mentality means we must be outraged or be part of the problem.

At the same time, people have never engaged so little with web content, being the metaphorical frogs in the pressure cooker of Facebook and Twitter that is modern society. We are the product that is monetised by the advertising dollars that demand page views in a broken system of inflatable viewership figures.

In the music scene, the illusion of hyper promotion and like-networking results in a feed of people and content I have little interest in following, in the hope that they will listen to what I have to say.

Pointless and bad for my health. So therefore I'm distancing myself more from social media now.

If you want to follow what I have to say about technology, read vandragt.com. If you are interested in my music visit cloudseer.me. They will soon have a mailinglist and RSS feeds without advertising and like buttons.

 

Howto install Cryptomator for OpenSuse

Linux is so userfriendly, so the rpm that can be downloaded is missing dependencies. However, I'm quickly becoming a fan of zypper and OpenSUSE's dependency handling, and comes to the rescue:

sudo zypper in cryptomator.rpm

Even though cryptomator made a mistake in signing part of the application, it can still be installed by pressing ignore. Are you sure you want to do that? It seems a bit crap for such an essential utility.

 

Installing Dropbox on OpenSUSE Tumbleweed

Both the official RPM and the discover package failed for me due to missing dependencies, without specifying what those are. However the following worked:

sudo zypper install dropbox-cli
dropbox start -i
dropbox autostart