Skip to content

Instantly share code, notes, and snippets.

View chales's full-sized avatar

Chris Hales chales

View GitHub Profile
@chales
chales / Drupal_6-settings.php
Last active December 16, 2015 10:48
A very abbreviated Drupal 6 settings.php file.
<?php
/**
* Database URL format:
* $db_url = 'mysqli://username:password@localhost/databasename';
*/
$db_url = 'mysqli://username:password@localhost/databasename';
$db_prefix = '';
// Access control for update.php script
@chales
chales / ssh-key-push.sh
Created April 23, 2013 18:05
SSH Key push script if you want to install it and not use a command.
#!/bin/bash
#
# pushkey
#
# usage:
#
# pushkey [email protected]
#
# This script was originally written by Greg Anderson
@chales
chales / ssh-config
Last active September 29, 2022 00:53
SSH Config - Sample file to show staff the common options to add to your '~/.ssh/config' file. This is just a text file and should have the same perms as the other files in ~/.ssh, usually 600 (read and write by user only).
#### Example SSH config file
# Host = a list of domains, IPs and personalized aliases that use this config
# entry. These alias names follow "Host" and are space delimited.
# e.g. Host 192.168.1.1 example.com example1 myalias1
# Hostname = the IP or real hostname
# e.g. Hostname 192.168.1.1
# User = the username
# e.g. User jdoe
# Port = if this is a non standard port, i.e. not 22
@chales
chales / cat-copy-key
Last active December 16, 2015 16:29
Short command to push your key if you do not have ssh-copy-id (such as on OSX).Via terminal this will copy your public key (id_rsa.pub assumed) to a remote server and push it into the authorized_keys file. At that point you should be able to login without being prompted for the password for the remote system.
# Copy your public key (id_rsa.pub assumed) to a remote server and push it into
# the authorized_keys file.
# An assumption is your key is named "id_rsa" so make sure that is correct.
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
# What about not having a ~/.ssh directory already on the remote host? You
# would be better off logging into the remote machine and doing a 'ssh localhost'
# there which will create the directory with proper permissions. You can give
# this a try but if you run into a login issue it's likley permission based.
@chales
chales / Drupal_7-settings.php
Last active December 17, 2015 06:59
An abbreviated Drupal 7 settings.php file
<?php
/**
* @file
* This is an abreaviated Drupal site-specific configuration file.
*
* IMPORTANT NOTE:
* Please review the example.settings.php file for full details on and defaults.
* Many details and instructions are ommitted here for brevity.
*/
@chales
chales / ps_mem.py
Created July 5, 2013 03:12
Calculate process totals. Script source: http://www.pixelbeat.org/scripts/ps_mem.py
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The shared RAM is problematic to calculate, and this script automatically
# selects the most accurate method available for your kernel.
# Licence: LGPLv2
@chales
chales / multisite-cron.php
Last active December 20, 2015 17:19
Drupal multi-site cron with basic auth option. Targets a sites directory to get a list of available sites to process. Add sites to exclude to the egrep list.
#!/bin/bash
# This script will iterate through the sites directory of a multi-site install
# and run the cron.php for each named site in the directory.
# NOTE: the domain defined in 'sites/default' must be run separately or via a symlink.
DEFAULTDOMAIN=www.example.com
# Set the system path for the multi-site "sites" directory
SITESROOT=/path/to/drupal/sites
@chales
chales / 2-apc-admin.php
Last active December 21, 2015 21:39
My default Drupal APC config to be included within the main php.ini or as an include file. The additional file is the apc.php file that is often hard to find within some systems or impossible to copy while on a shared host.
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@chales
chales / cache-warmer-3.sh
Last active January 19, 2022 14:01
A couple of simple options to parse sitemap.xml to warm the cache or for other actions such as generating memory_profiler checks.
# This can be added to your cron job to run right after Drupal's cron or combine them into a single command so
# that it automatically executes when the cron run completes.
wget -q http://www.example.com/sitemap.xml -O - | egrep -o "http://www\.example\.com[^<]+" | wget -q -i - -O /dev/null --wait 1
@chales
chales / fserver.profile
Last active December 25, 2015 13:29
2013-10-14 Features server profile and make file. See note in profile since a few small things are dropped.
<?php
/**
* This profile was generated with profile_generate module but DOES NOT configure everything
* correctly. Pathauto options are not set, the Marvin theme, and several other items.
* When I have time I'll try to debug the few options that are missing.
*/
/********************************