Skip to content

Instantly share code, notes, and snippets.

View gchaix's full-sized avatar
😺

Greg Chaix gchaix

😺
View GitHub Profile
@gchaix
gchaix / packages.pp
Last active December 31, 2015 13:19
Conditional package naming in puppet
$updatecommand = $osfamily ? {
'Debian' => 'apt-get update && apt-get upgrade',
'RedHat' => 'yum update',
'Suse' => 'zypper update',
}
exec { "update_packages":
command => $updatecommand,
path => "/usr/local/bin/:/bin/",
}
@gchaix
gchaix / gist:9795176
Created March 26, 2014 22:34
CentOS 6.4 requirements
Installed:
perl-DBD-SQLite.x86_64 0:1.27-3.el6 perl-Digest-SHA1.x86_64 0:2.12-2.el6
perl-File-FnMatch.x86_64 0:0.02-6.el6 perl-JSON-XS.x86_64 1:2.27-2.el6
perl-Moose.x86_64 0:1.15-1.el6 perl-Parse-Yapp.noarch 0:1.05-41.el6
perl-ParseLex.noarch 0:2.15-14.el6 perl-Try-Tiny.noarch 0:0.11-4.el6
Dependency Installed:
perl-Class-C3.noarch 0:0.22-4.el6
perl-Class-MOP.x86_64 0:1.12-1.el6
perl-DBI.x86_64 0:1.609-4.el6
@gchaix
gchaix / default.vcl
Last active October 3, 2018 01:16
Example Varnish default.vcl for Drupal
#
# Customized VCL file for serving up a Drupal site with multiple back-ends.
#
# Based on this excellent Lullabot article:
# http://www.lullabot.com/articles/varnish-multiple-web-servers-drupal
#
# Hooks for New Relic
C{
#include <sys/time.h>
[vagrant@vagrant-multi1 default]$ drush sql-sanitize --debug --verbose
Using the Drush script found at /home/vagrant/.composer/vendor/drush/drush/drush.launcher using pcntl_exec
Drush preflight prepare loaded autoloader at [preflight]
/home/vagrant/.composer/vendor/autoload.php [0.01 sec, 2.88 MB]
Starting Drush preflight. [0.01 sec, 2.88 MB] [preflight]
Cache HIT cid: 8.1-dev-commandfiles-0-b4175ec541a5b0457a6af1fda10b4559 [debug]
[0.01 sec, 2.95 MB]
Scanning into /etc/drush for /.*aliases\.drush(8|)rc\.php$/ [0.03 sec, [debug]
5.61 MB]
Scanning into /etc/drush for /self\.alias\.drush(8|)rc\.php$/ [0.03 sec, [debug]
@gchaix
gchaix / gist:80bf2310f46cdb6d3a4d
Created December 24, 2015 01:55
Running a vagrant clone of a prod site
1. Clone your vagrant template (i.e. https://github.com/tag1consulting/puppet-centos or https://github.com/gchaix/webdev-vagrant)
2. Clone the site code to somewhere convenient
3. Link cloned site code to where the vagrant template is expecting to see code (set in Vagrantfile.local for puppet-centos, symlink to `htdocs` in the repo root for webdev-vagrant)
4. Get a database dump
a. if on Acquia cloud, install the drush alias file for the acquia account and do a `drush @sitename.testsql-dump > site.sql` in the repo root
5. `vagrant up`
6. `vagrant ssh` into the box and load the database from the sql dump: `drush sql-cli < site.sql`
7. PROFIT!
@gchaix
gchaix / mysql_repl_check.sh
Created April 19, 2016 22:36
mysql replication check script
#!/bin/bash
#--- Configurables ------------------------------------------
# replication delay threshold
TH_SECONDS_BEHIND=5
# notifcation email (if blank, no email will be sent)
EMAIL_ADDR=""
#------------------------------------------------------------
@gchaix
gchaix / 503.mysql.sh
Created April 25, 2016 19:55 — forked from geoffgarside/503.mysql.sh
FreeBSD periodic/daily script for running MySQL backups
#! /bin/sh
#
# $FreeBSD$
#
# Maintenance shell script to backup mysql databases
# Put this in /usr/local/etc/periodic/daily, and it will be run
# every night
#
# By Geoff Garside <Geoff.Garside at m247.com>, Mon, Jan 24 13:04:18 GMT 2010
#
@gchaix
gchaix / zfs-snapshot.sh
Created April 25, 2016 20:00 — forked from ertug/zfs-snapshot.sh
Automatic ZFS Snapshot Rotation
#!/bin/bash
##
# original code: http://andyleonard.com/2010/04/07/automatic-zfs-snapshot-rotation-on-freebsd/
# 07/17/2011 - ertug: made it compatible with zfs-fuse which doesn't have .zfs directories
##
# Path to ZFS executable:
ZFS=/usr/local/sbin/zfs
# git-prompt
export GIT_PS1=1
if [ -f /usr/local/bin/git-prompt.sh ] && [ $GIT_PS1 -ne 0 ]; then
source /usr/local/bin/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWCOLORHINTS=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
#export PS1=${PS1}$(__git_ps1 "\n(%s)\$ ")
if [ "${SERVER_TYPE_PROMPT}" ]; then
PROMPT="${SERVER_TYPE_PROMPT}\[\033]0;\u@\h:$PWD\007\]"

Keybase proof

I hereby claim:

  • I am gchaix on github.
  • I am gchaix (https://keybase.io/gchaix) on keybase.
  • I have a public key ASCECah1aOibvrMVZvHQ9Q90E7b17e66mSy7gcagf1jiQgo

To claim this, I am signing this object: