Skip to content

Instantly share code, notes, and snippets.

View deivisonarthur's full-sized avatar

Deivison Arthur Lemos Serpa deivisonarthur

View GitHub Profile
<?php
echo "<h1>Pega o sua latitude e longitude pelo seu IP em whatismyipaddress</h1>";
$ip=$_SERVER['REMOTE_ADDR'];
$url=file_get_contents("http://whatismyipaddress.com/ip/$ip");
@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
<?php
/*
Objetivo criar uma chave serial para cada dominio. O script pega a chave gerada e compara com o $_SERVER['HTTP_HOST']
*/
//link do demo do gen: http://onestepcheckout.com.br/LojaModelo/keygen/
//linha para ser add nas paginas que serao bloqueadas
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Load Up Magento Core
define('MAGENTO', realpath(''));
require_once(MAGENTO . '/app/Mage.php');
$app = Mage::app()->getStore()->load(0);
##Server para redirecionar
server {
listen 80;
server_name pisosecarpetes.com.br *.pisosecarpetes.com.br;
##Pega subdominio e add https
if ($host ~* "^([^.]+(\.[^.]+)*)\.pisosecarpetes.com.br$"){
set $subd $1;
rewrite ^(.*)$ https://$subd.pisosecarpetes.com.br$1 permanent;
break;
@deivisonarthur
deivisonarthur / Portifolio
Created January 26, 2016 14:14
Portifólio Inovarti e-commerces em Magento - Melhor plataforma de ecommerce B2C, B2B e Marketplace
_
git fetch --all
reseta todos
git reset --hard origin/master
<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>