This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// www.fduran.com | |
// send mail with Amazon AWS SES without extra library | |
// needs Pear: apt-get install php-pear | |
<?php | |
function mailSES($to, $subject, $body, $from) | |
{ | |
include_once('Mail.php'); | |
$headers["From"] = $from; | |
$headers["To"] = $to; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# delete files in a folder older than a number of days (100 for example) | |
find /path/to/folder -mtime +100 -exec rm -f {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
MySQL Master-Slave Replication Notes | |
Master | |
/etc/mysql/my.cnf | |
server-id = 100 | |
log_bin = /var/log/mysql/mysql-bin.log | |
binlog-do-db = wpdb | |
binlog-ignore-db = mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Create Java KeyStore from SSL certificate for domain example.com | |
# Change format from cert.crt PEM (----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----) to DER | |
openssl x509 -in cert.crt -inform PEM -out cert.der -outform DER | |
# create KeyStore cert.jks for your domain ("alias" in keytool, "common name" or CN in openssl req) | |
keytool -import -trustcacerts -alias example.com -file cert.der -keystore cert.jks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# python script to test/monitor if a Django site using authentication is up | |
# with logging output to a file including response times | |
# use in cronjob and output to log file, for ex: python /path/to/script.py >> /var/log/webmonitor.log | |
# bash: install pip if not already in system | |
apt-get install python-setuptools python-dev build-essential | |
easy_install -U pip | |
# bash: install requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Linux "Too many files open" error | |
# check current number of open files: | |
lsof |wc -l | |
# check maximum number of file descriptors | |
sysctl -a |grep file-max | |
# increment value: edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# Apache2 optimization | |
# apache-wide (/etc/apache2/apache2.config ): | |
# compression | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# redirect from apache port (:8080 for ex for tomcat etc) to subdomain | |
# in apache config: | |
<VirtualHost *:80> | |
ServerName subdomain.example.com | |
ProxyPass / http://127.0.0.1:8080/ | |
ProxyPassReverse / http://127.0.0.1:8080/ | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# www.fduran.com | |
# files opened for writing | |
lsof | grep -e "[[:digit:]]\+w" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>CloudFlare Always Online</h1> | |
<b>Summary:</b> I'd like to know if CloudFlare's <a href="http://www.cloudflare.com/always-online">Always Online</a> works when a web server goes completely down (server unresponsive). | |
1) According to CloudFlare's web site, the answer seems to be "yes" (emphasis mine): | |
<ul> | |
<li><a href="http://www.cloudflare.com/always-online">Description of the service</a>: Always Online is a feature that caches a static version of your pages in case your <b>server goes offline</b>.</li> | |
<li><a ref="http://blog.cloudflare.com/always-online-because-downtime-sucks">Blog entry</a>: "If, for any reason, your web host or service provider <b>goes down</b>, we kick in to keep your site online"</li> | |
<li><a href="https://cloudflare.tenderapp.com/kb/troubleshooting/why-doesnt-always-online-display-all-pages-of-my-site-when-my-server-is-down">KB documentation</a>: on the point 7: "In order to trigger Always Online, your web server will need to be <b>completely unresponsive</b>, or ..."</li> | |
<li>In a |