==== APACHE PERFORMANCE ====
Function: Percentage of RAM a process takes (ie httpd) 
Usage: ps awfuxx | grep httpd|awk '{sum+=$4} END {print sum}'

Function: Apache2 Buddy 
Usage: curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl
Usage: perl <( curl -k4 https://hoshisato.com/tools/code/apache2buddy.pl ) --port 80

Function: Poor Man's Apache Buddy
Usage: ps -o rss -C httpd,apache2,php-fpm | tail -n +2 | awk '{total+=$1}END{print "count : " NR "\ntotal : " total/1024 " MB" "\navg   : " total/1024/NR " MB"  }'

Function: PHP-FPM Tuner Pal
Usage: curl -sL https://raw.githubusercontent.com/pksteyn/php-fpmpal/master/php-fpmpal.sh | bash

Function: Fix Everything Command
Usage: bash <(curl -s https://hoshisato.com/tools/code/wut.sh)

Function: NGINX Equivalent of HTTPD -S
Usage: nginx -T |grep -P '(%.conf|configuration|server_name|listen)' | grep -v ::

Function: Apache Status
Usage: /etc/init.d/httpd fullstatus

Function: Page Loads
Usage: time wget -q -r level=1 http://

Function: Quick Vhost
Usage: bash <(curl justcurl.com -H "host: example.com " -H "x-docroot: /var/www/vhosts/example.com/public_html ")

==== QUICK REDIRECTS / REWRITES ====

Function: Rewrite URL's with "?" at the end
http://www.exmaple.com/Pages/series_display.php?de=443
Rewrites to =>
http://www.example.com/
Usage: 
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^de=443
RewriteRule ^(.*)$ http://www.example.com/? [L,R=301]

Function: Redirect .org to .com
Usage:
RewriteCond %{HTTP_HOST} !^example\.org$
RewriteRule ^ http://example.org%{REQUEST_URI} [L,R=301]

Function: Redirect to HTTPS
Usage:
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

Function: Redirect to www
Usage:
RewriteCond %{HTTP_HOST}  ^example.com [nocase]
RewriteRule ^(.*)         http://www.example.com/$1 [last,redirect=301]

RewriteCond %{HTTP_HOST}  ^(www\.)example.com [nocase]
RewriteRule ^(.*)         http://www.example.com/$1 [last,redirect=301]

Function: Redirect to non-www
Usage:
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

Function: URL Redirect to differect Location - but not exposed
Usage: (Remove the _)
Alias /api /var/www/vhosts/api.example.com/site/public/index.php
<_Directory /var/www/vhosts/api.example.com/site/public>
     AllowOverride all
     Order allow,deny
     Allow from all
<_/Directory> 

Function: Force HTTPS for Admin
Usage: (Remove the _)
<_Directory /var/www/vhosts/example.com/admin>              
     RewriteEngine on
     RewriteCond %{HTTPS} off
     RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
<_/Directory>

Function: Rewrite a to localhost (Localhost as in Client connecting - fun against brute forcers)
Usage: RewriteRule ^xmlrpc\.php$ "http\:\/\/0\.0\.0\.0\/" [R=301,L]

Function: To append a trailing slash
Usage:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !example.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301]

Function: Varnish in Play?
Usage:
SetEnvIfNoCase X-Forwarded-For 192.168.xxx.xxx GOOD_IP=on
Order deny,allow
Deny from all
Allow from env=GOOD_IP

--------------------------------------------
UNSORTED
--------------------------------------------
curl -H "Host:hoshisato.com" localhost/test.txt

curl -Iv https://www.google.com --resolve www.google.com:443:74.125.21.102
openssl s_client -connect 192.168.21.102:443 -servername www.google.com

nmap --script ssl-enum-ciphers -p 443 192.168.1.1

curl --verbose --header 'Host: www.hoshisato.com' 'http://192.168.1.1'