Skip to content

Instantly share code, notes, and snippets.

View Lovor01's full-sized avatar

Lovro Hrust Lovor01

  • makeITeasy
  • Zagreb
View GitHub Profile
@Lovor01
Lovor01 / OpenSSL prepare self signed certificate.md
Last active April 30, 2024 14:45
OpenSSL prepare self signed certificate

Solution 1

..\..\bin\openssl req -x509 -sha256 -nodes -config ..\openssl.cnf -days 1095 -newkey rsa:2048 -keyout altius.duckdns.org.key -out altius.duckdns.org.crt -set_serial [set number here]

ili

$env:OPENSSL_CONF = 'C:\Wamp.NET\servers\2-apache-2.4.57\conf\openssl.cnf'
..\..\bin\openssl req -x509 -sha256 -nodes -days 1095 -newkey rsa:2048 -keyout altius.duckdns.org.key -out altius.duckdns.org.crt -set_serial [set number here]
@Lovor01
Lovor01 / Database_cmd.md
Last active April 30, 2024 11:31
Database mysql/mariadb command line

Export database

mysqldump <database> --password=<password> --user=<user> --default-character-set=utf8 > <file>

on windows, use --result-file=<file> as default export is in UTF16

(or mariadb-dump)

Import database

@Lovor01
Lovor01 / Core secrets.md
Last active April 20, 2024 10:35
Block editor secrets

Core secrets

Block scripts and styles enqueueing

registration

wp-includes/blocks.php - register_block_from_metadata

enqueueing

@Lovor01
Lovor01 / Create Symbolic link win powershell.md
Last active April 12, 2024 21:33
Create Symbolic link in powershell
@Lovor01
Lovor01 / malware.md
Last active March 15, 2024 13:16
WordPress Malware detection

A list of WordPress malware tools

@Lovor01
Lovor01 / Replace.php
Created October 21, 2023 16:31
Replace srcset
<?php
/**
* add sizeSlug attribute where it is missing and update image src accordingly
*/
// alternative only for fixing sizeSlug:
// wp search-replace '(<!-- wp:image\s{(?!.*"sizeSlug")[^}]*)' '$1,\"sizeSlug\":\"full\"' gr8_posts --regex --regex-delimiter='/' --include-columns=post_content --log=C:\Users\Admin\Downloads\replace.log --precise
@Lovor01
Lovor01 / Remove-remote.md
Last active October 3, 2023 21:28
Remove file/directory from remote repository

Remove remote file or directory

// file
git rm package-lock.json --cached
// directory
git rm -r directory --cached

then commit changes

@Lovor01
Lovor01 / wp.md
Created September 29, 2023 10:08
WP recepies

Install plugin

wp plugin install create-block-theme --activate
@Lovor01
Lovor01 / unregister ctrl+k.js
Created September 23, 2023 20:47
WordPress: Unregister shortcut key ctrl+k (cmd+k)
wp.domReady( () => {
const unsubscribe = wp.data.subscribe( () => {
const command = wp.data.select( 'core/keyboard-shortcuts' ).getShortcutKeyCombination( 'core/commands' );
if ( command && command.character === 'k' ) {
wp.data.dispatch( 'core/keyboard-shortcuts' ).unregisterShortcut( 'core/commands' );
unsubscribe();
}
@Lovor01
Lovor01 / docker-compose.yml
Created September 14, 2023 18:11
Create WordPress environment in Docker
services:
db:
# We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:latest
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password'
volumes:
- db_data:/var/lib/mysql
restart: always