Skip to content

Instantly share code, notes, and snippets.

View hawkeyetwolf's full-sized avatar

Hawkeye Tenderwolf hawkeyetwolf

View GitHub Profile
@hawkeyetwolf
hawkeyetwolf / increase-open-files-limit.sh
Last active December 22, 2015 16:47
Increase OS X Open Files Limit (bash script)
#!/bin/bash
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>Increase open files limit</string>
<key>ProgramArguments</key>
<array>
@hawkeyetwolf
hawkeyetwolf / bash script to create plist
Last active August 29, 2015 14:07
Increase OS X Open Files Limit
#!/bin/bash
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>Increase open files limit</string>
<key>ProgramArguments</key>
<array>
@hawkeyetwolf
hawkeyetwolf / panels-403-page.php
Last active December 22, 2015 16:50
Drupal Panels Page 403 Export Code
<?php
$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';
@hawkeyetwolf
hawkeyetwolf / drush-alias-remote-host-check.php
Last active April 4, 2016 22:16
Drush aliases: scrub "remote host" key for cross-environment use
<?php
/**
* @file
* Example drush alias file for multihost use.
*/
// Alias settings common to all.
$aliases['base'] = array(
'root' => '/var/www/docroot',
@hawkeyetwolf
hawkeyetwolf / watchdog-krumo.php
Last active December 22, 2015 16:49
Watchdog with Krumo
<?php
$path = '/' . drupal_get_path('module', 'devel');
$js = $path . '/krumo/krumo.js';
$css = $path . '/krumo/skins/orange/skin.css';
$vars = array(
'!script' => "<script type='text/javascript' src='$js'></script>",
'!link' => "<link rel='stylesheet' type='text/css' href='$css'></link>",
);
watchdog('debug', kprint_r($_GET, TRUE) . '!script !link', $vars, WATCHDOG_DEBUG);
@hawkeyetwolf
hawkeyetwolf / review.sh
Last active December 22, 2015 16:51
Drush coder review with args
#!/bin/sh
drush coder-review --comment --no-empty --i18n --minor --sql --style --sniffer --security --release
@hawkeyetwolf
hawkeyetwolf / s3-uploader.sh
Last active June 20, 2017 15:36
Upload files to S3
#!/bin/sh
# Shortcut to the s3 console command.
s3='/usr/local/bin/aws s3'
# Define the AWS action: move (mv) or copy (cp).
action=$1
# Remove action from list of file arguments.
shift
@hawkeyetwolf
hawkeyetwolf / fix-permissions.sh
Created December 22, 2015 16:24
Restore secure file and directory permissions to Drupal site
#!/bin/bash
if [ $(id -u) != 0 ]; then
printf "This script must be run as root.\n"
exit 1
fi
drupal_path=${1%/}
drupal_user=${2}
httpd_group="${3:-www-data}"
# Help menu
@hawkeyetwolf
hawkeyetwolf / install-pre-commit-hook.php
Created December 22, 2015 16:26
Install useful git pre-commit hooks
<?php
echo "Creating hooks directory.\n";
mkdir('.git/hooks', 0775, true);
echo "Downloading pre-commit hook.\n";
$fp = fopen('.git/hooks/pre-commit', 'w');
$precommit = file_get_contents('http://gitscripts.s3.amazonaws.com/pre-commit');
fwrite($fp, $precommit);
fclose($fp);
.