Skip to content

Instantly share code, notes, and snippets.

View ValeriiVasyliev's full-sized avatar
🏄
Focusing

Valerii Vasyliev ValeriiVasyliev

🏄
Focusing
View GitHub Profile
@ValeriiVasyliev
ValeriiVasyliev / gist:0e36a142ee808b22747d75f2842abaab
Created October 21, 2024 10:28 — forked from doreybenjamin/gist:6ab21d0633f51c74548baa2dcf3e1e9d
Deploy to Kinsta Github Actions Bedrock/Sage9
#Go in your kinsta serv with ssh in terminal and make this two steps :
#1: cat ~/.ssh/id_rsa.pub and copy paste in user setting in kinsta and SSH KEY
#2: cat ~/.ssh/id_rsa and copy paste in secret SSH_KEY
name: Deploy to Kinsta
on:
push:
branches: [ main ]
jobs:
@ValeriiVasyliev
ValeriiVasyliev / nginx-tuning.md
Created June 27, 2024 04:48 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@ValeriiVasyliev
ValeriiVasyliev / Query
Created December 8, 2023 06:58 — forked from lukecav/Query
MySQL script to get all WooCommerce orders including metadata
select
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
max( CASE WHEN pm.meta_key = '_billing_state' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_state,
@ValeriiVasyliev
ValeriiVasyliev / install-composer
Created August 4, 2023 04:04 — forked from nem-c/install-composer
Composer for DevKinsta
## On you machine run:
docker exec -it devkinsta_fpm bash
## After you are logged change to /tmp
cd /tmp
## Install and configure composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
# phpstorm, webstorm
.idea/
/.vscode
/nbproject
/node_modules
# sublime and other ide
.project
*.sublime-project
*.sublime-workspace
@ValeriiVasyliev
ValeriiVasyliev / WP-REST-API--self-served.htaccess
Created June 20, 2023 03:46 — forked from ccurtin/WP-REST-API--self-served.htaccess
DISMISS PUBLIC ACCESS to WordPress REST API; ONLY ALLOW API ACCESS VIA SAME DOMAIN. ALLOW ADMIN ACCESS FOR ALL THOUGH.... for dynamic IPs... *Ideally*, the Server should be making the requests to the API, not the Client/User. That way, all API access is invalid except from the server. Use CORS and this snippet to block all WP access though.
# - DISMISS PUBLIC ACCESS; ONLY ALLOW API ACCESS VIA OWN DOMAIN
# - ALLOW ADMIN ACESS FOR ALL
#
# This example is in the "public_html/api/" folder where
# the WP API is installed.
#
RewriteEngine On
# If the referer is not its own domain
RewriteCond %{HTTP_REFERER} !^http?://architectura.com [NC]
# Then make it forbidden if not an admin login th
@ValeriiVasyliev
ValeriiVasyliev / composer.json
Created June 13, 2023 03:27 — forked from mcguffin/composer.json
PHPCS WordPress security check
{
"name": "mcguffin/wp-package-security-check",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"homepage": "https://gist.github.com/mcguffin/255909d4d7fcc241fe63363012553268",
"require": {
"composer/installers": "~1.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "*",
@ValeriiVasyliev
ValeriiVasyliev / wp-cli-replace-url.md
Last active March 10, 2023 15:32 — forked from davepullig/gist:efddb9a894e0c4a824b4b61183cfb01c
WP CLI search and replace URLs for WordPress multisite

If you are using subdirectories on multisite

wp search-replace  --network 'example.com' 'example.test'  --all-tables --dry-run 

then

@ValeriiVasyliev
ValeriiVasyliev / phpcs-security.xml
Created March 7, 2023 03:36 — forked from igmoweb/phpcs-security.xml
PHPCS just with security rules
<?xml version="1.0"?>
<ruleset name="Ignacio">
<description>Security reviews with PHPCS.</description>
<file>.</file>
<!-- Exclude the Composer Vendor directory. -->
<exclude-pattern>/vendor/*</exclude-pattern>
<!-- Exclude the Node Modules directory. -->
@ValeriiVasyliev
ValeriiVasyliev / nginx-wordpress.conf
Created February 10, 2023 04:55 — forked from nfsarmento/nginx-wordpress.conf
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}