Skip to content

Instantly share code, notes, and snippets.

View deivisonarthur's full-sized avatar

Deivison Arthur Lemos Serpa deivisonarthur

View GitHub Profile
@deivisonarthur
deivisonarthur / nginx-tuning.md
Created November 21, 2020 00:41 — 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.

@deivisonarthur
deivisonarthur / cspheader.php
Created September 24, 2020 19:25 — forked from phpdave/cspheader.php
CSP Header for PHP or Apache or .htaccess - Content Security Protocol
<?
//CSP only works in modern browsers Chrome 25+, Firefox 23+, Safari 7+
$headerCSP = "Content-Security-Policy:".
"connect-src 'self' ;". // XMLHttpRequest (AJAX request), WebSocket or EventSource.
"default-src 'self';". // Default policy for loading html elements
"frame-ancestors 'self' ;". //allow parent framing - this one blocks click jacking and ui redress
"frame-src 'none';". // vaid sources for frames
"media-src 'self' *.example.com;". // vaid sources for media (audio and video html tags src)
"object-src 'none'; ". // valid object embed and applet tags src
"report-uri https://example.com/violationReportForCSP.php;". //A URL that will get raw json data in post that lets you know what was violated and blocked
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Zape.me -->
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-3398813693890634"
data-ad-slot="6755844429"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
@deivisonarthur
deivisonarthur / responsive_likebox.html
Created May 3, 2017 03:06
Responsive Facebook Like Box
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container" style="width:100%;">
<div class="fb-like-box" data-href="https://www.facebook.com/adobegocreate" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>
</div>
@deivisonarthur
deivisonarthur / delete_all_customers.sql
Created December 2, 2016 19:42 — forked from michelbrito/delete_all_customers.sql
Magento - Delete all customers
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `customer_address_entity`;
TRUNCATE TABLE `customer_address_entity_datetime`;
TRUNCATE TABLE `customer_address_entity_decimal`;
TRUNCATE TABLE `customer_address_entity_int`;
TRUNCATE TABLE `customer_address_entity_text`;
TRUNCATE TABLE `customer_address_entity_varchar`;
TRUNCATE TABLE `customer_entity`;
TRUNCATE TABLE `customer_entity_datetime`;
@deivisonarthur
deivisonarthur / Portifolio
Created January 26, 2016 14:14
Portifólio Inovarti e-commerces em Magento - Melhor plataforma de ecommerce B2C, B2B e Marketplace
_
@deivisonarthur
deivisonarthur / mage-dbdump-sales-users
Created November 3, 2015 14:21 — forked from seangreen/mage-dbdump-sales-users
Shell Script to Dump / Import Magento Sales and Customers
#!/bin/bash
# VARIABLES
CONFIG_FILE="./app/etc/local.xml"
DUMP_FILE="./var/db-sales-users.sql"
TABLES="sales_bestsellers_aggregated_daily sales_bestsellers_aggregated_monthly sales_bestsellers_aggregated_yearly sales_billing_agreement sales_billing_agreement_order sales_flat_creditmemo sales_flat_creditmemo_comment sales_flat_creditmemo_grid sales_flat_creditmemo_item sales_flat_invoice sales_flat_invoice_comment sales_flat_invoice_grid sales_flat_invoice_item sales_flat_order sales_flat_order_address sales_flat_order_grid sales_flat_order_item sales_flat_order_payment sales_flat_order_status_history sales_flat_quote sales_flat_quote_address_item sales_flat_quote_item sales_flat_quote_item_option sales_flat_quote_payment sales_flat_quote_shipping_rate
sales_flat_shipment sales_flat_shipment_comment sales_flat_shipment_grid sales_flat_shipment_item sales_flat_shipment_track sales_invoiced_aggregated sales_invoiced_aggregated_order sales_order_aggregated_created sales_order_aggregated_updated sales_order_statu
@deivisonarthur
deivisonarthur / gist:40e40330731457a9ebbe
Created September 30, 2015 17:41 — forked from bubblun/gist:9790114
Get Vimeo MP4 URL
function getVimeoMP4($vimeo_id) {
$result = file_get_contents( "http://keepvid.com/?url=http%3A%2F%2Fvimeo.com%2F" . $vimeo_id );
preg_match_all('/"(http\:\/\/pdl.vimeocdn.com.+?)"/i', $result, $matches);
return $matches[1][1];
}
@deivisonarthur
deivisonarthur / Mpchadwick_Missing_Acl_Checker.php
Last active September 19, 2015 05:49 — forked from mpchadwick/Mpchadwick_Missing_Acl_Checker.php
Devido o path de segurança 6285 a questão da permissão mudou no Magento.
<?php
require_once 'abstract.php';
/**
* Generate a CSV of modules with admin routes that haven't implemented _isAllowed()
*/
class Mpchadwick_Missing_Acl_Checker extends Mage_Shell_Abstract
{
const MODULES_PATH = 'modules';