Skip to content

Instantly share code, notes, and snippets.

View markbirbeck's full-sized avatar

Mark Birbeck markbirbeck

View GitHub Profile
@markbirbeck
markbirbeck / gist:980832
Created May 19, 2011 14:15
Troubleshooting sendmail: bash
sed -i -e 's/O LogLevel=9/O LogLevel=7/' /etc/mail/sendmail.cf
echo "Subject: test" | /usr/lib/sendmail -v mark.birbeck@gmail.com
sed -i -e 's/O LogLevel=7/O LogLevel=9/' /etc/mail/sendmail.cf
@markbirbeck
markbirbeck / gist:980836
Created May 19, 2011 14:17
Troubleshooting sendmail: Python
import smtplib
server = smtplib.SMTP('localhost')
server.sendmail('admin@levelbusiness.com', 'mark.birbeck@gmail.com', 'Hello mum!')
server.quit()
@markbirbeck
markbirbeck / gist:980900
Created May 19, 2011 14:42
Troubleshooting sendmail: Celery
import mailtasks
mailtasks.sendmail.delay('Hello there', 'Hello there subj')
@markbirbeck
markbirbeck / gist:986925
Created May 23, 2011 15:51
Merge changes after a pull request
#
# Get Jeremy's changes into a local branch:
#
git checkout -b jeremyfrench-master master
git pull git@github.com:jeremyfrench/chef-repo.git master
#
# Merge the changes onto the master branch, but roll-up, and leave in working directory:
#
git checkout master
git merge --squash jeremyfrench-master
@markbirbeck
markbirbeck / gist:999029
Created May 30, 2011 15:07
Import vendor library into Git-managed project
# Add a reference to the remote repo:
#
git remote add ajax-solr git://github.com/evolvingweb/ajax-solr
# Get the objects from the repo:
#
git fetch ajax-solr
# Create a branch that tracks the remote master branch:
#
git checkout -b ajax-solr ajax-solr/master
# Switch back to our own master and pull the code into a sub-directory:
@markbirbeck
markbirbeck / gist:1012087
Created June 7, 2011 11:54
Installing APC on CentOS servers
# Basic instructions derived from here:
#
# http://www.bilot.com/?p=477
#
# and here:
#
# http://mrfloris.com/vbulletin/installing-apc-on-centos-5-server/
#
# Additional information about the need for pcre-devel obtained from here:
#
@markbirbeck
markbirbeck / gist:1029633
Created June 16, 2011 16:30
Git workflow

The branch part of the following is based on A Git Workflow for Agile Teams, which also contains lots of other useful links.

Creating a fork of the project you want to work on

For any project you want to work on you should create a fork in GitHub, by clicking on the 'Fork' button on the project you are interested in.

From now on we'll call the project you have forked from upstream and your own copy of that project on GitHub we'll call origin.

Creating a task

@markbirbeck
markbirbeck / gist:1037016
Created June 21, 2011 01:15
Troubleshooting out of disk space

Check what's being used:

df -h

Find directories with lots of files in:

sudo find / -type d -size +100000c

Find large files:

@markbirbeck
markbirbeck / gist:1077939
Created July 12, 2011 13:07
Dealing with a broken Vagrant instance

Sometimes we get to a point where a Vagrant VM just won't run, and there's nothing for it but to get rid of it.

First get the ID of the machine in question:

cat .vagrant

Output will be something like:

{"active":{"hadoop_client":"31c1a009-f1b0-4acc-8200-1f33b95a0e3b"}}
@markbirbeck
markbirbeck / ga.patch
Created July 17, 2011 15:36
Patch for Drupal Google Analytics module based on http://drupal.org/files/issues/push_commands_0.patch
--- googleanalytics.module 2010-09-14 22:52:35.000000000 +0100
+++ googleanalytics.module 2010-09-23 09:44:17.000000000 +0100
@@ -160,6 +160,17 @@ function googleanalytics_footer($main =
$url_custom = '"/404.html?page=" + document.location.pathname + document.location.search + "&from=" + document.referrer';
}
+ // hook_googleanalytics_custom_url
+ $url_custom_replace = module_invoke_all('googleanalytics_custom_url');
+ if (!empty($url_custom_replace)) {
+ $url_custom = join(' ', $url_custom_replace);