Skip to content

Instantly share code, notes, and snippets.

View chales's full-sized avatar

Chris Hales chales

View GitHub Profile
#!/bin/bash
for branch in `git branch -r | grep -v HEAD | grep -v master`; do
echo ${branch##*/} $branch
done
echo "Fetching..."
git fetch --all
echo "Pulling..."
git pull -v
echo "Results: Branches"
git branch -a
# ssh-instance - function to let you SSH to an EC2 instance ID
# Written by Mike Babineau <michael.babineau@gmail.com>. Original here: https://gist.github.com/mbabineau/319882/
# Put this in ~/.profile and reload your terminal
function ssh-instance() {
if [ $# -lt 1 ] || [ $# -gt 3 ]; then
echo "Usage: ssh-instance [-r region] <instance id>"
else
case "$1" in
"-r")
@chales
chales / aws_iam_policy.json
Created June 24, 2014 21:56 — forked from kixorz/aws_iam_policy.json
Review original: Update Route53 DNS records from your EC2 instance using this simple Ruby script. You can call it from rc.local after setting your hostname locally. First parameter is the desired <hostname>.<domain> Domain and other parameters are hardcoded. This script is useful for handling internal DNS changes in your systems after instance c…
{
"Statement": [
{
"Action": [
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Effect": "Allow",
"Resource": [
<?php
/**
* @file
* Amazon Elastic Load Balancer Settings.
*
* Force server to use https:// path if SSL is handled at load balancer.
*
* @see http://drupal.org/node/185161#comment-5452038
*/
"""
Queries the slowlog database table maintained by Amazon RDS and outputs it in
the normal MySQL slow log text format. Modified version of the script by
memonic (Thanks!) at https://gist.github.com/1481025
Things to change in this script for your own setup:
<root_user> to your mysql root user (e.g. "root")
<root_pass> to your mysql root password (e.g. "hunter2")
<host_domain> to your mysql root password (e.g. "prod-01.w3rfs2.us-east-1.rds.amazonaws.com")
drush php-eval 'node_access_rebuild();'
#!/bin/sh
#
# This script will hold your hand during the process of converting an existing Drupal 7 file field from public to private.
#
# http://twitter.com/thsutton
# http://www.linkedin.com/pub/thomas-sutton/55/391/350
# http://thomas-sutton.id.au/
set -eu

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins

grep {
type => "syslog"
match => [ "syslog_program", "drupal" ]
add_tag => "Drupal"
drop => false
}
grok {
type => "syslog"
tags => [ "Drupal" ]
match => [ "@message", "^https?://%{HOSTNAME:drupal_vhost}\|%{NUMBER:drupal_timestamp}\|(?<drupal_action>[^\|]*)\|%{IP:drupal_ip}\|(?<drupal_request_uri>[^\|]*)\|(?<drupal_referer>[^\|]*)\|(?<drupal_uid>[^\|]*)\|(?<drupal_link>[^\|]*)\|(?<drupal_message>.*)" ]
@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).