Jul 13 2024

proxmox import vm from kvm

Create a new VM in the web interface (leave other settings as default)
copy VM disk to proxmox (ex. using terminal) and import it to newly created VM machine
qm importdisk machine_id_number /var/lib/vz/images/file.qcow local-zfs
qm rescan

Go to your new created VM in the proxmox web interface.
Go to the Hardware section of the newly created VM in the Proxmox web interface
Look for the Unused Disk and select it.
Then you have to add the disk by clicking on Edit on the top.

Jul 13 2024

Reducing the size of a QEMU virtual disk (thin disk)

On all mounting points
dd if=/dev/zero of=/nul;sync;sync;sync;rm -f /nul;sync

    Stop VM
    Convert disk

qemu-img convert -O qcow2 -c disk1.qcow disk1.new.qcow

Jun 28 2024

AC power notify

upower -i $(upower -e | grep '_AC') | grep "online"

Jun 20 2024

mysql repair all tables

mysqlcheck -u root -p --auto-repair --check --all-databases

Jan 14 2024

Unboud (DNS) – listen on IPv4 only

Add to /etc/unbound/unbound.conf

server:
interface: 0.0.0.0

Jan 14 2024

TMUX

split-window -h: Ctrl+b %

split-window -v: Ctrl+b ”

 

 

 

Sep 14 2023

wrong Video codec on Opera Linux Mint

Linux Mint

install chromium and

mv /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so.orig
ln -s /usr/lib/chromium/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/

Linux Arch

install electron37 and

mv /usr/lib64/opera/libffmpeg.so /usr/lib64/opera/libffmpeg.so.orig
ln -s /usr/lib/electron37/libffmpeg.so /usr/lib64/opera/
Sep 9 2023

MSSQL restore all databases from folder with .bak files

Powershell

Install-Module dbatools
Import-Module dbatools
Set-DbatoolsInsecureConnection -SessionOnly
Restore-DbaDatabase -SqlInstance SERVER-NAME\INSTANCE-NAME -Path 'C:\PATH-TO-BACKUPS'
Sep 2 2023

MSSQL: User, group, or role ‘platnik’ already exists in the current database.

lists logins and incorrect SIDs
USE <platnik_db>
GO
EXEC sp_change_users_login 'Report'
GO

Then start SQL
USE <platnik_db>
GO
EXEC sp_change_users_login 'Auto_Fix','<user_name>',NULL, '<password>'
GO

Sep 2 2023

Delete multiple databases in MSSQL

drop databases query

USE master;
Go
SELECT 'DROP DATABASE ['+ name + ']'
FROM sys.databases WHERE name like 'PREFIX%';
GO