Skip to content

Instantly share code, notes, and snippets.

View Kaapiii's full-sized avatar

Markus Liechti Kaapiii

  • Payrexx AG
  • Switzerland
View GitHub Profile
@Kaapiii
Kaapiii / command-fix.md
Created August 4, 2020 13:33
PHPStorm mysqldump throws errors while dumping a database on MySQL server version >= 5.7.31

Fix errors while executing mysqldump (with PhpStorm) on a database running on MySQL 5.7.31 and above.

(Dump worked seamlessly with mysql version 5.7.30)

Errors

  • mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
  • mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'concrete5com' AND TABLE_NAME = 'AreaLayoutColumns';': Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

Fix

Fix the errors by adding the two following flags to the mysqldump command in PhpStorm

@Kaapiii
Kaapiii / fix-vgacon-disable-amdgpu.md
Created April 16, 2020 13:58
Ubuntu 19.10 and Ubuntu 20.04 (beta) - "Unknown display" / Unable to detect multiple displays with Radeon rx570 gpu

Ubuntu is not able to detect multipble displays when using an gpu from AMD. Error "VGACON disables amdgpu ..."

When searching for graphics card with "sudo lshw -c video" on Ubuntu 19.10 or 20.04 (beta) the following error is shown:

# list graphics/video cards
sudo lshw -c video
#[drm:amdgpu_init [amdgpu]] *ERROR* VGACON disables amdgpu kernel mode setting.
@Kaapiii
Kaapiii / .htaccess
Last active November 12, 2019 15:19
Apache .htaccess and Nginx redirect all urls of a domain to the same copy on the new domain
RewriteEngine on
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
@Kaapiii
Kaapiii / ApiLoggerMiddleware.php
Last active November 4, 2019 16:39
Test for Concrete5 ApiLoggerMiddleware
<?php
namespace Concrete\Core\Http\Middleware;
use Concrete\Core\Logging\Channels;
use Concrete\Core\Logging\LoggerAwareInterface;
use Concrete\Core\Logging\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
@Kaapiii
Kaapiii / install_netextender_ubuntu_64_bit
Created April 22, 2019 19:51 — forked from egobude/install_netextender_ubuntu_64_bit
Install NetExtender | Ubuntu 64 Bit
1. go to https://sslvpn.demo.sonicwall.com/cgi-bin/welcome
2. log in with demo/password
3. click on NetExtender icon, this will download a tar.gz with the client
4. sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.6
5. sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.6
6. un-tar the client, make install script executable and launch install
@Kaapiii
Kaapiii / backup_files.ps1
Created September 25, 2018 14:13
Backup files by filter from source directory and copy them to a new folder prfixed with the current date
$backupSourcePath = 'C:\Test\Source'
$backupDestPath = 'C:\Test\Dest'
$currentBackupDir = New-Item -ItemType Directory -Path "$backupDestPath\$((Get-Date).ToString('yyyy-MM-dd'))"
Get-ChildItem -Path "$backupSourcePath\*" -Include *.txt,*.db,*.log -Recurse | Copy-Item -Destination $currentBackupDir
@Kaapiii
Kaapiii / Upgrade MariadDB CentOS 7
Last active May 30, 2018 19:07
Enable remote acceess to DB with plesk
https://support.plesk.com/hc/en-us/articles/213403429-How-to-upgrade-MySQL-5-5-to-5-6-5-7-or-MariaDB-5-5-to-10-0-10-1-10-2-on-Linux
@Kaapiii
Kaapiii / add_thumbnails.php
Created July 20, 2017 15:21
Concrete5 - Add thumbnail types programmatically
<?php
// Tested with Concrete5 version 8.2.0
$type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle('custom_100x100px');
if(!is_object($type)){
$typeEntity = new \Concrete\Core\Entity\File\Image\Thumbnail\Type\Type();
$width = 100; // px
$height = 100; // px || null for auto
if ($height > 0) {
$typeEntity->setHeight($height);
}
@Kaapiii
Kaapiii / DatabaseManagerORM.php
Last active June 9, 2017 14:39
Concrete5 - use a single EntityManager in version 5.7.5.6
<?php
namespace Application\Src\Database;
// store location: application/config
use Concrete\Core\Application\Application;
use Concrete\Core\Cache\Adapter\DoctrineCacheDriver;
use Concrete\Core\Database\Connection\Connection;
use Concrete\Core\Package\Package;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Setup;
@Kaapiii
Kaapiii / DatabaseServiceProvider.php
Created November 18, 2016 12:36
Eneabling Doctrine Behavioral Extensions in Concrete5 5756
<?php
//application/src/Database/DatabaseServiceProvider.php
namespace Application\Src\Database;
use Concrete\Core\Database\Connection\ConnectionFactory;
use Concrete\Core\Database\Driver\DriverManager;
use Concrete\Core\Foundation\Service\Provider as ServiceProvider;
class DatabaseServiceProvider extends ServiceProvider