Skip to content

Instantly share code, notes, and snippets.

View pietromalerba's full-sized avatar

Pietro Malerba pietromalerba

  • M3
  • Civitanova Marche (MC) - Italy
View GitHub Profile
@pietromalerba
pietromalerba / bitbucket-pipeline-pull-files.md
Created June 9, 2023 16:35 — forked from shankar-bavan/bitbucket-pipeline-pull-files.md
CI CD with bitbucket pipleline and shell script
@pietromalerba
pietromalerba / find-base64-occurences
Created June 5, 2019 04:09 — forked from anotheremily/find-base64-occurences
hackers seem to like base64 encoding their php commands
#!/bin/bash
find . -name "*.php" -exec grep "base64" '{}' \; -print &> b64-detections.txt
find . -name "*.php" -exec grep "eval" '{}' \; -print &> eval-detections.txt
@pietromalerba
pietromalerba / gist:bd562c389a4d84cc8e4439290e930743
Created April 9, 2019 06:18 — forked from Synchro/gist:3749394
PHP script to report and/or extract sections from apache and icecast log files by date ranges
#!/usr/bin/env php
<?php
/**
* Extract a section of an apache or icecast log file between two dates
* Assumes that log lines are in chronological order
* Start and end dates can be in any format that strtotime can handle
* Reads from stdin, outputs to stdout, stats to stderr
* @author Marcus Bointon <marcus@synchromedia.co.uk>
* @link https://gist.github.com/3749394
* Example usage. Report the range of dates in a log file
@pietromalerba
pietromalerba / blockClicks.js
Created February 17, 2019 10:51 — forked from lucas-pelton/blockClicks.js
Prevent multiple clicks and submissions in Contact Form 7
//http://epsiloncool.ru/programmirovanie/preventing-multiple-submits-in-contact-form-7
jQuery(document).on('click', '.wpcf7-submit', function(e){
if( jQuery('.ajax-loader').hasClass('is-active') ) {
e.preventDefault();
return false;
}
});
#!/bin/bash
# variables
LOGFILE="/var/log/nginx/access.log"
LOGFILE_GZ="/var/log/nginx/access.log.*"
RESPONSE_CODE="200"
# functions
filters(){
grep $RESPONSE_CODE \
@pietromalerba
pietromalerba / heart.js
Created January 29, 2018 09:35 — forked from paulirish/heart.js
sweetass heart canvas.
// 99% done by @rauri rochford
// http://js1k.com/2012-love/demo/1071
// i just rAF'd it.
// demo at http://bl.ocks.org/1823634
e = [];// trails
@pietromalerba
pietromalerba / happy_git_on_osx.md
Created January 10, 2018 14:28 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@pietromalerba
pietromalerba / .htaccess
Last active December 11, 2017 14:31 — forked from Jany-M/.htaccess
[WP] htacces for best security & caching settings
# ------------------------------------------------------------------------------------------
#
# CUSTOM SETUP
#
# ------------------------------------------------------------------------------------------
# MAINTENANCE-PAGE REDIRECT
#<IfModule mod_rewrite.c>
# RewriteEngine on
# RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
@pietromalerba
pietromalerba / clear-font-cache.md
Created September 29, 2017 09:58 — forked from jaredhowland/clear-font-cache.md
Clear Mac OS X Font Caches
@pietromalerba
pietromalerba / ngnix.md
Last active November 11, 2016 17:11 — forked from magnetikonline/README.md
Ngnix configuration

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is outlined at the Nginx ngx_http_fastcgi_module page document page.

Introduction

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).