Skip to content

Instantly share code, notes, and snippets.

@jgornick
jgornick / add-block-to-page-type.php
Created February 11, 2014 03:55
Concrete5: Add block to page type
<?php defined('C5_EXECUTE') or die('Access Denied.'); ?>
<?php $page = Page::getCurrentPage(); ?>
<?php $this->inc('elements/header.php'); ?>
<div class="container main">
<a href="/portfolio" title="Back to Portfolio">&lt; Back to Portfolio</a>
<h1><?php echo $page->getCollectionName(); ?></h1>
<?php
@jgornick
jgornick / roles-mysql-tasks-main.yml
Created March 20, 2014 22:38
Ansible: MySQL Override Options
- name: Override default mysqld options in the my.cnf
ini_file: >
dest="{{ mysql_conf_dir }}/my.cnf"
section=mysqld
option={{ item.name }}
value={{ item.value }}
with_items:
- mysql_override_options.mysqld
- name: Override default client options in the my.cnf
ini_file: >
@jgornick
jgornick / vm-cleanup.sh
Created March 27, 2014 14:17
VM + Bash: Cleanup
#!/bin/bash
# Removing leftover leases and persistent rules
echo "Cleaning up dhcp leases"
rm /var/lib/dhcp/*
# Make sure Udev doesn't block our network
echo "Cleaning up udev rules"
rm /etc/udev/rules.d/70-persistent-net.rules
mkdir /etc/udev/rules.d/70-persistent-net.rules
@jgornick
jgornick / remove-unmanaged-files.yml
Created June 10, 2014 21:46
Ansible: Remove Unmanaged Files
- name: Build list of managed files
shell: >
echo "ifcfg-{{ item.device | replace(':', '-') }}"
with_items: network_ether_interfaces
register: managed_files
- name: Capture interface config files
shell: >
ls -1 {{ net_path }}
register: found_files
@jgornick
jgornick / gist:3bbb8812b9fac6110e12
Created June 12, 2014 17:06
DevOps: Init.d Skeleton Script
#! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@jgornick
jgornick / Vagrantfile
Created August 13, 2014 16:29
Vagrant + Ruby: Require Environment Variables in Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
variables = %w{ANSIBLE_PATH ANSIBLE_VAULT_PASS}
missing = variables.find_all { |v| ENV[v] == nil }
unless missing.empty?
puts "FATAL: The following variables are missing and are needed to run this script: #{missing.join(', ')}."
@jgornick
jgornick / git-ssh.sh
Last active August 29, 2015 14:05
Git + SSH: Git SSH Options Wrapper
#!/bin/bash
# Wrapper script that reads the GIT_SSH_OPTS environment variable
# and uses the options when using git.
if [ -z "$GIT_SSH_OPTS" ]; then
ssh "$@"
else
ssh $GIT_SSH_OPTS "$@"
fi
@jgornick
jgornick / upstart.conf
Created August 29, 2014 16:42
Upstart: Node.js Daemon Service Template
description "My Node.js Application Service"
author "First Last"
start on runlevel [2345]
stop on runlevel [06]
respawn
respawn limit 20 5
console log
setuid root
@jgornick
jgornick / gist:96566d9b90eb1fbd97f5
Created August 31, 2014 03:05
Ansible: Set variable in task module template
---
# Global Users Collection
users:
- username: user1
state: present
name: User 1
keys:
- pub-key-01
groups:
- www-data