Skip to content

Instantly share code, notes, and snippets.

Avatar

Omar AL Zabir oazabir

View GitHub Profile
View gist:3207041
This is a test Gist.
@oazabir
oazabir / .htaccess
Created May 13, 2013
Pretty robust .htaccess file, especially for wordpress. Supports extension less URL (permalinks), strong security, caches static content aggressively
View .htaccess
ErrorDocument 404 /
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
@oazabir
oazabir / gist:5637290
Last active Oct 2, 2018
A tuned .htaccess file for wordpress. It handles /postname as permalink, but any invalid URL inside any of the wp- folder won't hit index.php, thus saving processing power wasted in handling bogus URL. It produces cache header to cache static files aggressively for better performance.
View gist:5637290
ErrorDocument 404 /
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(^/wp-.*)
@oazabir
oazabir / gist:11342910
Created Apr 27, 2014
Check if site responds, if not restart apache and mysql
View gist:11342910
FILE=/home/siteup.log
SITE=http://quranerkotha.com
SIZE=`stat -c %s $FILE`
# Delete the file if it is over 1MB already
if [ $SIZE -ge 1000000 ]; then
rm FILE
fi
@oazabir
oazabir / gist:11343018
Created Apr 27, 2014
Check if a site is up and running
View gist:11343018
#!/bin/bash
if wget -nv -p $1 &> $2
then
if cat $2 | grep -i "error"
then
echo "Site has error"
cat $2 | grep -i -B 1 "error" | mail -s "$3" $4
else
echo "Site OK"
@oazabir
oazabir / gist:11343045
Created Apr 27, 2014
Monitor various websites
View gist:11343045
#!/bin/bash
cd /home/
./monitorsite http://blog.omaralzabir.com/about/ islamblog.log "[ERROR]IslamBlog" omaralzabir@gmail.com
./monitorsite http://omaralzabir.com/using-custom-font-without-slowing-down-page-load/ omarblog.log "[ERROR]OmarBlog" omaralzabir@gmail.com
./monitorsite http://quranerkotha.com/aboutus/ quranerkotha.log "[ERROR]QuranerKotha" omaralzabir@gmail.com
@oazabir
oazabir / gist:8e3187b5756b25b52393
Created Sep 29, 2014
Build, deploy, anonymize config, zip package, git commit, push from a single command
View gist:8e3187b5756b25b52393
# Build, anonymize config, deploy, zip, commit, push in one shot
param (
[string]$solution = "OracleDashboard.sln",
[string]$zipname = "OracleDashboard.zip",
[string]$compressor = "c:\Program Files\7-Zip\7z.exe",
[string]$folder = "OracleDashboard",
[string]$deployPath = "..\Binary",
[string]$commitFrom = "..",
[Parameter(Mandatory=$true)][string]$comment
)
View logstash-template.json
{
"template":"logstash-*",
"settings":{
"index.refresh_interval":"5s"
},
"mappings":{
"_default_":{
"dynamic_templates":[
{
View logstash.yml
input {
beats {
port => 5045
type => 'iis'
}
}
# First filter
filter {
View filebeat.yml
################### Filebeat Configuration Example #########################
############################# Filebeat ######################################
filebeat:
# List of prospectors to fetch data.
prospectors:
# Each - is a prospector. Below are the prospector specific configurations
-
# Paths that should be crawled and fetched. Glob based paths.
# To fetch all ".log" files from a specific level of subdirectories