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 / git-multi-status.sh
Created August 28, 2012 20:27 — forked from aroberts/git-multi-status.sh
Script for checking git status of many git repositories
#!/bin/bash
# usage: $0 source_dir [source_dir] ...
# where source_dir args are directories containing git repositories
red="\033[00;31m"
green="\033[00;32m"
yellow="\033[00;33m"
blue="\033[00;34m"
purple="\033[00;35m"
@cdracars
cdracars / gist:5594846
Last active December 17, 2015 10:28
Drupal Module Rename Code.
#!/bin/bash
# Module Rename script. Written by cdracars 2013
NAME=`find . -type f -name *.module | cut -c 3- | cut -d'.' -f1`
echo "Please enter a new name for the module."
read VAR
VAR1='windows' # String to be found.
VAR2='liniux' # String that will replace found string.
@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();