Skip to main content
 

SecondLife is reinvesting in events

Improvements to the Events pages are in the works for 2020, too. You’ll soon see more functionality and a new look, such as the ability to set an alert on an event you want to attend, to follow your favorite event hosts, to share your event calendar with friends, and to see the latest event developments in a news feed. 

https://community.secondlife.com/blogs/entry/3016-the-return-of-last-names-and-changes-to-marketplac...

 

Making Recents more useful

Clean Recents list

So if you open Recents in the sidebar it's likely it's full of files you have no idea you recently opened. It's most likely that you didn't. We can make Recents more useful by restricting the last opened date, and make using it more convenient. This is how:

  1. Open Finder, then Recents in the sidebar.
  2. From the cog menu, select Show Search Criteria, add a criteria via the plus button.
  3. Change the filter name to Last Opened Date within last 14 days and press Save.
  4. Name it My Recents, and enable Add to sidebar.
  5. From the sidebar, drag the smart search into the dock next to the Trash.
  6. Optionally remove the recents icon from the sidebar. You can restore the item via Finder > Preferencers > Sidebar by dragging it back in.

As a bonus tip, update  the icon for the smart search (just like any other folder and app) as follows:

  1. Open /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ and search for "Recents" to find the current Recents icon, or choose an alternative.

  2. Right click on the My Recents icon in the sidebar and choose Get Info.

  3. Drag the preferred icon from the folder into the icon slot in the top left of the Get Info window.

This changes the icon in the window title, but I haven't found out how to change it in the sidebar.

 

Working with Two SSH keys

If you're working with two SSH keys (work / personal) then the following setup is quite elegant. It assumes all repositories are work related, unless they're hosted under your own user:

Host *
 AddKeysToAgent yes
 UseKeychain yes
 StrictHostKeyChecking no
 User git
 IdentityFile ~/.ssh/id_rsa_corporate

# personal account
Host github.com-MYUSERNAME
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa

 

Howto setup Python in Pop!_OS 19.10 or Ubuntu

A new OS, another two hours wasted. Pop!_OS 19.10 comes with Python3.7rc5, which is nice but my project requires 3.6 just now. As you know we've gone through this before, but this time we can setup multiple python version support.

Let's setup pyenv, pip, pipenv and then install another python version.

# Setup pip.
curl
https://bootstrap.pypa.io/get-pip.py | python

# Pip can setup pipenv.
pip install pipenv --user

# Manage multiple python versions through pyenv.
# @see https://github.com/pyenv/pyenv/wiki/Common-build-problems

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
curl https://pyenv.run | bash

Follow the instructions to add pyenv to the path. Now we can do stuff like:

# install another python version.
pyenv install 3.6.9

# OR let pipenv do it.
cd ~/dev/myproject
pipenv install --dev

Leave a comment if you have any issues, as this was written retrospectively.

 

Informed reasoning

I'm starting to realise how often I say good / great / well without being explicit about what I think is positive about something. Trying to replace ‘that is a good idea’ which only communicates my positive assessment with the explicit thing I appreciate so people can make their own assessment based on their values. Maybe this thought helps someone else!

 

NPM global installation permission issues on macOS

I had trouble installing global npm packages, which failed due to permission errors. I don't want to use sudo as this will lead to problems later, and I don't want to set the global installation directory to a local directory, as that means other users don't have access to the packages.

As recommended by the NodeJS documentation this is best fixed by installing node via a version manager.

First, remove node which I incorrectly installed with homebrew:

brew uninstall node

Then install nvm as per the official instructions. In my case this also failed as this is a new system that doesn't have a .bash_profile yet. Hower as I wanted to install the zsh shell, I installed oh-my-zsh as per the instructions on their site.

Once zsh was installed (or you've created a .bash_profile using touch ~/.bash_profile, you can install node in a correct manner as follows:

nvm install node

Happy yak-shaving!

 

 

 

Carbon 0.3

It seems today is 0.3 day, as I'm also releasing Carbon 0.3, my hackable performant semi-static blogging system.

This release mainly deals with technical debt as I first started this project 6 years ago as a playground for figuring out how a CMS is written from the ground up. This means there are out of date requirements, references to a Windows platform with Powershell and other such bad examples.

That said the codebase isn't in a terrible state although it will have to change significantly before it's production ready. If you know a bit of PHP then after a short study it can be customised to your needs quite easily.

So, if you're interested you can use it and quickly whip together a documentation or simple blog using only markdown files. It will produce a feed and there's even a half baked cli application and static site generation that I have to review before I can recommend it in honest.

carbon 0.3 theme

Have fun hacking!

 

Fresh Cookies 0.3

I've released Fresh Cookies 0.3, my browser extension for limiting the lifetime of browser cookies to a maximum of 15 days.

It is now a web extension and can be manually installed in Firefox (it also works in Chrome). I'm looking for feedback before I'm ready to submit it any extension directories.

 

Hassle-free Python project setup

Today I managed to break pipenv again to a point where I cannot install any project requirements. Let's document the process to prevent this happening again in the future.

Python3.7 and pip are already installed on OpenSUSE Tumbleweed. If you're not so lucky, read the page on https://docs.python-guide.org/starting/install3/linux/ but stop at the bottom of the page, as I find the installation method used for pipenv there too brittle.

Instead we're going to install pipx which is best described as a per-command environment for python executables. This is great for packages like pipenv which can then run without conflicts. pipx also keeps the packages updated.

python3 -m pip install --user pipx
python3 -m pipx ensurepath

We can then use pipx to install pipenv:

pipx install pipenv

I prefer to keep the virtual environment within the project folder, by adding the following line to .bashrc or .zshrc:

export PIPENV_VENV_IN_PROJECT=1

With pipenv in place we can create a per-project virtual environment and activate it:

cd ~/dev/myproject
pipenv shell

We can install our packages into the environment now:

pipenv install pylint --dev
pipenv install black --dev --pre

The missing step in a lot of guides, is that you later might want to call your script from outwith your virtual environment, without explicitly activating it as you would do when working on the project itself. You can do that thusly:

$(pipenv --venv)/bin/python myscript.py

 

On Settled Status

So ehm... when a person requires the NHS emergency services post Brexit, how do the staff know that a person is an EU citizen that might requires an online settled status check (which in turn requires a passport, identity card or biometric residency card) and not a UK citizen which doesn't need to (and can't) be checked? If we exclude all measures that are discriminatory?

So either all UK citizens also take their passport with them going forward as well; or this is going to end in discrimination for people  including, but not limited to, those with an accent, "look foreign", UK citizens that've lived or studied abroad (affecting their speech), people speaking another language, or any other identifying marks or clothing.

As not all UK citizens have passports however,  the NHS cannot use the Home Office provided website  to rule out they're an EU citizen. That's just as well as the website doesn't work for UK nationals, it would only tell them they don't have settled status.

As a result this makes the process essentially voluntary for people who self identify as an EU citizen and want to be discriminated against.

Hey where are you from? London. You don't sound British? I was born in England but studied in Amsterdam.

The process isn't fit for purpose.

 

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.