Skip to content

Instantly share code, notes, and snippets.

View tsarouxas's full-sized avatar

George Tsarouxas tsarouxas

View GitHub Profile
@tsarouxas
tsarouxas / whatissoslow.php
Created March 19, 2025 10:22 — forked from Viper007Bond/whatissoslow.php
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@tsarouxas
tsarouxas / install-wp.sh
Created December 11, 2024 18:08 — forked from BFTrick/install-wp.sh
Download & Install WordPress via Curl
curl -O https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress site
rm latest.zip
@tsarouxas
tsarouxas / nginx-tuning.md
Created November 29, 2024 05:40 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

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.

@tsarouxas
tsarouxas / migrate-woocommerce-orders.php
Last active February 17, 2024 19:08 — forked from cfaria/migrateorders.php
Migrate WooCommerce Orders
<?php
//increase max execution time of this script to 150 min:
ini_set('max_execution_time', 9000);
//increase Allowed Memory Size of this script:
ini_set('memory_limit','960M');
/*
#Migrate Woocommerce Ordersmysqldump -u db_user -p db_name > old.sql
@tsarouxas
tsarouxas / delete-cpt-entries.sql
Created July 7, 2023 12:27 — forked from gregghenry/delete-cpt-entries.sql
Delete Custom Post Type and Post Meta via MySQL
# You made a backup right? Ok....
# I needed this because I had over 100k posts in a CPT and deleting was a pain.
# This doesn't take into account any categories or revisions, so keep that in mind. You can use a plugin to clean those up or edit this to your liking.
# The first select statement you can run to determine if you have the correct records you want to delete.
# Change 'custompost' to whatever your custom post type is called.
SELECT DISTINCT ID, post_title, post_type, post_status
FROM wp_posts a
LEFT JOIN wp_postmeta b ON ( a.ID = b.post_id )
WHERE a.post_type = 'custompost'
@tsarouxas
tsarouxas / simple-map-defer.php
Created October 27, 2020 11:56 — forked from nfsarmento/simple-map-defer.php
[WordPress][Simple Map] Load Google Maps API script from Simple Map deferred.
<?php
defined( 'ABSPATH' ) or die( 'No direct access here.' );
/**
* Plugin Name: Simple Map | Defer
* Description: Makes sure Google Maps API script from <a href="https://wordpress.org/plugins/simple-map/">Simple Map</a> gets loaded deferred.
* Author: Caspar Hübinger
* Author URI: https://profiles.wordpress.org/glueckpress
* Plugin URI: https://gist.github.com/glueckpress/56c88900aad391b95b5d44f4e752a1a4
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
@tsarouxas
tsarouxas / mac-os-mapping-keys-uk-keyboard.md
Created July 28, 2020 08:02 — forked from sorenlouv/mac-os-mapping-keys-uk-keyboard.md
Map tilde sign (`) to section sign (§) on MacOS (useful for UK keyboards)
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035},{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064}]}'