Skip to content

Instantly share code, notes, and snippets.

View iAugur's full-sized avatar

George Boobyer iAugur

View GitHub Profile
@iAugur
iAugur / block--facetapi.tpl.php
Created October 11, 2012 12:09
Drupal theming
<?php
/**
* @file
* Omega theme implementation to display a block for the FacetAPI Facet Block.
* FacetAPI Search facets display block
*/
?>
<?php $tag = $block->subject ? 'section' : 'div'; ?>
<<?php print $tag; ?><?php print $attributes; ?>>
@iAugur
iAugur / gist:3873232
Created October 11, 2012 15:29 — forked from quoidautre/gist:3551693
APACHE: htaccess html5boilerplate
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@iAugur
iAugur / Drupal Display Suite
Created November 16, 2012 10:55
Drupal: Surface a block as a Display Suite Field
/**
* Create a custom module and implement hook_ds_fields_info to surface your 'field' to DS
* Create a custom theme function to create the content when called by DS
*
*
*/
function yourmodule_ds_fields_info($entity_type) {
$fields = array(
@iAugur
iAugur / drupal-quick-dump.sh
Created November 23, 2012 09:06 — forked from timmillwood/drupal-quick-dump.sh
Script to dump Drupal database structure, but exclude data from massive/unneeded tables.
#!/bin/bash
# usage: drupal-quick-dump user host database
USER="$1"
HOST="$2"
DB="$3"
DATE=`date +%Y%m%d`
# Get User Password
echo "Please provide the password for ${USER} on db ${DB} hosted at ${HOST}:"
@iAugur
iAugur / dump.bat
Created November 23, 2012 11:40
Windows BAT files to dump MYSQL Database, purge logs and add these to Wampmanager menu
rem refer to http://perplexed.co.uk/271_batch_mysqldump_useful_development_tool.htm
@echo off
echo. | time /t
echo Dump local database .
SET /P dbname=Name of database?:
SET tmp_file=d:\wamp\dump\%dbname%.sql
echo Dumping %dbname%@LocalHost ...
D:\wamp\bin\mysql\mysql5.5.8\bin\mysqldump.exe -h localhost -uroot -p %dbname% > %tmp_file%
rem "d:\program files\winzip\wzzip" -a -m %tmp_file%.zip %tmp_file%
gzip -9 %tmp_file%
@iAugur
iAugur / fpd.sh
Created November 27, 2012 23:44
Bash file to set file permissions for a Drupal site
#!/bin/bash
#
# Lock down a Drupal site's file permissions
#
# I have adapted this from Vivek Gite
# Adapted to add Drupal specific: www-data (apache users) to own
# default/files and settings.php and have rights to write to files
#
#
# Vivek Gite: Header
@iAugur
iAugur / htaccess-against-spam001
Last active October 6, 2021 03:02
Sample .htaccess for blocking common Spammer IPs
## This example shows how to deny access to individual and ranges of IP address
## Typically indentified as spammers
## Taken from http://perishablepress.com/stupid-htaccess-tricks/
##Deny from multiple single IPs
SetEnvIfNoCase REMOTE_ADDR ".*(5.167.182.32|125.79.65.108|178.137.83.159|184.154.149.194|192.210.62.162).*" BlockedAddress
SetEnvIfNoCase REMOTE_ADDR ".*(94.23.20.123|92.243.84.187|58.61.239.201).*" BlockedAddress
#deny from a range e.g. 91.236.74.0/24
@iAugur
iAugur / mollom-watchdog
Last active May 5, 2016 12:31
Analysing your Drupal Watchdog for Spammers
/**
* Get a list of Mollom entries from the Drupal Watchdog
* summarised by IP address
*/
SELECT hostname, count(wid)
FROM `watchdog`
where type = 'mollom' and message like 'Spam%'
group by hostname
order by count(wid) desc
@iAugur
iAugur / How to purge Binary Logs.md
Last active December 12, 2015 01:28
Purge MySQL binary logs
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="none"/>
</cross-domain-policy>