If you haven't already, install fail2ban and ufw:
sudo apt-get install fail2ban ufw
Now make a copy of the fail2ban configuration, and name it jail.local
:
#find . -type f -name '*.png' -exec optipng -o5 -quiet -preserve {} \; | |
#find . -type f -name '*.jp*' -exec mogrify -compress jpeg -quality 70 {} \; | |
find . -type f -iname "*.jp*g" | xargs mogrify -resize '1280x1280>' | |
find . -type f -iname "*.jp*g" | xargs jpegoptim --strip-all --max=90 | |
# With parallel | |
find . -type f -iname "*.jp*g" -print0 | parallel --progress -0 -j +0 "mogrify -resize 1280x1280\> {}" | |
find . -type f -iname "*.jp*g" | parallel --progress "jpegoptim --strip-all --max=65 {}" |
#!/bin/sh | |
####################################### | |
# Bash script to install an AMP stack and PHPMyAdmin plus tweaks. For Debian based systems. | |
# Written by @AamnahAkram from http://aamnah.com | |
# In case of any errors (e.g. MySQL) just re-run the script. Nothing will be re-installed except for the packages with errors. | |
####################################### | |
#COLORS |
This should help you get Sendmail installed with basic configuration on Ubuntu.
sudo apt-get install sendmail
/etc/hosts
file: nano /etc/hosts
127.0.0.1 localhost yourhostname
sudo sendmailconfig
sudo service apache2 restart
<?php | |
/** | |
* Clean HTML string removing all element attributes and elements which are | |
* not in the provided whitelist (but keeping their allowed children). | |
* | |
* @see https://github.com/alixaxel/phunction/blob/master/phunction/HTML.php | |
* @param string $html to clean | |
* @param array $whitelist | |
*/ | |
function clean_html($html, array $whitelist) |
<html> | |
<body> | |
<p>Here are Webber’s points:</p> | |
<ul> | |
<li>If a method can be static, declare it static. Speed improvement is by a factor of 4.</li> | |
<li>echo is faster than print.(<em>* compare with list from phplens by John Lim</em>)</li> | |
<li>Use echo’s multiple parameters instead of string concatenation.</li> | |
<li>Set the maxvalue for your for-loops before and not in the loop.</li> | |
<li>Unset your variables to free memory, especially large arrays.</li> | |
<li>Avoid magic like __get, __set, __autoload</li> |
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo | |
echo usage: $0 network-interface | |
echo | |
echo e.g. $0 eth0 | |
echo | |
echo shows packets-per-second |
# forked from http://forge.mysql.com/tools/tool.php?id=137 | |
[client] | |
#password = [your_password] | |
port = 3306 | |
socket = /tmp/mysqld.sock | |
# *** Application-specific options follow here *** | |
# |
<?php | |
// Source: http://www.jonasjohn.de/snippets/php/headers.htm | |
// Use this header instruction to fix 404 headers | |
// produced by url rewriting... | |
header('HTTP/1.1 200 OK'); | |
// Page was not found: | |
header('HTTP/1.1 404 Not Found'); |
#!/bin/bash | |
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'` | |
for JAIL in $JAILS | |
do | |
fail2ban-client status $JAIL | |
done |