Sander's Blurbs

Menu

Month: January 2022

How to develop a library and a project in PHP concurrently

I keep forgetting the best way to do this, so thought it best to write it down.

Suppose you are building a library and an example project that implements it. You can do this in a single repository with an example folder, for small examples.

But for larger examples you might want to use a separate repository, with it’s own issues and documentation.

This can make it a hassle to work with the library and keep the project in sync.

Let’s say these are mylibrary and myproject which is using the library. Let’s assume you’re using PHP and Composer. mylibrary is at version 0.1 but there are newer commits in the develop branch.

Require a Git repository

$ cd myproject
$ composer config repositories.me vcs https://github.com/me/mylibrary
$ composer require me/mylibrary:0.1 --prefer-source

--prefer-source means Composer will install from source if there is one, the result is a git repository.

Switch to the develop branch

Once installed it’s then easy to switch to any other branch you want to work on:

$ cd vendor/me/mylibrary; git switch develop

You don’t have to register the repository with packagist if you follow this workflow! As a bonus when after you run composer update in myproject the mylibrary directory sticks with the branch.

Daily Clean Trash

I use trash-cli on every linux install, and today I realised it’s not actually removing files from the trash, so I’ve set up this little scheduled task to delete items that have been trashed at least 30 days ago:

$ crontab -e
# daily trash clean
@daily /usr/bin/trash-empty 30

OpenSUSE Tumbleweed Installation Notes

For future reference here are some issues I’ve come across installing and setting up Tumbleweed on my workstation.

The reason for switching from macOS is that a commercial operating system focused on services builts in too many distractions for me. Also long term the Apple hardware is priced above what I’m prepared to pay, so it makes sense for me to look for an alternative.

Tumbleweed is a rolling distribution which makes for a long term maintained setup, and packages are tested thoroughly but are quickly updated.

So far these are just little niggles.

Day one issues

  • The old Grub menu from my previous Linux installation wasn’t wiped, I simply reinstalled making sure all existing partitions were deleted before partitioning.
  • avahi is not allowed to start itself due to security policies. This was because dbus needed to restart after avahi installed configuration into it. I could have rebooted.
  • My Apple Magic Keyboard must be selected in KDE after the installation as it’s not an option during the installation routine.
  • Opening ports for OpenSSH means that they’re open on the public zone. I didn’t realise this as I want to use the home zone as default.Yast Firewall sorted this out.
  • After installing Lutris, Steam and Proton Experimental, certain games would not start, due to missing vulkan drivers. This Lutris Wiki link describes the issue, I had to search Yast Software for vulkan showed I had to install libvulkan_intel and libvulkan_intel-32bit.

Interesting links

  • There’s a nice tiling window manager script for KDE called Krohnkite. Meta-D conflicted with show desktop, after reassigning the latter I still think that shortcut doesn’t do anything, though.

So far so good. The interface is more snappy than macOS and more powerful, and the system is working nicely.

Bye Twitter

I’ve deactivated my Twitter account.

Twitter didn’t like it, you get unceremoniously dumped out of the service with an error message. All your tweets disappear. Like you weren’t welcome anyway, social media with a nasty streak.

The problem with Twitter is that there’s only space for black/white arguments and replies. It harms compassion and collaboration. It’s algorithms are optimised for making money, not your wellbeing.

Let’s go make something beautiful instead with all the time saved!