Skip to content

Instantly share code, notes, and snippets.

View cdracars's full-sized avatar
🎯
Focusing

Cody Dracars cdracars

🎯
Focusing
  • CFS Brands, LLC
  • Oklahoma City Oklahoma
  • X @cdracars
View GitHub Profile
@cdracars
cdracars / gist:9602711
Created March 17, 2014 16:27
Delete Infinite Loops
delete redirect from redirect, url_alias where url_alias.alias = redirect.source;
@cdracars
cdracars / gist:9602725
Created March 17, 2014 16:27
Find Infinite Loops
select * from redirect, url_alias where url_alias.alias = redirect.source;
/**
* @file
* A JavaScript file for the theme.
*/
// JavaScript should be made compatible with libraries other than jQuery by
// wrapping it with an "anonymous closure". See:
// - http://drupal.org/node/1446420
// - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
(function ($) {
@cdracars
cdracars / gist:1c999aadd5cfcd72b854
Created September 22, 2014 19:36
Download roles from chef server onto local directory
for role in `knife role list`; do
knife role show $role --format=json > $role.json
done
@cdracars
cdracars / chef-roles-to-json-task.rb
Last active August 29, 2015 14:06 — forked from timdiggins/chef-roles-to-json-task.rb
rake task to convert existing ruby roles to json. place file outside of roles and run.
# ADD this to Rakefile and run it by issuing rake roles:to_json
require 'chef'
root_dir = File.dirname(__FILE__)
ROLE_DIR = File.join(root_dir, 'roles')
namespace :roles do
desc "Convert ruby roles from ruby to json, creating/overwriting json files."
task :to_json do
Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file|
role = Chef::Role.new
@cdracars
cdracars / gist:db0bcdda009d952296aa
Last active August 29, 2015 14:07
IPTABLES Routing Rules

Standard routing rules

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -m comment --comment "Already approved traffic"
iptables -A INPUT -p tcp -i eth0 -m state --state NEW -s 0.0.0.0/0 -m multiport --dports 22,80,443 -j ACCEPT -m comment --comment "Let in the good stuff"
iptables -A INPUT -j DROP
iptables-save > /etc/iptables.rules

Create /etc/network/if-pre-up.d/iptables

vi /etc/network/if-pre-up.d/iptables

@cdracars
cdracars / gist:90596daa0c6066756b2b
Created October 17, 2014 20:29
php5-fpm rules for Aegir
<?php
/*
* Implementation of hook_provision_apache_vhost_config()
*/
function php5fpm_provision_apache_vhost_config($uri, $data) {
$plat = d()->root;
return "ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000" . $plat . "/$1";
}
?>
$page = new stdClass();
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'access_denied';
$page->task = 'page';
$page->admin_title = 'Access Denied (403)';
$page->admin_description = '';
$page->path = 'access-denied';
$page->access = array();
$page->menu = array();
#!/bin/sh​
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Some packages may be missing
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
git clone git://git.code.sf.net/p/zsh/code
cd zsh
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"