Skip to content

Instantly share code, notes, and snippets.

@coresh
coresh / nginx-tuning.md
Created July 29, 2023 10:31 — 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.

@coresh
coresh / magento-nginx.conf
Created July 29, 2023 10:13 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
# !!!! If you are a Hypernode customer, do not use this config as it will result in duplicate statements. !!!!!
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
@coresh
coresh / Multirequest_curl.php
Created December 6, 2022 17:01 — forked from aalfiann/Multirequest_curl.php
Multi request curl php
<?php
function multiRequest($data, $options = array()) {
// array of curl handles
$curly = array();
// data to be returned
$result = array();
// multi handle
@coresh
coresh / deploy.sh
Created December 3, 2022 19:57 — forked from StenHigh/deploy.sh
deploy script for magento 2
#!/usr/bin/env bash
usage() {
echo "Usage: $0 [-e <staging|local>]" 1>&2; exit 1;
}
maintenanceEnable() {
touch maintenance.enable
php bin/magento maintenance:enable
}
@coresh
coresh / README.md
Created November 24, 2022 11:18 — forked from jesslilly/README.md
Deluxe Cron Job Wrapper

Cron Job Wrapper Wish List

I want a script that will give me:

  1. Logging
  2. Log purging!
  3. Email errors!
  4. Prevent duplicate processes! (flock)
  5. Source an environment file!
  6. Anything else?
function incrementFLoat($float){
echo $float."\n";
$decimal = strlen(strrchr($float, '.')) -1;
$factor = pow(10,$decimal);
$incremented = (($factor * $float) + 1) / $factor;
return $incremented;
}
function decrementFLoat($float){
// get amount of decimals
@coresh
coresh / parse_csv_file.php
Created January 5, 2022 19:39 — forked from m-manu/parse_csv_file.php
Useful CSV Parser for PHP 5.2
<?php
/*
Copyright (c) 2013, Manu Manjunath
All rights reserved.
Redistribution and use of this program in source/binary forms, with or without modification are permitted.
Link to this gist is preferred, but not a condition for redistribution/use.
*/
function parse_csv_file($csvfile) {
@coresh
coresh / CSV-2-PHP-Array.php
Created January 5, 2022 19:38 — forked from anunay/CSV-2-PHP-Array.php
Convert a CSV file to a PHP associated array
<?php
function csv_to_array($filename='', $delimiter=',')
{
if(!file_exists($filename) || !is_readable($filename))
return FALSE;
$header = NULL;
$data = array();
if (($handle = fopen($filename, 'r')) !== FALSE)
{
@coresh
coresh / .svgo.yml
Created December 24, 2021 18:53 — forked from pladaria/.svgo.yml
SVGO config file
multipass: true
plugins:
- addAttributesToSVGElement: false
- addClassesToSVGElement: false
- cleanupAttrs: true
- cleanupEnableBackground: true
- cleanupIDs: true
- cleanupListOfValues: true
- cleanupNumericValues:
@coresh
coresh / Clean up database Magento 2
Created December 9, 2021 14:22 — forked from mrkhoa99/Clean up database Magento 2
Clean up database Magento 2 for local enviroment
//Orders, Invoices, Shipments
DELETE FROM sales_order;
DELETE FROM sales_creditmemo_comment;
DELETE FROM sales_creditmemo_item;
DELETE FROM sales_creditmemo;
DELETE FROM sales_creditmemo_grid;
DELETE FROM sales_invoice_comment;
DELETE FROM sales_invoice_item;
DELETE FROM sales_invoice;