Yet another web developer blog

Knowledge base

Useful static information about web developing, system administration, automation an other cool things

Recent updates:

Using systemd as user service manager with systemctl and journalctl in userspace

Common systemd usage is to manage global linux services, that can be created/modified only with root/sudo credentials.

But systemd have the great user mode, that allow to create and control any services without sudo permissions, that runs as user owner, we simply need to add the `--user` argument.

For allow to start user services on system boot, you must one-time launch the command for needed user: sudo loginctl enable-linger LOGIN


Delete all available tables on PostgreSQL database without schema permissions

    r RECORD;
    FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP
        EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE';
END $$;

This query will delete all available tables for current user and schema, without needs to have SCHEMA privileges.

The most popular solution via:


Often shows the error, because of missing owner permissions or other restrictions:


How to eval PHP code via drush without escaping quotes routine

Very often there is a need to execute via drush eval command the PHP code with both single and double quotes, something like this:

echo "Hello, '$username'!"; 

This can be quickly done without manually adding slashes to each quote in PHP code via this bash trick:

PHP=`cat <<'EOF'
echo "Hello, '$username'!"; 
EOF`; drush ev "$PHP"

Instead of single line of PHP code, you can insert long multi-line part of code, without carrying about escaping quotes.


How to view and revert installed schema version of module in Drupal 8, 9

After executing hook_update_N functions, Drupal stores last version of installed updates in his key-value storage, if update function executed without exceptions.

You can simply lookup installed version via command-line drush command:

drush ev "var_dump(drupal_get_installed_schema_version('my_module'))"

Sometimes you may need revert version to previous, for re-apply updates, or repeat updates, if they previously executed with problems.

You can set previous version of Drupal module schema version via this cli drush command:


How to disable auto switching Bluetooth from A2DP to HSP profile on Skype calls in Linux

If you use Bluetooth headset, you probably have bad quality of voice in VoIP calls via Skype and other apps. This happens on Linux and on Windows too.

This happens because when an application starts a call - it create a recording stream with property media.role=phone (telephony applications should set that property for their streams), and PulseAudio switch profile of your Bluetooth Headset from A2DP (Stereo high-quality one-way channel) to HSP/HFP (Mono low-quality 2-way channel for voice-only).