Skip to content

Instantly share code, notes, and snippets.

View chales's full-sized avatar

Chris Hales chales

View GitHub Profile
@chales
chales / avg-apache-process.sh
Created March 21, 2012 20:54 — forked from amr/avg-apache-process.sh
Tells you the average size of your Apache processes
#!/bin/bash
#
# Tells you the average size of your Apache processes
# It must run on a live apache server (unless you know what you are doing).
# It requires pmap, /proc, ps, grep, awk, sed and bc,
#
# Written by: Amr Mostafa" <amr.mostafa@egyptdc.com>
#
# Courtesy of Egypt Development Centre (c).
@chales
chales / base-d6.aliases.drushrc.php
Last active October 28, 2021 20:58
Drush aliases full featured base file for Local, Staging, Development and Production environments such as an Acquia or Pantheon hosted site. In this version the "structure-tables" array is setup for a Drupal 6 set of core tables and common contrib module tables (CCK and Views). You should modify the array and add or remove tables to match your b…
<?php
/**
* Setup This File:
* Look for strings wrapped in { } and update them to match your environments.
* e.g. {project-short-name} is the abreviation name to replace throughout.
*/
/**
* Site aliases for {project-short-name}
@chales
chales / drush.make
Last active October 12, 2015 03:38
Example drush make file.
; See http://drupal.org/node/625094
; drush make test_make.txt --contrib-destination=sites/all/modules/contrib --prepare-install /Volumes/Work/DevSites/testing/test.local
core = 6.x
api = 2
; Core project
projects[] = drupal
; Contrib Modules
@chales
chales / View 6.x-2.x - Admin User View
Created February 7, 2013 20:57
Drupal 6 advanced user view. Displays user info with search options and in a sortable fashion. View is for 6.x-2.x views and requires views bulk operations for user manipulations, http://drupal.org/project/views_bulk_operations
$view = new view;
$view->name = 'admin_users';
$view->description = 'Emulates the Drupal user administration page.';
$view->tag = '';
$view->base_table = 'users';
$view->core = 0;
$view->api_version = '2';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Default', 'default');
$handler->override_option('fields', array(
@chales
chales / View 6.x-2.x - Admin Content View
Last active December 14, 2015 20:49
Drupal 6 advanced content view. Displays advanced content search info with search options and in a sortable fashion. View is for 6.x-2.x views and requires views bulk operations for manipulations, http://drupal.org/project/views_bulk_operations
$view = new view;
$view->name = 'admin_content';
$view->description = 'Emulates the Drupal content administration page.';
$view->tag = '';
$view->base_table = 'node';
$view->core = 0;
$view->api_version = '2';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Default', 'default');
$handler->override_option('fields', array(
@chales
chales / ChromeAppMaker.sh
Created March 29, 2013 21:28
Google Chrome app creation script for OS X. I found a post on LifeHacker with a similar script so I used that to work out the icon creation which I was having issues with.
#!/bin/sh
# Local application path. The default is /Applications but I tend to separate
# my apps in the sub directories, e.g. /Applications/Internet
app_root="/Applications"
path_chrome="$app_root/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
# Everything below should be good as is, the script is interactive.
# 1 Name
# 2 URL
#
# Customized VCL file for serving up a Drupal site with multiple back-ends.
#
# For more information on this VCL, visit the Lullabot article:
# http://www.lullabot.com/articles/varnish-multiple-web-servers-drupal
#
# Define the internal network subnet.
# These are used below to allow internal access to certain files while not
# allowing access from the public internet.
@chales
chales / Redirect-file-traffic
Last active December 15, 2015 19:39
For local (Drupal) sites where you don't want to eat up drive space from file syncs, have apache pull them from the production sites instead. http://getlevelten.com/blog/mark-carver/dont-sync-drupal-files-local-environments-redirect-them-instead
<VirtualHost 0.0.0.0:80>
ServerName mysite.sandbox
DocumentRoot /path/to/mysite.sandbox
<IfModule mod_rewrite.c>
RewriteEngine on
# Request resides in your 'sites/default/files' folder.
RewriteCond %{REQUEST_URI} ^/sites/default/files/(.*)$
# File doesn't exist.
RewriteCond %{REQUEST_FILENAME} !-f
# Directory doesn't exist.
@chales
chales / View 7.x Admin Content View
Last active December 16, 2015 03:09
Drupal 7 Advanced Content search view. Displays advanced content search info with search options and in a sortable fashion.
$view = new view;
$view->name = 'content_advanced';
$view->description = 'Allows for granular content search';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Content Advanced';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@chales
chales / vhost-all-traffic-ssl
Created April 12, 2013 04:50
Apache vhost - All traffic is redirected to SSL via redirect for port 80 to 443.
<VirtualHost *:80>
ServerAdmin it@example.com
ServerName www.example.com
# Force secure access via redirect to https
RedirectMatch permanent /(.*) https://www.example.com/$1
</VirtualHost>
# SSL
<IfModule mod_ssl.c>
<VirtualHost *:443>